Making WordPress.org

Changeset 5475


Ignore:
Timestamp:
05/04/2017 04:38:10 PM (7 years ago)
Author:
danielbachhuber
Message:

devhub/cli: Add a custom template for displaying commands

See #2465

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
1 added
1 edited

Legend:

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

    r5474 r5475  
    219219            $markdown = preg_replace( '/^#\swp\s(.+)/', '', $markdown );
    220220        }
     221        $markdown = trim( $markdown );
     222
     223        // Steal the first sentence as the excerpt
     224        $excerpt = '';
     225        if ( preg_match( '/^(.+)/', $markdown, $matches ) ) {
     226            $excerpt = $matches[1];
     227            $markdown = preg_replace( '/^(.+)/', '', $markdown );
     228        }
    221229
    222230        // Transform to HTML and save the post
     
    227235            'ID'           => $post_id,
    228236            'post_content' => wp_filter_post_kses( wp_slash( $html ) ),
     237            'post_excerpt' => sanitize_text_field( wp_slash( $excerpt ) ),
    229238        );
    230239        if ( ! is_null( $title ) ) {
Note: See TracChangeset for help on using the changeset viewer.