Feature #39884 ยป 0001-Allow-consecutive-footnote-references-in-Textile-39884.patch
| lib/redmine/wiki_formatting/textile/redcloth3.rb | ||
|---|---|---|
|
end
|
||
|
def footnote_ref( text )
|
||
|
text.gsub!(/\b\[([0-9]+?)\](\s)?/,
|
||
|
text.gsub!(/(?<=[\p{Word}\]])\[([0-9]+?)\](\s)?/,
|
||
|
'<sup><a href="#fn\1">\1</a></sup>\2')
|
||
|
end
|
||
| test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | ||
|---|---|---|
|
}, false)
|
||
|
end
|
||
|
def test_should_allow_multiple_footnotes
|
||
|
text = <<~STR
|
||
|
Some demo[1][2] And a sentence.[1]
|
||
|
fn1. One
|
||
|
fn2. Two
|
||
|
STR
|
||
|
expected = <<~EXPECTED
|
||
|
<p>Some demo<sup><a href="#fn1">1</a></sup><sup><a href="#fn2">2</a></sup> And a sentence.[1]</p>
|
||
|
<p id="fn1" class="footnote"><sup>1</sup> One</p>
|
||
|
<p id="fn2" class="footnote"><sup>2</sup> Two</p>
|
||
|
EXPECTED
|
||
|
assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
|
||
|
end
|
||
|
private
|
||
|
def assert_html_output(to_test, expect_paragraph = true)
|
||