Class: HParser::Block::OrderList
- Inherits:
-
Object
- Object
- HParser::Block::OrderList
- Includes:
- Collectable, Latex, ListContainerHtml
- Defined in:
- lib/hparser/block/list.rb,
lib/hparser/html.rb,
lib/hparser/text.rb,
lib/hparser/latex.rb,
lib/hparser/hatena.rb
Overview
This class undocumented. Maybe rewrite in near future.
Instance Attribute Summary collapse
-
#items ⇒ Object
(also: #html_content, #latex_content)
readonly
Returns the value of attribute items.
Class Method Summary collapse
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(*items) ⇒ OrderList
constructor
A new instance of OrderList.
- #to_hatena(level = 0, label = nil) ⇒ Object
- #to_latex ⇒ Object
- #to_text ⇒ Object
Methods included from ListContainerHtml
Constructor Details
#initialize(*items) ⇒ OrderList
Returns a new instance of OrderList.
64 65 66 |
# File 'lib/hparser/block/list.rb', line 64 def initialize(*items) @items = items end |
Instance Attribute Details
#items ⇒ Object (readonly) Also known as: html_content, latex_content
Returns the value of attribute items.
63 64 65 |
# File 'lib/hparser/block/list.rb', line 63 def items @items end |
Class Method Details
.make_parser(level) ⇒ Object
59 60 61 |
# File 'lib/hparser/block/list.rb', line 59 def self.make_parser(level) Block.make_list_parser(level,'+'){|x| Ol.new(*x) } end |
.parse(scanner, context, inlines) ⇒ Object
55 56 57 |
# File 'lib/hparser/block/list.rb', line 55 def self.parse(scanner,context,inlines) Ol.make_parser(1).parse(scanner,context,inlines) end |
Instance Method Details
#==(o) ⇒ Object
68 69 70 |
# File 'lib/hparser/block/list.rb', line 68 def ==(o) o.class == self.class and o.items == self.items end |
#to_hatena(level = 0, label = nil) ⇒ Object
106 107 108 109 110 |
# File 'lib/hparser/hatena.rb', line 106 def to_hatena(level=0,label=nil) @items.map{|li| li.to_hatena(level+1,'+').chomp }.join("\n")+"\n" end |
#to_latex ⇒ Object
195 196 197 198 |
# File 'lib/hparser/latex.rb', line 195 def to_latex content = super %Q[\\begin{enumerate}\n#{items.map{|i| i.to_latex }.join("\n")}\n\\end{enumerate}\n] end |
#to_text ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/hparser/text.rb', line 113 def to_text i = 0 @items.map{|li| i += 1 "#{i}." +li.to_text }.join("\n") end |