Making WordPress.org

Changeset 10031


Ignore:
Timestamp:
07/08/2020 03:18:41 AM (4 years ago)
Author:
dd32
Message:

Trac: PRs: Convert code blocks from GH to Trac syntax.

Fixes #5308.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/functions.php

    r10000 r10031  
    291291 * Formats a PR description for usage on Trac.
    292292 *
    293  * This strips out HTML comments and standard boilerplate text.
     293 * This:
     294 *  - Strips HTML comments
     295 *  - Strips standard boilerplate text
     296 *  - Converts code blocks
    294297 *
    295298 * @param object $pr_data PR Data.
    296  * @return string Stripped down PR Description
     299 * @return string Converted PR Description
    297300 */
    298301function format_pr_desc_for_trac_comment( $pr_data ) {
     
    302305    $desc = preg_replace( '#<!--.+?-->#s', '', $desc );
    303306
     307    // Convert Code blocks.
     308    $desc = preg_replace( '#```(.+?)```#s', '{{{$1}}}', $desc );
     309
    304310    // Remove the final line if it matches the specific boilerplate format.
    305311    $desc = preg_replace( "#---\r?\n\*\*.+\*\*$#", '', $desc );
Note: See TracChangeset for help on using the changeset viewer.