X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/2b6643574b2a0e527aea359a240018577d861275..2a665e0f4eeb45c9d57df7dc7f9d853465b5fea9:/src/phorkie/Renderer/Geshi.php diff --git a/src/phorkie/Renderer/Geshi.php b/src/phorkie/Renderer/Geshi.php index 2010ead..2b3854a 100644 --- a/src/phorkie/Renderer/Geshi.php +++ b/src/phorkie/Renderer/Geshi.php @@ -15,20 +15,26 @@ class Renderer_Geshi { /** * Yes, geshi needs to be in your include path - * We use the mediawiki geshi extension package. + * We use the geshi pear package. */ - require_once $GLOBALS['phorkie']['cfg']['geshi']; - $geshi = new \GeSHi($file->getContent(), $this->getType($file)); + if (!class_exists('\\geshi', true)) { + require_once $GLOBALS['phorkie']['cfg']['geshi']; + } + $geshi = new \geshi($file->getContent(), $this->getType($file)); $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS); - $geshi->set_header_type(GESHI_HEADER_DIV); + $geshi->set_header_type(GESHI_HEADER_PRE_TABLE); + $geshi->enable_classes(); + $geshi->set_line_style('color: #DDD;'); if ($res !== null) { $geshi->highlight_lines_extra(array_keys($res->annotations)); $geshi->set_highlight_lines_extra_style('background-color: #F2DEDE'); } - return '
' - . $geshi->parse_code() + return '' + . '
' + . str_replace(' ', ' ', $geshi->parse_code()) . '
'; }