I was asked for ideas about how to fix some old problems in the WordPress code base. Specifically, bugs in the Formatting component, which includes the very heart of blog post processing for millions of websites. This roadmap lays out recent changes and a plan for where to go next.
- Implemented NBSP compatibility for curly quotes to fix common cosmetic flaws.
- Revised all regex in wptexturize to avoid slow searches.
- Added a large number of unit tests to cover all known behaviors of wptexturize.
- Implemented NBSP compatibility for shortcodes and smilies.
- Deprecated and replaced function like_escape().
- Fixed wptexturize parsing for square braces inside of HTML.
- Sorted the texturize patterns into groups for better performance.
- Refactored the wptexturize stack function for better performance.
- Wptexturize now runs up to 5x faster compared to v3.8.
4.1 or Future Releases
Wpautop Phase 1 – Research Problem
- What is the basic need for wpautop? Why not rely on TinyMCE formatting?
- What is the exact relationship between the PHP and JS versions of wpautop?
- Define the intended behavior of wpautop in simplest possible terms.
- Describe exactly which I/O combinations are working correctly.
- What is the meaning of on blank lines and when is it supposed to work?
- Summarize the list of open bugs and group them into structural defects.
- Analyze redundancies among wpautop, wptexturize, do_shortcode, kses, make_clickable, etc.
- Analyze the problems involving different versions of HTML and how they represent whitespace.
- Publish results in a site section or wiki for ongoing updates.
Wpautop Phase 2 – Planning
- Establish design objectives. Decide which bugs to resolve and which behaviors to create.
- Establish goals for performance and complexity.
- Determine the top-down strategy for the new algorithms.
- Determine the type and complexity of parsing needed to meet design objectives.
- Determine whether the existing function should be patched or re-written.
- Determine the extent to which parsing can be consolidated among other WP functions.
- Decide whether the existing PHP and JS code duplication is optimal or needs changes.
- Recognize problem areas for backward compatibility.
- Write proofs of concept as needed to support these decisions.
Wpautop Phase 3 – New Code
- Add and commit unit tests appropriate for the old design of wpautop.
- Write the new wpautop.
- Test and update unit tests for the new wpautop.
- Commit new code early in a pre-beta phase of development.
- Improve documentation of shortcode functions.
- Formalize the shortcode syntax.
- Ensure all related features are compatible with the formal syntax.
- Filters need to be reviewed and expanded to support modern languages.