From: C. Scott Ananian Date: Tue, 24 Jun 2014 18:15:25 +0000 (-0400) Subject: Allow HTML5 tag (ruby support for East Asian typography). X-Git-Tag: 1.31.0-rc.0~15055^2 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=fb125de072338f56dfd2ba08bab3c08c19ebdc6e;p=lhc%2Fweb%2Fwiklou.git Allow HTML5 tag (ruby support for East Asian typography). We currently allow , , , and but not the W3C HTML5 element. Fix that. (Note that and are new additions to HTML5 which currently appear in the W3C but not the WHATWG version of the HTML5 spec. Support for these has already been merged in gecko and webkit and the editor plans to update the WHATWG spec.) Bug: 67042 Change-Id: I8c0e65d782b6d23057a9723b87323b28e8bf8852 --- diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 6a568c2d0c..ec17a0895c 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -383,7 +383,7 @@ class Sanitizer { 'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's', 'strike', 'strong', 'tt', 'var', 'div', 'center', 'blockquote', 'ol', 'ul', 'dl', 'table', 'caption', 'pre', - 'ruby', 'rt', 'rb', 'rp', 'p', 'span', 'abbr', 'dfn', + 'ruby', 'rb', 'rp', 'rt', 'rtc', 'p', 'span', 'abbr', 'dfn', 'kbd', 'samp', 'data', 'time', 'mark' ); $htmlsingle = array( @@ -1685,10 +1685,10 @@ class Sanitizer { # http://www.whatwg.org/html/text-level-semantics.html#the-ruby-element 'ruby' => $common, # rbc - # rtc 'rb' => $common, - 'rt' => $common, #array_merge( $common, array( 'rbspan' ) ), 'rp' => $common, + 'rt' => $common, #array_merge( $common, array( 'rbspan' ) ), + 'rtc' => $common, # MathML root element, where used for extensions # 'title' may not be 100% valid here; it's XHTML diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index cde7a2d83e..79c8ade65e 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -378,7 +378,7 @@ class CoreParserFunctions { // list of disallowed tags for DISPLAYTITLE // these will be escaped even though they are allowed in normal wiki text $bad = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', - 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rp', 'br' ); + 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rtc', 'rp', 'br' ); // disallow some styles that could be used to bypass $wgRestrictDisplayTitle if ( $wgRestrictDisplayTitle ) { diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index e4d93242e4..6097370612 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -1087,7 +1087,7 @@ Non-html5 tags should be accepted

!! end -## a,rtc not permitted +## a not permitted ## i,b,br omitted !! test Text-level semantic html elements in wikitext @@ -1109,7 +1109,7 @@ Text-level semantic html elements in wikitext text text text -明日(Ashita) +明日(Ashita あした) text text text @@ -1132,7 +1132,7 @@ Text-level semantic html elements in wikitext text text text -明日(Ashita) +明日(Ashita あした) text text text @@ -1140,6 +1140,46 @@ Text-level semantic html elements in wikitext

!! end +# test cases taken from +# http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element +!! test +Ruby markup (W3C-style) +!! wikitext +; Mono-ruby for individual base characters +: 日に本ほん語ご +; Group ruby +: 今日きょう +; Jukugo ruby +: 法華経ほけきょう +; Inline ruby +: 東京(とうきょう) +; Double-sided ruby +: 旧金山jiùjīnshānSan Francisco + + +♥HeartCœur +☘ShamrockTrèfle +✶StarÉtoile + +!! html +
Mono-ruby for individual base characters
+
日に本ほん語ご
+
Group ruby
+
今日きょう
+
Jukugo ruby
+
法華経ほけきょう
+
Inline ruby
+
東京(とうきょう)
+
Double-sided ruby
+
旧金山jiùjīnshānSan Francisco
+

+♥HeartCœur +☘ShamrockTrèfle +✶StarÉtoile + +

+!! end + !! test Non-word characters don't terminate tag names (bug 17663, 40670, 52022) !! wikitext