Making WordPress.org


Ignore:
Timestamp:
12/20/2018 12:54:55 AM (6 years ago)
Author:
dd32
Message:

Gutenberg Docs: Update the url magic to account for the new url forms of /packages/ and /docs/ when stripping the readme.md suffixes.

This was mistakenly left out of https://meta.trac.wordpress.org/changeset/7989 when merging from testing to production.

See https://github.com/WordPress/gutenberg/pull/12835#issuecomment-448521372

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/inc/docs-importer.php

    r7989 r7993  
    279279
    280280        // Remove the .md extension from relative links and treat 'readme.md' as an index
    281         $markdown = preg_replace( '/(\[.*?\]\((\.\.\/)+.*?)((\/readme)?\.md)?(#.*)?\)/i', '$1$5)', $markdown );
     281        $markdown = preg_replace( '@(\[.*?\]\(((\.\./)+docs/|/docs/|/packages/).*?)(((?<=/)readme)?\.md)?(#.*)?\)@i', '$1$6)', $markdown );
    282282
    283283        // Remove the (../)*docs/ path from relative links, and replace it with an absolute URL
    284         $markdown = preg_replace( '/(\[.*?\])\((\.\.\/)+docs\/(.*?)\/?(#.*)?\)/i', '$1(https://wordpress.org/gutenberg/handbook/$3/$4)', $markdown );
     284        $markdown = preg_replace( '@(\[.*?\])\((\.\./)+docs/(.*?)/?(#.*)?\)@i', '$1(https://wordpress.org/gutenberg/handbook/$3/$4)', $markdown );
    285285
    286286        // Handle /docs/(.+)(/README.md) path for internal links and replace it with an absolute URL
Note: See TracChangeset for help on using the changeset viewer.