aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/File.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-04-03 21:52:06 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-04-03 21:52:06 +0200
commit7bf061541b0424b427bbbd1300e81d12190c9c54 (patch)
tree69e2c7360fc4ec941085b3ce9a91c05dd5c1375a /src/phorkie/File.php
parent2b4b34a76f42841e964a549fc64c02ba4f60a3f4 (diff)
downloadphorkie-7bf061541b0424b427bbbd1300e81d12190c9c54.tar.gz
phorkie-7bf061541b0424b427bbbd1300e81d12190c9c54.zip
rST rendering is possible now
Diffstat (limited to 'src/phorkie/File.php')
-rw-r--r--src/phorkie/File.php32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/phorkie/File.php b/src/phorkie/File.php
index bad21e6..87c3851 100644
--- a/src/phorkie/File.php
+++ b/src/phorkie/File.php
@@ -60,15 +60,14 @@ class File
public function getHighlightedContent()
{
- /**
- * Yes, geshi needs to be in your include path
- * We use the mediawiki geshi extension package.
- */
- require_once 'MediaWiki/geshi/geshi/geshi.php';
- $geshi = new \GeSHi($this->getContent(), $this->getGeshiType());
- $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
- $geshi->set_header_type(GESHI_HEADER_DIV);
- return $geshi->parse_code();
+ $ext = $this->getExt();
+ if (isset($GLOBALS['phorkie']['languages'][$ext]['renderer'])) {
+ $class = $GLOBALS['phorkie']['languages'][$ext]['renderer'];
+ } else {
+ $class = '\\phorkie\\Renderer_Geshi';
+ }
+ $rend = new $class();
+ return $rend->toHtml($this);
}
/**
@@ -88,21 +87,6 @@ class File
throw new Exception('Unknown type');
}
- /**
- * Returns the type of the file, as used by Geshi
- *
- * @return string
- */
- public function getGeshiType()
- {
- $ext = $this->getExt();
- if (isset($GLOBALS['phorkie']['languages'][$ext]['geshi'])) {
- $ext = $GLOBALS['phorkie']['languages'][$ext]['geshi'];
- }
-
- return $ext;
- }
-
public function getMimeType()
{
$ext = $this->getExt();