From 26c7b2b0796a826fee3ca2eba9828ee212106b09 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 21 Mar 2022 00:28:55 +0000 Subject: [PATCH] KSES: Add support for `` and related elements. `` element and its friends are used to attach annotation text onto a piece of text. This is especially commonly used in Japanese content, but it can also been seen in content of other languages like Chinese. The set of elements to enable such functionality consists of ``, ``, and `` in the [https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element HTML Standard], while some browsers (like Firefox) additionally support `` and `` for more advanced formatting, which are not yet included in the official HTML spec, but can be found in a [https://www.w3.org/TR/html-ruby-extensions/ W3C extension]. Props upsuper, mukesh27, SergeyBiryukov. Fixes #54698. git-svn-id: https://develop.svn.wordpress.org/trunk@52969 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/kses.php | 5 +++++ tests/phpunit/tests/kses.php | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/kses.php b/src/wp-includes/kses.php index 91bb04260a..03a4881fb3 100644 --- a/src/wp-includes/kses.php +++ b/src/wp-includes/kses.php @@ -249,6 +249,11 @@ if ( ! CUSTOM_TAGS ) { 'q' => array( 'cite' => true, ), + 'rb' => array(), + 'rp' => array(), + 'rt' => array(), + 'rtc' => array(), + 'ruby' => array(), 's' => array(), 'samp' => array(), 'span' => array( diff --git a/tests/phpunit/tests/kses.php b/tests/phpunit/tests/kses.php index 57dc2ae402..fc6882242f 100644 --- a/tests/phpunit/tests/kses.php +++ b/tests/phpunit/tests/kses.php @@ -861,7 +861,7 @@ EOF; /** * @ticket 34063 */ - public function test_bdo() { + public function test_bdo_tag_allowed() { global $allowedposttags; $input = '

This is a BDO tag. Weird, right?

'; @@ -869,10 +869,21 @@ EOF; $this->assertSame( $input, wp_kses( $input, $allowedposttags ) ); } + /** + * @ticket 54698 + */ + public function test_ruby_tag_allowed() { + global $allowedposttags; + + $input = ': Star, Étoile.'; + + $this->assertSame( $input, wp_kses( $input, $allowedposttags ) ); + } + /** * @ticket 35079 */ - public function test_ol_reversed() { + public function test_ol_reversed_attribute_allowed() { global $allowedposttags; $input = '
  1. Item 1
  2. Item 2
  3. Item 3
';