OSDN Git Service

convert-docs.php: indentation fixes
authorscribu <mail@scribu.net>
Sun, 4 Aug 2013 13:45:28 +0000 (16:45 +0300)
committerscribu <mail@scribu.net>
Sun, 4 Aug 2013 17:58:19 +0000 (20:58 +0300)
php/commands/help.php
utils/convert-docs.php

index 25048e6..0e074f0 100644 (file)
@@ -48,9 +48,6 @@ class Help_Command extends WP_CLI_Command {
                // definition lists
                $out = preg_replace( '/\n([^\n]+)\n: (.+?)\n/s', "\n\t\\1\n\t\t\\2\n", $out );
 
-               // convert tabs to spaces
-               $out = preg_replace( '/^\t/m', "  ", $out );
-
                $out = str_replace( "\t", '  ', $out );
 
                echo WP_CLI::colorize( $out );
index e898b0e..b3b9668 100644 (file)
@@ -12,8 +12,12 @@ function convert_file( $path ) {
                return "\n$arg\n: ";
        }, $out );
 
+       // fix indentation
+       $out = preg_replace( '/^  ([^ ]+)/m', "\t\\1", $out );
+       $out = str_replace( "\t", '    ', $out );
+
        // prepend docblock notation
-       # $out = preg_replace( '/^(.*)/m', "\t* \\1", $out );
+       $out = preg_replace( '/^/m', "\t * ", $out );
 
        file_put_contents( $path, $out );
 }