Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v1_8_7_330) is shown here.
handled_labeled_list(line, level, margin, offset, prefix)
private
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:
this is a long label that I wrote |
and here is the block of text with a silly margin
|
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
this is a long label that I wrote |
here is a more reasonably indented block which will ab attached to the
label.
|
Show source
def handled_labeled_list(line, level, margin, offset, prefix)
prefix_length = prefix.length
text = line.text
flag = nil
case prefix
when /^\[/
flag = ListBase::LABELED
prefix = prefix[1, prefix.length-2]
when /:$/
flag = ListBase::NOTE
prefix.chop!
else raise "Invalid List Type: #{self.inspect}"
end
if text.length <= offset
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
@lines.unget
return false
else
offset = i
prefix_length = 0
@lines.delete(original_line)
end
end
line.stamp(Line::LIST, level+1, prefix, flag)
text[margin, prefix_length] = " " * prefix_length
assign_types_to_lines(offset, level + 1)
return true
end