method
build_list
v1_9_2_180 -
Show latest stable
- Class:
RDoc::Markup::Parser
build_list(margin)public
Builds a List flush to margin
# File lib/rdoc/markup/parser.rb, line 98
def build_list margin
p :list_start => margin if @debug
list = RDoc::Markup::List.new
until @tokens.empty? do
type, data, column, = get
case type
when :BULLET, :LABEL, :LALPHA, :NOTE, :NUMBER, :UALPHA then
list_type = type
if column < margin then
unget
break
end
if list.type and list.type != list_type then
unget
break
end
list.type = list_type
case type
when :NOTE, :LABEL then
_, indent, = get # SPACE
if :NEWLINE == peek_token.first then
get
peek_type, new_indent, peek_column, = peek_token
indent = new_indent if
peek_type == :INDENT and peek_column >= column
unget
end
else
data = nil
_, indent, = get
end
list_item = build_list_item(margin + indent, data)
list << list_item if list_item
else
unget
break
end
end
p :list_end => margin if @debug
return nil if list.empty?
list
end Related methods
- Instance methods
- build_heading
- build_list
- build_list_item
- build_paragraph
- build_verbatim
- get
- parse
- peek_token
- skip
- text
- token_pos
- tokenize
- unget
- Class methods
- new
- parse
- tokenize