Permalink
Browse files

Fixed footnote conversion from RD to Markdown

Overzealous parsing of specials causes greedy matching of rdoc- links.
Work around this by adding a space after the foottext link in the
documentation tree created from RD.
  • Loading branch information...
1 parent 81f4775 commit fe80605f8fc692453c6da57a75141d35809642ac @drbrain drbrain committed Dec 16, 2012
@@ -150,7 +150,7 @@ def handle_rdoc_link url
when /\Ardoc-ref:/ then
$'
when /\Ardoc-label:footmark-(\d+)/ then
- "[^#{$1}]: "
+ "[^#{$1}]:"
when /\Ardoc-label:foottext-(\d+)/ then
"[^#{$1}]"
when /\Ardoc-label:label-/ then
@@ -611,7 +611,7 @@ def add_footnote content
footmark_link = "{^#{index}}[rdoc-label:footmark-#{index}:foottext-#{index}]"
- @footnotes << RDoc::Markup::Paragraph.new(footmark_link, *content)
+ @footnotes << RDoc::Markup::Paragraph.new(footmark_link, ' ', *content)
@footnotes << RDoc::Markup::BlankLine.new
index
@@ -364,7 +364,7 @@ def test_convert_TIDYLINK
end
def test_handle_rdoc_link_label_footmark
- assert_equal '[^1]: ', @to.handle_rdoc_link('rdoc-label:footmark-1:x')
+ assert_equal '[^1]:', @to.handle_rdoc_link('rdoc-label:footmark-1:x')
end
def test_handle_rdoc_link_label_foottext
@@ -21,7 +21,7 @@ def test_add_footnote
assert_equal 1, index
expected = [
- para('{^1}[rdoc-label:footmark-1:foottext-1]', 'context'),
+ para('{^1}[rdoc-label:footmark-1:foottext-1]', ' ', 'context'),
blank_line,
]
@@ -136,7 +136,7 @@ def test_parse_footnote
doc(
para("{*1}[rdoc-label:foottext-1:footmark-1]"),
rule(1),
- para("{^1}[rdoc-label:footmark-1:foottext-1]", "text"),
+ para("{^1}[rdoc-label:footmark-1:foottext-1]", " ", "text"),
blank_line)
assert_equal expected, parse("((-text-))")
@@ -26,7 +26,7 @@ def test_parse_footnote
assert_equal '{*1}[rdoc-label:foottext-1:footmark-1]', parse('((-text-))')
expected = [
- @RM::Paragraph.new('{^1}[rdoc-label:footmark-1:foottext-1]', 'text'),
+ @RM::Paragraph.new('{^1}[rdoc-label:footmark-1:foottext-1]', ' ', 'text'),
blank_line,
]

0 comments on commit fe80605

Please sign in to comment.