OSDN Git Service

make `wp help` read intermediary format
authorscribu <mail@scribu.net>
Thu, 1 Aug 2013 14:42:40 +0000 (17:42 +0300)
committerscribu <mail@scribu.net>
Thu, 1 Aug 2013 15:07:29 +0000 (18:07 +0300)
php/commands/help.php
utils/convert-docs.php

index 7b6599d..9b86c08 100644 (file)
@@ -42,8 +42,8 @@ class Help_Command extends WP_CLI_Command {
                // section headers
                $out = preg_replace( '/^## ([A-Z ]+)/m', '%9\1%n', $out );
 
-               // old-style options
-               $out = preg_replace( '/\n\* `(.+)`([^\n]*):\n\n/', "\n\t\\1\\2\n\t\t", $out );
+               // definition lists
+               $out = preg_replace( '/\n([^\n]+)\n: (.+?)\n/s', "\n\t\\1\n\t\t\\2\n", $out );
 
                $out = str_replace( "\t", '  ', $out );
 
index a2dbf1c..59c5733 100644 (file)
@@ -16,7 +16,7 @@ function convert_file( $path ) {
        $out = preg_replace( '/^\t/m', "  ", $out );
 
        // prepend docblock notation
-       $out = preg_replace( '/^(.*)/m', "\t* \\1", $out );
+       $out = preg_replace( '/^(.*)/m', "\t* \\1", $out );
 
        file_put_contents( $path, $out );
 }