diff options
-rw-r--r-- | application/controllers/file/file_default.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/application/controllers/file/file_default.php b/application/controllers/file/file_default.php index 086d3ebfe..28d83282e 100644 --- a/application/controllers/file/file_default.php +++ b/application/controllers/file/file_default.php @@ -250,17 +250,20 @@ class File_default extends MY_Controller { $output .= '<div class="code content table">'."\n"; $output .= '<div class="highlight"><code class="code-container">'."\n"; + $content = file_get_contents($file); + if ($lexer == "ascii") { // TODO: use exec safe and catch exception $ret = (new \libraries\ProcRunner(array('ansi2html', '-p'))) - ->input(file_get_contents($file)) + ->input($content) ->forbid_stderr() ->exec(); // Last line is empty $lines_to_remove = 1; } else { // TODO: use exec safe and catch exception - $ret = (new \libraries\ProcRunner(array('pygmentize', '-F', 'codetagify', '-O', 'encoding=guess,outencoding=utf8,stripnl=False', '-l', $lexer, '-f', 'html', $file))) + $ret = (new \libraries\ProcRunner(array('pygmentize', '-F', 'codetagify', '-O', 'encoding=guess,outencoding=utf8,stripnl=False', '-l', $lexer, '-f', 'html'))) + ->input($content) ->exec(); // Last 2 items are "</pre></div>" and "" $lines_to_remove = 2; |