Textile: ignore invalid lang attribute values (#18501).

git-svn-id: http://svn.redmine.org/redmine/trunk@13677 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-11-30 14:55:03 +00:00
parent f04148695a
commit ef5ff1630a
2 changed files with 16 additions and 2 deletions

View File

@@ -341,7 +341,7 @@ class RedCloth3 < String
A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
A_VLGN = /[\-^~]/
C_CLAS = '(?:\([^")]+\))'
C_LNGE = '(?:\[[^"\[\]]+\])'
C_LNGE = '(?:\[[a-z\-_]+\])'
C_STYL = '(?:\{[^"}]+\})'
S_CSPN = '(?:\\\\\d+)'
S_RSPN = '(?:/\d+)'
@@ -480,7 +480,7 @@ class RedCloth3 < String
end
lang = $1 if
text.sub!( /\[([^)]+?)\]/, '' )
text.sub!( /\[([a-z\-_]+?)\]/, '' )
cls = $1 if
text.sub!( /\(([^()]+?)\)/, '' )

View File

@@ -110,6 +110,20 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase
)
end
def test_lang_attribute
assert_html_output(
'*[fr]French*' => '<strong lang="fr">French</strong>',
'*[fr-fr]French*' => '<strong lang="fr-fr">French</strong>',
'*[fr_fr]French*' => '<strong lang="fr_fr">French</strong>'
)
end
def test_lang_attribute_should_ignore_invalid_value
assert_html_output(
'*[fr3]French*' => '<strong>[fr3]French</strong>'
)
end
def test_nested_lists
raw = <<-RAW
# Item 1