Permalink
Browse files

Minor, escape console output after parsing so quotes don't trigger th…

…e "#" comment rule.
  • Loading branch information...
1 parent 5711789 commit c5456f89cbc94effded116940b9a9958e23d69be @epriestley epriestley committed May 24, 2012
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/markup/syntax/highlighter/console/PhutilConsoleSyntaxHighlighter.php
View
10 src/markup/syntax/highlighter/console/PhutilConsoleSyntaxHighlighter.php
@@ -34,8 +34,6 @@ public function setConfig($key, $value) {
public function getHighlightFuture($source) {
- $source = phutil_escape_html($source);
-
$lines = explode("\n", $source);
foreach ($lines as $key => $line) {
$matches = null;
@@ -49,15 +47,15 @@ public function getHighlightFuture($source) {
if (preg_match('@^(\S+/ )?([$] .*?)(#.*)?$@', $line, $matches)) {
$line = '';
if ($matches[1]) {
- $line .= $matches[1];
+ $line .= phutil_escape_html($matches[1]);
}
- $line .= '<span class="gp">'.$matches[2].'</span>';
+ $line .= '<span class="gp">'.phutil_escape_html($matches[2]).'</span>';
if ($matches[3]) {
- $line .= '<span class="k">'.$matches[3].'</span>';
+ $line .= '<span class="k">'.phutil_escape_html($matches[3]).'</span>';
}
$lines[$key] = $line;
} else {
- $lines[$key] = '<span class="go">'.$line.'</span>';
+ $lines[$key] = '<span class="go">'.phutil_escape_html($line).'</span>';
}
}
$lines = implode("\n", $lines);

0 comments on commit c5456f8

Please sign in to comment.