Class: HParser::Block::UnorderList

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ListContainerHtml

#to_html

Constructor Details

#initialize(*items) ⇒ UnorderList

Returns a new instance of UnorderList.



42
43
44
# File 'lib/hparser/block/list.rb', line 42

def initialize(*items)
  @items = items
end

Instance Attribute Details

#itemsObject (readonly) Also known as: html_content, latex_content

Returns the value of attribute items.



41
42
43
# File 'lib/hparser/block/list.rb', line 41

def items
  @items
end

Class Method Details

.make_parser(level) ⇒ Object



37
38
39
# File 'lib/hparser/block/list.rb', line 37

def self.make_parser(level)
  Block.make_list_parser(level,'-'){|x| Ul.new(*x)}
end

.parse(scanner, context, inlines) ⇒ Object



33
34
35
# File 'lib/hparser/block/list.rb', line 33

def self.parse(scanner,context,inlines)
  Ul.make_parser(1).parse(scanner,context,inlines)
end

Instance Method Details

#==(o) ⇒ Object



46
47
48
# File 'lib/hparser/block/list.rb', line 46

def ==(o)
  o.class == self.class and o.items == self.items
end

#to_hatena(level = 0, label = nil) ⇒ Object



100
101
102
# File 'lib/hparser/hatena.rb', line 100

def to_hatena(level=0,label=nil)
  @items.map{|li| li.to_hatena(level+1,'-').chomp}.join("\n")+"\n"
end

#to_latexObject



185
186
187
188
# File 'lib/hparser/latex.rb', line 185

def to_latex
  content = super
  %Q[\\begin{itemize}\n#{items.map{|i| i.to_latex }.join("\n")}\n\\end{itemize}\n]
end

#to_textObject



90
91
92
# File 'lib/hparser/text.rb', line 90

def to_text
  @items.map{|li| '-'+li.to_text}.join("\n")
end