diff --git a/external/autopygmentize b/external/autopygmentize index 85d236681e..69db11809f 100755 --- a/external/autopygmentize +++ b/external/autopygmentize @@ -13,40 +13,46 @@ options=${@:1:$(($#-1))} # handle others args as options to pass to pygmentize file_common_opts="--brief --dereference" -case $(file --mime-type --uncompress $file_common_opts "$file") in +# Better command for XDG-compatible systems: xdg-mime query filetype "$file" +case $(file --mime-type --uncompress $file_common_opts) in application/xml|image/svg+xml) lexer=xml;; application/javascript) lexer=javascript;; application/json) lexer=json;; text/html) lexer=html;; text/troff) lexer=nroff;; text/x-asm) lexer=nasm;; - text/x-awk) lexer=awk;; - text/x-c) lexer=c;; - text/x-c++) lexer=cpp;; - text/x-clojure) lexer=clojure;; + */x-awk) lexer=awk;; + text/x-c|text/x-csrc|text/x-chdr) lexer=c;; + text/x-c++|text/x-c++src) lexer=cpp;; + */x-clojure) lexer=clojure;; text/x-crystal) lexer=crystal;; text/x-diff) lexer=diff;; - text/x-execline) lexer=execline;; + */x-execline) lexer=execline;; text/x-forth) lexer=forth;; text/x-fortran) lexer=fortran;; - text/x-gawk) lexer=gawk;; + */x-gawk) lexer=gawk;; text/x-java) lexer=java;; - text/x-lisp) lexer=common-lisp;; - text/x-lua|text/x-luatex) lexer=lua;; + */x-lisp) lexer=common-lisp;; + */x-emacs-lisp) lexer=emacs-lisp;; + */x-lua|*/x-luatex) lexer=lua;; text/x-makefile) lexer=make;; - text/x-msdos-batch) lexer=bat;; - text/x-nawk) lexer=nawk;; + */x-msdos-batch) lexer=bat;; + */x-nawk) lexer=nawk;; text/x-objective-c) lexer=objective-c;; - text/x-pascal) lexer=pascal;; - text/x-perl) lexer=perl;; - text/x-php) lexer=php;; - text/x-po) lexer=po;; - text/x-python) lexer=python;; - text/x-ruby) lexer=ruby;; - text/x-script.python) lexer=python;; - text/x-shellscript) lexer=sh;; - text/x-tcl) lexer=tcl;; + */x-pascal) lexer=pascal;; + */x-perl) lexer=perl;; + */x-php) lexer=php;; + */x-po) lexer=po;; + */x-python*) lexer=python;; + */x-ruby) lexer=ruby;; + */x-script.python) lexer=python;; + */x-shellscript) lexer=sh;; + # Workaround for TypeScript: mimetype doesn't recognize it. + text/vnd.trolltech.linguist) lexer=typescript;; + */x-tcl) lexer=tcl;; text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer + */x-ursa) lexer=ursa;; + */x-vala) lexer=vala;; text/xml) lexer=xml;; text/vnd.graphviz) lexer=graphviz;;