diff options
-rw-r--r-- | lib/redmine/wiki_formatting/textile/redcloth3.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 5a8c15142..feed1e3fc 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -1215,7 +1215,13 @@ class RedCloth3 < String ALLOWED_TAGS = %w(redpre pre code kbd notextile) def escape_html_tags(text) - text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" } + text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) do |m| + if ALLOWED_TAGS.include?($2) && $3.present? + "<#{$1}#{$3}" + else + "<#{$1}#{'>' unless $3.blank?}" + end + end end end |