##// END OF EJS Templates
Textile: ignore invalid lang attribute values (#18501)....
Jean-Philippe Lang -
r13295:ef5ff1630acb
parent child
Show More
@@ -341,7 +341,7 class RedCloth3 < String
341 A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
341 A_HLGN = /(?:(?:<>|<|>|\=|[()]+)+)/
342 A_VLGN = /[\-^~]/
342 A_VLGN = /[\-^~]/
343 C_CLAS = '(?:\([^")]+\))'
343 C_CLAS = '(?:\([^")]+\))'
344 C_LNGE = '(?:\[[^"\[\]]+\])'
344 C_LNGE = '(?:\[[a-z\-_]+\])'
345 C_STYL = '(?:\{[^"}]+\})'
345 C_STYL = '(?:\{[^"}]+\})'
346 S_CSPN = '(?:\\\\\d+)'
346 S_CSPN = '(?:\\\\\d+)'
347 S_RSPN = '(?:/\d+)'
347 S_RSPN = '(?:/\d+)'
@@ -480,7 +480,7 class RedCloth3 < String
480 end
480 end
481
481
482 lang = $1 if
482 lang = $1 if
483 text.sub!( /\[([^)]+?)\]/, '' )
483 text.sub!( /\[([a-z\-_]+?)\]/, '' )
484
484
485 cls = $1 if
485 cls = $1 if
486 text.sub!( /\(([^()]+?)\)/, '' )
486 text.sub!( /\(([^()]+?)\)/, '' )
@@ -110,6 +110,20 class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase
110 )
110 )
111 end
111 end
112
112
113 def test_lang_attribute
114 assert_html_output(
115 '*[fr]French*' => '<strong lang="fr">French</strong>',
116 '*[fr-fr]French*' => '<strong lang="fr-fr">French</strong>',
117 '*[fr_fr]French*' => '<strong lang="fr_fr">French</strong>'
118 )
119 end
120
121 def test_lang_attribute_should_ignore_invalid_value
122 assert_html_output(
123 '*[fr3]French*' => '<strong>[fr3]French</strong>'
124 )
125 end
126
113 def test_nested_lists
127 def test_nested_lists
114 raw = <<-RAW
128 raw = <<-RAW
115 # Item 1
129 # Item 1
General Comments 0
You need to be logged in to leave comments. Login now