Handle labeled list entries, We have a special case to deal with. Because
the labels can be long, they force the remaining block of text over the to
right:
So we allow the special case. If the label is followed by nothing, and if
the following line is indented, then we take the indent of that line as the
new margin.
# File lib/rdoc/markup.rb, line 265
def handled_labeled_list(line, level, margin, offset, prefix)
prefix_length = prefix.length
text = line.text
flag = nil
case prefix
when /^\[/ then
flag = :LABELED
prefix = prefix[1, prefix.length-2]
when /:$/ then
flag = :NOTE
prefix.chop!
else
raise "Invalid List Type: #{self.inspect}"
end
# body is on the next line
if text.length <= offset then
original_line = line
line = @lines.next
return false unless line
text = line.text
for i in 0..margin
if text[i] != SPACE
@lines.unget
return false
end
end
i = margin
i += 1 while text[i] == SPACE
if i >= text.length then
@lines.unget
return false
else
offset = i
prefix_length = 0
if text[offset..-1] =~ SIMPLE_LIST_RE then
@lines.unget
line = original_line
line.text = ''
else
@lines.delete original_line
end
end
end
line.stamp :LIST, level+1, prefix, flag
text[margin, prefix_length] = " " * prefix_length
assign_types_to_lines(offset, level + 1)
return true
end