summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2015-03-08 07:38:36 +0100
committerGeorg Brandl <georg@python.org>2015-03-08 07:38:36 +0100
commitf842f7e771607899cd6902dc542672cdfef8cc6d (patch)
treeca5b35bb7c20b918d0337c06a1074e34b00dc294
parent3d72251dc0eb976f02c40aa0723151d4b9ce8c61 (diff)
parenta0a2f29101698b7a8cbfebf483a1744928c2a6ee (diff)
downloadpygments-f842f7e771607899cd6902dc542672cdfef8cc6d.tar.gz
Merged in rrt/pygments-main (pull request #445)
autopygmentize: update for pygments 2.0
-rwxr-xr-xexternal/autopygmentize10
1 files changed, 6 insertions, 4 deletions
diff --git a/external/autopygmentize b/external/autopygmentize
index 964c138f..d2f969a1 100755
--- a/external/autopygmentize
+++ b/external/autopygmentize
@@ -1,6 +1,6 @@
#!/bin/bash
# Best effort auto-pygmentization with transparent decompression
-# (c) Reuben Thomas 2012-2013
+# by Reuben Thomas 2008-2015
# This program is in the public domain.
# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
@@ -18,6 +18,7 @@ if [[ "$lexer" == text ]]; then
unset lexer
case $(file --mime-type --uncompress $file_common_opts "$file") in
application/xml|image/svg+xml) lexer=xml;;
+ application/javascript) lexer=javascript;;
text/html) lexer=html;;
text/troff) lexer=nroff;;
text/x-asm) lexer=nasm;;
@@ -43,11 +44,13 @@ if [[ "$lexer" == text ]]; then
text/x-tcl) lexer=tcl;;
text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
- # Types that file outputs which pygmentize didn't support as of file 5.11, pygments 1.6rc1
+ # Types that file outputs which pygmentize didn't support as of file 5.20, pygments 2.0
# text/calendar
+ # text/inf
# text/PGP
# text/rtf
# text/texmacs
+ # text/vnd.graphviz
# text/x-bcpl
# text/x-info
# text/x-m4
@@ -74,8 +77,7 @@ if [[ -n "$lexer" ]]; then
application/x-bzip2) concat=bzcat;;
application/x-xz) concat=xzcat;;
esac
- # FIXME: Specify input encoding rather than output encoding https://bitbucket.org/birkenfeld/pygments-main/issue/800
- exec $concat "$file" | pygmentize -f terminal256 -O style=native,encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS $options -l $lexer
+ exec $concat "$file" | pygmentize -O inencoding=$encoding $PYGMENTIZE_OPTS $options -l $lexer
fi
exit 1