diff --git a/src/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php b/src/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php index 196fcba..c7ad68d 100644 --- a/src/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php +++ b/src/markup/syntax/highlighter/PhutilConsoleSyntaxHighlighter.php @@ -1,52 +1,51 @@ config[$key] = $value; return $this; } public function getHighlightFuture($source) { $in_command = false; $lines = explode("\n", $source); foreach ($lines as $key => $line) { $matches = null; // Parse commands like this: // // some/path/ $ ./bin/example # Do things // // ...into path, command, and comment components. $pattern = '@'. ($in_command ? '()(.*?)' : '^(\S+[\\\\/] )?([$] .*?)'). '(#.*|\\\\)?$@'; if (preg_match($pattern, $line, $matches)) { $lines[$key] = hsprintf( '%s%s%s', $matches[1], $matches[2], (!empty($matches[3]) ? hsprintf('%s', $matches[3]) : '')); $in_command = (idx($matches, 3) == '\\'); } else { $lines[$key] = hsprintf('%s', $line); } } $lines = phutil_implode_html("\n", $lines); return new ImmediateFuture($lines); } }