Class: HParser::Block::ListItem
- Inherits:
-
Object
- Object
- HParser::Block::ListItem
- 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
-
#content ⇒ Object
(also: #latex_content, #hatena_content)
readonly
Returns the value of attribute content.
Class Method Summary collapse
Instance Method Summary collapse
- #==(o) ⇒ Object
- #_to_hatena_ ⇒ Object
-
#initialize(content) ⇒ ListItem
constructor
A new instance of ListItem.
- #text_content ⇒ Object
- #to_hatena(level, label) ⇒ Object
- #to_html ⇒ Object
- #to_latex ⇒ Object
Methods included from Text
Constructor Details
#initialize(content) ⇒ ListItem
Returns a new instance of ListItem.
86 87 88 |
# File 'lib/hparser/block/list.rb', line 86 def initialize(content) @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly) Also known as: latex_content, hatena_content
Returns the value of attribute content.
85 86 87 |
# File 'lib/hparser/block/list.rb', line 85 def content @content end |
Class Method Details
.make_parser(level, mark) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/hparser/block/list.rb', line 76 def self.make_parser(level,mark) include HParser::Util ProcParser.new{|scanner,context,inlines| if scanner.scan(/\A#{Regexp.quote mark*level}.*/) then ListItem.new inlines.parse(scanner.matched[level..-1].strip, context) end } end |
Instance Method Details
#==(o) ⇒ Object
90 91 92 |
# File 'lib/hparser/block/list.rb', line 90 def ==(o) o.class==self.class and o.content == self.content end |
#_to_hatena_ ⇒ Object
116 |
# File 'lib/hparser/hatena.rb', line 116 alias_method :_to_hatena_,:to_hatena |
#text_content ⇒ Object
124 125 126 |
# File 'lib/hparser/text.rb', line 124 def text_content [HParser::Inline::Text.new(' '),self.content].flatten end |
#to_hatena(level, label) ⇒ Object
117 118 119 |
# File 'lib/hparser/hatena.rb', line 117 def to_hatena(level,label) label*level + _to_hatena_ end |
#to_html ⇒ Object
252 253 254 255 256 257 258 |
# File 'lib/hparser/html.rb', line 252 def to_html if content.class == Array then content.map{|x| x.to_html}.join else content end end |
#to_latex ⇒ Object
207 208 209 210 |
# File 'lib/hparser/latex.rb', line 207 def to_latex content = super " \\item #{content}\n" end |