Browse Source

colorize: add extra methods to detect the lexer

Signed-off-by: Alejandro Mery <amery@geeks.cl>
master
Alejandro Mery 11 years ago
parent
commit
f0c0711ec2
1 changed files with 15 additions and 9 deletions
  1. +15
    -9
      files/bin/colorize

+ 15
- 9
files/bin/colorize

@ -24,17 +24,23 @@ fi
for f; do
l=
eval t=$(file -i - < "$f" | cut -d' ' -f2-)
case "$t" in
application/xml)
l=xml
eval mime=$(file -i - < "$f" | cut -d' ' -f2-)
case "$mime" in
application/xml) l=xml ;;
text/x-shellscript) l=sh ;;
text/plain)
case "$(file - < "$f" | cut -d' ' -f2-)" in
a\ */python\ script)
l=python
;;
text/x-shellscript)
l=sh
;;
text/plain)
l=text
*)
case "$f" in
*.sh) l=sh ;;
*.c|*.h|*.cc|*.hh) l=c ;;
*) l=text ;;
esac
;;
esac
esac
pygmentize ${l:+-l $l} "$f"

Loading…
Cancel
Save