OSDN Git Service

convert tabs to spaces only when displaying in the CLI
authorscribu <mail@scribu.net>
Sun, 4 Aug 2013 13:17:25 +0000 (16:17 +0300)
committerscribu <mail@scribu.net>
Sun, 4 Aug 2013 13:17:25 +0000 (16:17 +0300)
php/commands/help.php
utils/convert-docs.php

index fb42b8a..e4686e1 100644 (file)
@@ -45,6 +45,9 @@ 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 59c5733..e898b0e 100644 (file)
@@ -12,9 +12,6 @@ function convert_file( $path ) {
                return "\n$arg\n: ";
        }, $out );
 
-       // convert tabs to spaces
-       $out = preg_replace( '/^\t/m', "  ", $out );
-
        // prepend docblock notation
        # $out = preg_replace( '/^(.*)/m', "\t* \\1", $out );