diff options
Diffstat (limited to 'lib/rdoc/markup')
-rw-r--r-- | lib/rdoc/markup/to_bs.rb | 25 | ||||
-rw-r--r-- | lib/rdoc/markup/to_rdoc.rb | 14 |
2 files changed, 36 insertions, 3 deletions
diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb index f9b86487db..afd9d6e981 100644 --- a/lib/rdoc/markup/to_bs.rb +++ b/lib/rdoc/markup/to_bs.rb @@ -41,6 +41,31 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc end ## + # Prepares the visitor for consuming +list_item+ + + def accept_list_item_start list_item + type = @list_type.last + + case type + when :NOTE, :LABEL then + bullets = Array(list_item.label).map do |label| + attributes(label).strip + end.join "\n" + + bullets << ":\n" unless bullets.empty? + + @prefix = ' ' * @indent + @indent += 2 + @prefix << bullets + (' ' * @indent) + else + bullet = type == :BULLET ? '*' : @list_index.last.to_s + '.' + @prefix = (' ' * @indent) + bullet.ljust(bullet.length + 1) + width = bullet.length + 1 + @indent += width + end + end + + ## # Turns on or off regexp handling for +convert_string+ def annotate tag diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb index 6929049582..88234f5096 100644 --- a/lib/rdoc/markup/to_rdoc.rb +++ b/lib/rdoc/markup/to_rdoc.rb @@ -145,11 +145,19 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter case type when :NOTE, :LABEL then - bullets = Array(list_item.label).map do |label| + stripped_labels = Array(list_item.label).map do |label| attributes(label).strip - end.join "\n" + end + + bullets = case type + when :NOTE + stripped_labels.map { |b| "#{b}::" } + when :LABEL + stripped_labels.map { |b| "[#{b}]" } + end - bullets << ":\n" unless bullets.empty? + bullets = bullets.join("\n") + bullets << "\n" unless stripped_labels.empty? @prefix = ' ' * @indent @indent += 2 |