Make WordPress Core

Changeset 52969


Ignore:
Timestamp:
03/21/2022 12:28:55 AM (2 years ago)
Author:
SergeyBiryukov
Message:

KSES: Add support for <ruby> and related elements.

<ruby> 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 <ruby>, <rt>, and <rp> in the HTML Standard, while some browsers (like Firefox) additionally support <rb> and <rtc> for more advanced formatting, which are not yet included in the official HTML spec, but can be found in a W3C extension.

Props upsuper, mukesh27, SergeyBiryukov.
Fixes #54698.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/kses.php

    r52968 r52969  
    250250            'cite' => true,
    251251        ),
     252        'rb'         => array(),
     253        'rp'         => array(),
     254        'rt'         => array(),
     255        'rtc'        => array(),
     256        'ruby'       => array(),
    252257        's'          => array(),
    253258        'samp'       => array(),
  • trunk/tests/phpunit/tests/kses.php

    r52968 r52969  
    862862     * @ticket 34063
    863863     */
    864     public function test_bdo() {
     864    public function test_bdo_tag_allowed() {
    865865        global $allowedposttags;
    866866
     
    871871
    872872    /**
     873     * @ticket 54698
     874     */
     875    public function test_ruby_tag_allowed() {
     876        global $allowedposttags;
     877
     878        $input = '<ruby>✶<rp>: </rp><rt>Star</rt><rp>, </rp><rt lang="fr">Étoile</rt><rp>.</rp></ruby>';
     879
     880        $this->assertSame( $input, wp_kses( $input, $allowedposttags ) );
     881    }
     882
     883    /**
    873884     * @ticket 35079
    874885     */
    875     public function test_ol_reversed() {
     886    public function test_ol_reversed_attribute_allowed() {
    876887        global $allowedposttags;
    877888
Note: See TracChangeset for help on using the changeset viewer.