summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/libraries/Pygments.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/application/libraries/Pygments.php b/application/libraries/Pygments.php
index ab3868087..be59beb90 100644
--- a/application/libraries/Pygments.php
+++ b/application/libraries/Pygments.php
@@ -145,6 +145,15 @@ class Pygments {
);
if (array_key_exists($this->mimetype, $typearray)) return $typearray[$this->mimetype];
+ // fall back to pygments own list if not found in our list
+ $typearray = array();
+ foreach (self::get_pygments_info() as $lexer) {
+ foreach ($lexer['mimetypes'] as $type) {
+ $typearray[$type] = $lexer['names'][0];
+ }
+ }
+ if (array_key_exists($this->mimetype, $typearray)) return $typearray[$this->mimetype];
+
if (strpos($this->mimetype, 'text/') === 0) return 'text';
# default