diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-03-28 00:41:12 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-04-01 19:12:09 +0200 |
commit | 7c085c3f72c02e35ecb7c323aa8489e91f77ef1b (patch) | |
tree | ec1ceae9179c044bf98675013fa07d4f878cafc3 | |
parent | 71f0d462f2d695acb4126adfd50f92c8b3ab8bc2 (diff) |
Get supported mimetypes from pygments itself
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | application/libraries/Pygments.php | 9 |
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 |