Making WordPress.org


Ignore:
Timestamp:
02/26/2016 02:26:25 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: Update the readme parser with a newer version of MarkdownExtra and support far more of our edgecases in readme's.
This also adds back Github readme.md formatting for most things (inline screenshots still not supported).
See #1584

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php

    r2621 r2638  
    88 */
    99class Tools {
    10 
    11     /**
    12      * @param string $readme
    13      * @return object
    14      */
    15     static function get_readme_data( $readme ) {
    16 
    17         // Uses https://github.com/rmccue/WordPress-Readme-Parser (with modifications)
    18         include_once __DIR__ . '/readme-parser/markdown.php';
    19         include_once __DIR__ . '/readme-parser/compat.php';
    20 
    21         $data = (object) \WPorg_Readme::parse_readme( $readme );
    22 
    23         unset( $data->sections['screenshots'] ); // Useless.
    24 
    25         // Sanitize contributors.
    26         foreach ( $data->contributors as $i => $name ) {
    27             if ( get_user_by( 'login', $name ) ) {
    28                 continue;
    29             } elseif ( false !== ( $user = get_user_by( 'slug', $name ) ) ) {
    30                 $data->contributors[] = $user->user_login;
    31                 unset( $data->contributors[ $i ] );
    32             } else {
    33                 unset( $data->contributors[ $i ] );
    34             }
    35         }
    36 
    37         return $data;
    38     }
    3910
    4011    /**
Note: See TracChangeset for help on using the changeset viewer.