aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/File.php4
-rw-r--r--src/phorkie/Renderer/Geshi.php11
2 files changed, 11 insertions, 4 deletions
diff --git a/src/phorkie/File.php b/src/phorkie/File.php
index 869aa80..de8bde0 100644
--- a/src/phorkie/File.php
+++ b/src/phorkie/File.php
@@ -58,7 +58,7 @@ class File
return file_get_contents($this->path);
}
- public function getHighlightedContent()
+ public function getHighlightedContent(Tool_Result $res = null)
{
$ext = $this->getExt();
if (isset($GLOBALS['phorkie']['languages'][$ext]['renderer'])) {
@@ -67,7 +67,7 @@ class File
$class = '\\phorkie\\Renderer_Geshi';
}
$rend = new $class();
- return $rend->toHtml($this);
+ return $rend->toHtml($this, $res);
}
/**
diff --git a/src/phorkie/Renderer/Geshi.php b/src/phorkie/Renderer/Geshi.php
index 1a79e16..d2d3430 100644
--- a/src/phorkie/Renderer/Geshi.php
+++ b/src/phorkie/Renderer/Geshi.php
@@ -6,11 +6,12 @@ class Renderer_Geshi
/**
* Converts the code to HTML
*
- * @param File $file File to render
+ * @param File $file File to render
+ * @param Tool_Result $res Tool result to integrate
*
* @return string HTML
*/
- public function toHtml(File $file)
+ public function toHtml(File $file, Tool_Result $res = null)
{
/**
* Yes, geshi needs to be in your include path
@@ -20,6 +21,12 @@ class Renderer_Geshi
$geshi = new \GeSHi($file->getContent(), $this->getType($file));
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_header_type(GESHI_HEADER_DIV);
+
+ if ($res !== null) {
+ $geshi->highlight_lines_extra(array_keys($res->annotations));
+ $geshi->set_highlight_lines_extra_style('background-color: #F2DEDE');
+ }
+
return $geshi->parse_code();
}