summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2019-05-15 13:19:58 +0200
committerFlorian Pritz <bluewind@xinu.at>2019-05-15 13:23:40 +0200
commit00f3501605ab2dd1362b6046648d218b20671b98 (patch)
treef6d4c706f2effaaab99b7a26ea25918e17a47488
parent58f20099a62c1af5d3057ce4fc8e0ef5ed3e7872 (diff)
Pygments: Skip lexers that do not have names
With pygments 2.4.0 at least VBScript doesn't have a name and thus causes an exception when the first name should be used. We use the name to tell pygmentize which lexer to use so listing a lexer that doesn't have a name doesn't work and thus there is no point in showing it in the list. Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--NEWS1
-rw-r--r--application/libraries/Pygments.php3
2 files changed, 4 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 91fa40738..d982140fe 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
This file lists major, incompatible or otherwise important changes, you should look at it after every update.
NEXT
+ - Fix compatability with Pygments 2.4.0
3.3.1 2019-01-28
- Fix CSRF issue breaking multipaste creation page
diff --git a/application/libraries/Pygments.php b/application/libraries/Pygments.php
index c8e1f8028..074e8a6c1 100644
--- a/application/libraries/Pygments.php
+++ b/application/libraries/Pygments.php
@@ -38,6 +38,9 @@ class Pygments {
$last_desc = "";
foreach (self::get_pygments_info() as $lexer) {
+ if (empty($lexer['names'])) {
+ continue;
+ }
$desc = $lexer['fullname'];
$name = $lexer['names'][0];
if ($desc == $last_desc) {