Fixes broken references for multiple footnote usage (#42648).

git-svn-id: https://svn.redmine.org/redmine/trunk@23726 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2025-04-30 22:40:18 +00:00
parent 2b9c6f64b1
commit e6f00370ee
2 changed files with 9 additions and 5 deletions

View File

@@ -105,7 +105,7 @@ module Redmine
node = env[:node] node = env[:node]
return unless node.name == "a" return unless node.name == "a"
return unless node.has_attribute?("id") return unless node.has_attribute?("id")
return if node.name == "a" && node["id"] =~ /\Afnref-\d+\z/ return if node.name == "a" && node["id"] =~ /\Afnref(-\d+){1,2}\z/
node.remove_attribute("id") node.remove_attribute("id")
} }

View File

@@ -47,10 +47,14 @@ if Object.const_defined?(:Commonmarker)
end end
def test_should_support_footnotes def test_should_support_footnotes
input = %(<a href="#fn-1" id="fnref-1">foo</a>) [
assert_equal input, filter(input) %(<a href="#fn-1" id="fnref-1">foo</a>),
input = %(<ol><li id="fn-1">footnote</li></ol>) %(<a href="#fn-1" id="fnref-1-2">foo</a>),
assert_equal input, filter(input) %(<ol><li id="fn-1">footnote</li></ol>),
].each do | input |
assert_equal input, filter(input)
assert_equal input, filter(input)
end
end end
def test_should_remove_invalid_ids def test_should_remove_invalid_ids