Making WordPress.org


Ignore:
Timestamp:
09/21/2021 12:22:16 AM (3 years ago)
Author:
dd32
Message:

Trac: GitHub: When importing code blocks from GitHub, import the code blocks properly. Take two.

See #5855.

File:
1 edited

Legend:

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

    r11244 r11245  
    330330    // Convert Code blocks.
    331331    $desc = preg_replace_callback(
    332         '#```(?P<format>[a-z]+$)?(?P<code>.+?)```#sm',
     332        '#^(?P<indent>[ >]*)```(?P<format>[a-z]+$)(?P<code>.+?)```$#sm',
    333333        function( $m ) {
    334334            return
    335                 "{{{\n" .
    336                 ( $m['format'] ? "#!" . trim( $m['format'] ) . "\n" : '' ) .
     335                $m['indent'] . "{{{\n" .
     336                $m['indent'] . "#!" . trim( $m['format'] ) . "\n" .
    337337                trim( $m['code'] ) . "\n" .
    338                 "}}}\n";
     338                $m['indent'] . "}}}\n";
    339339        },
    340340        $desc
    341341    );
    342342
     343    $desc = preg_replace( '#```(.+?)```#s', '{{{$1}}}', $desc );
     344
    343345    // Convert Images (Must happen prior to Links, as the only difference is a preceeding !)
    344346    $desc = preg_replace( '#!\[(.+?)\]\(https?://(.+?)\)#', '[[Image(https://i0.wp.com/$2)]]', $desc );
Note: See TracChangeset for help on using the changeset viewer.