diff options
author | Go MAEDA <maeda@farend.jp> | 2022-10-17 13:38:44 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2022-10-17 13:38:44 +0000 |
commit | 83b6af8c77d7eed41a900c950b2103c93c2cdc42 (patch) | |
tree | 343d0fc4c7caa28121a8ea75d2e904d7f3f0a111 /lib/redmine | |
parent | 295a6493260991fb0bf43a39211297cb103cc01b (diff) | |
download | redmine-83b6af8c77d7eed41a900c950b2103c93c2cdc42.tar.gz redmine-83b6af8c77d7eed41a900c950b2103c93c2cdc42.zip |
Merged r21902 from trunk to 5.0-stable (#37767).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21903 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/wiki_formatting/textile/redcloth3.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index b935db6b9..c292926a5 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -1208,13 +1208,15 @@ class RedCloth3 < String end end - ALLOWED_TAGS = %w(redpre pre code kbd notextile) + ALLOWED_TAGS = %w(pre code kbd notextile) def escape_html_tags(text) - text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) do |m| - if ALLOWED_TAGS.include?($2) && $3.present? - "<#{$1}#{$3}" + text.gsub!(%r{<(\/?([!\w][^ >\t\f\r\n]*)[^<>\n]*)(>?)}) do |m| + all, tag, close = $1, $2, $3 + + if close.present? && (ALLOWED_TAGS.include?(tag) || (tag =~ /\Aredpre#\d+\z/)) + "<#{all}#{close}" else - "<#{$1}#{'>' unless $3.blank?}" + "<#{all}#{'>' unless close.blank?}" end end end |