1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 19:47:14 +00:00

Allow consecutive footnote references inTextile (#39884).

Patch by @hjust.

git-svn-id: https://svn.redmine.org/redmine/trunk@22546 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2023-12-22 01:44:02 +00:00
parent 081d6c3713
commit 1f7f1a2db7
2 changed files with 18 additions and 1 deletions

View File

@ -1042,7 +1042,7 @@ class RedCloth3 < String
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

View File

@ -770,6 +770,23 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase
}, 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)