Class: HParser::Inline::Tex
- Inherits:
-
Object
- Object
- HParser::Inline::Tex
- Includes:
- Html, Collectable
- Defined in:
- lib/hparser/html.rb,
lib/hparser/text.rb,
lib/hparser/latex.rb,
lib/hparser/inline/tex.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
(also: #to_text)
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(text) ⇒ Tex
constructor
A new instance of Tex.
- #to_html ⇒ Object
- #to_latex ⇒ Object
Methods included from Html
Constructor Details
#initialize(text) ⇒ Tex
Returns a new instance of Tex.
12 13 14 |
# File 'lib/hparser/inline/tex.rb', line 12 def initialize(text) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly) Also known as: to_text
Returns the value of attribute text.
11 12 13 |
# File 'lib/hparser/inline/tex.rb', line 11 def text @text end |
Class Method Details
Instance Method Details
#==(o) ⇒ Object
22 23 24 |
# File 'lib/hparser/inline/tex.rb', line 22 def ==(o) self.class == o.class and @text == o.text end |
#to_html ⇒ Object
332 333 334 335 |
# File 'lib/hparser/html.rb', line 332 def to_html url = "http://chart.apis.google.com/chart?cht=tx&chf=bg,s,00000000&chl=" + CGI.escape(self.text) %(<img src="#{escape(url)}" class="tex" alt="#{escape(self.text)}">) end |
#to_latex ⇒ Object
254 255 256 |
# File 'lib/hparser/latex.rb', line 254 def to_latex %($#{self.text}$) end |