From d05d732080fac8599cdbb182009c78e60ba3518e Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Fri, 22 Dec 2023 01:48:13 +0000 Subject: Merge r22546 from trunk to 5.0-stable (#39884). git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22548 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/wiki_formatting/textile/redcloth3.rb | 2 +- .../redmine/wiki_formatting/textile_formatter_test.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 9062fca0d..04ac3ba56 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -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)?/, '\1\2') end diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 24f9886ed..77eb01734 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -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 +

Some demo12 And a sentence.[1]

+

1 One

+

2 Two

+ 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) -- cgit v1.2.3