Making WordPress.org

Changeset 11389


Ignore:
Timestamp:
12/20/2021 12:55:45 AM (3 years ago)
Author:
dd32
Message:

Developer: Block Handbook: Strip the Gutenberg packages Code is Poetry footer from the import to developer.wordpress.org.

See https://github.com/WordPress/gutenberg/blob/trunk/packages/README.md

Props rima1889 for reporting.
Fixes #5984.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/import-block-editor.php

    r11293 r11389  
    1515
    1616        add_filter( 'template_redirect',               array( $this, 'redirects' ), 1 );
    17         add_filter( 'handbook_label', array( $this, 'change_handbook_label' ), 10, 2 );
     17        add_filter( 'handbook_label',                  array( $this, 'change_handbook_label' ), 10, 2 );
    1818        add_filter( 'handbook_display_toc',            array( $this, 'disable_toc' ) );
    1919        add_filter( 'get_post_metadata',               array( $this, 'fix_markdown_source_meta' ), 10, 4 );
     
    292292        );
    293293
     294        // Strip the trailing Code is Poetry footer from packages.
     295        // See https://github.com/WordPress/gutenberg/blob/trunk/packages/README.md
     296        $markdown = preg_replace(
     297            // Strip, any number of <br>'s, any number of <p...>'s (with no text content),
     298            // an img with 'codeispoetry' in an attribute, followed by any number of </p>'s and <br>'s before EOF
     299            '@(<br\s*/?>)*(<p[^>]*>)*<img[^>]*codeispoetry[^>]*/?>(<(/p|br\s*/?)>)*$@i',
     300            '',
     301            $markdown
     302        );
     303
    294304        return $markdown;
    295305    }
Note: See TracChangeset for help on using the changeset viewer.