Class: Plurimath::UnicodeMath::Parser
- Inherits:
-
Object
- Object
- Plurimath::UnicodeMath::Parser
- Defined in:
- lib/plurimath/unicode_math/parser.rb
Constant Summary collapse
- LABELED_TR_REGEX =
/"([^"]*(#|#|\\\\eqno)[^"]*[^"]*|[^"]*(#|#|\\\\eqno)[^"]*[^"]*)"/
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(text) ⇒ Parser
Returns a new instance of Parser.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/plurimath/unicode_math/parser.rb', line 15 def initialize(text) text = pre_processing(text) @text = HTMLEntities.new.encode(text, :hexadecimal) @text = @text.gsub("&", "&") @text = @text.gsub(""", "\"") @text = @text.gsub(/⫷.*⫸/, "") @text = @text.gsub(/\\\\/, "\\") @text = @text.gsub(/\\u([\da-fA-F]{1,5})\w{0,5}/) { "&#x#{$1};" } # Converting \u#{xxxx} encoding to &#x#{xxxx}; @text = @text.strip end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
11 12 13 |
# File 'lib/plurimath/unicode_math/parser.rb', line 11 def text @text end |