[wp-trac] [WordPress Trac] #60698: Token Map: Introduce an efficient lookup and translation class for string mappings.

WordPress Trac noreply at wordpress.org
Mon May 13 22:14:53 UTC 2024


#60698: Token Map: Introduce an efficient lookup and translation class for string
mappings.
----------------------------------------------------+---------------------
 Reporter:  dmsnell                                 |       Owner:  (none)
     Type:  feature request                         |      Status:  new
 Priority:  normal                                  |   Milestone:  6.6
Component:  General                                 |     Version:  trunk
 Severity:  normal                                  |  Resolution:
 Keywords:  has-patch needs-unit-tests 2nd-opinion  |     Focuses:
----------------------------------------------------+---------------------

Comment (by jorbin):

 Thanks for the quick response @dmsnell.

 So there are three spots where `html_entity_decode` is swapped and in
 return WordPress is now responsible for maintaining an additional library?

 Not sure why the diff isn't clear, but it's hard to tell which tests are
 now passing in tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php
 that would have failed before but now are passing. It also looks like
 there is at least one `tests1/line0737` that wasn't in the SKIP_TESTS
 array before that is now. Is it possible to make this section clearer so
 it's possible to know what tests are specifically being added and removed?
 I also opened #61209 to help with this in the future so that the tests are
 run automatically and the test runs can be used for this in the future

 For the specific implementation, my first thought is why is
 `WP_HTML_Decoder` a class if nearly everything is going to be a public
 static function? There also seems to be a mix of code that is actual code
 that is intended to be used and code that is used to generate the entities
 map. Ideally code that isn't something we intend for either core or
 extenders to be used at run time isn't included at run time.

 Also, `src/wp-includes/html-api/html5-named-character-entities.php` isn't
 an auto-generated class but the comment says it is. Assuming this is the
 output of `precomputed_php_source_table`?  I think the comments should be
 clearer. Why is phpcs disabled on it? Is there any way to avoid adding a
 new global?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60698#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list