Class: HParser::Block::Dl::Item
- Inherits:
-
Object
- Object
- HParser::Block::Dl::Item
- Defined in:
- lib/hparser/html.rb,
lib/hparser/text.rb,
lib/hparser/latex.rb,
lib/hparser/block/dl.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(title, description) ⇒ Item
constructor
A new instance of Item.
- #to_html ⇒ Object
- #to_latex ⇒ Object
- #to_text ⇒ Object
Constructor Details
#initialize(title, description) ⇒ Item
Returns a new instance of Item.
12 13 14 15 |
# File 'lib/hparser/block/dl.rb', line 12 def initialize(title,description) @title = title @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
11 12 13 |
# File 'lib/hparser/block/dl.rb', line 11 def description @description end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
11 12 13 |
# File 'lib/hparser/block/dl.rb', line 11 def title @title end |
Instance Method Details
#==(o) ⇒ Object
17 18 19 20 21 |
# File 'lib/hparser/block/dl.rb', line 17 def ==(o) self.class == o.class and self.title == o.title and self.description == o.description end |
#to_html ⇒ Object
207 208 209 210 211 |
# File 'lib/hparser/html.rb', line 207 def to_html dt = self.title.map{|x| x.to_html}.join dd = self.description.map{|x| x.to_html}.join "<dt>#{dt}</dt><dd>#{dd}</dd>" end |
#to_latex ⇒ Object
142 143 144 145 146 147 |
# File 'lib/hparser/latex.rb', line 142 def to_latex dt = self.title.map{|x| x.to_latex}.join dd = self.description.map{|x| x.to_latex}.join %Q(\\item[#{dt}] \\quad \\\\\n#{dd}\n) end |
#to_text ⇒ Object
97 98 99 100 101 102 103 |
# File 'lib/hparser/text.rb', line 97 def to_text dt = self.title.map{|x| x.to_html}.join dd = self.description.map{|x| x.to_html}.join.split("\n").map{|x| ' '+x }.join("\n") "#{dt}\n#{dd}" end |