Feature #39884 ยป 0001-Allow-consecutive-footnote-references-in-Textile-39884.patch
lib/redmine/wiki_formatting/textile/redcloth3.rb | ||
---|---|---|
1042 | 1042 |
end |
1043 | 1043 | |
1044 | 1044 |
def footnote_ref( text ) |
1045 |
text.gsub!(/\b\[([0-9]+?)\](\s)?/,
|
|
1045 |
text.gsub!(/(?<=[\p{Word}\]])\[([0-9]+?)\](\s)?/,
|
|
1046 | 1046 |
'<sup><a href="#fn\1">\1</a></sup>\2') |
1047 | 1047 |
end |
1048 | 1048 |
test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | ||
---|---|---|
770 | 770 |
}, false) |
771 | 771 |
end |
772 | 772 | |
773 |
def test_should_allow_multiple_footnotes |
|
774 |
text = <<~STR |
|
775 |
Some demo[1][2] And a sentence.[1] |
|
776 | ||
777 |
fn1. One |
|
778 | ||
779 |
fn2. Two |
|
780 |
STR |
|
781 | ||
782 |
expected = <<~EXPECTED |
|
783 |
<p>Some demo<sup><a href="#fn1">1</a></sup><sup><a href="#fn2">2</a></sup> And a sentence.[1]</p> |
|
784 |
<p id="fn1" class="footnote"><sup>1</sup> One</p> |
|
785 |
<p id="fn2" class="footnote"><sup>2</sup> Two</p> |
|
786 |
EXPECTED |
|
787 |
assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '') |
|
788 |
end |
|
789 | ||
773 | 790 |
private |
774 | 791 | |
775 | 792 |
def assert_html_output(to_test, expect_paragraph = true) |