]> gitweb.ps.run Git - ps-cgit/blobdiff - filters/syntax-highlighting.sh
syntax-highlight: when the file has no extension, assume text
[ps-cgit] / filters / syntax-highlighting.sh
index 0639b100e7fb6e44cf272eddd5d1ce46bfbdfeba..47f626782a579f4c051230db104a4bbda49f1fbd 100755 (executable)
 BASENAME="$1"
 EXTENSION="${BASENAME##*.}"
 
+[ "${BASENAME}" = "${EXTENSION}" ] && EXTENSION=txt
+[ -z "${EXTENSION}" ] && EXTENSION=txt
+
 # map Makefile and Makefile.* to .mk
-[ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk
+[ "${BASENAME%%.*}" = "Makefile" ] && EXTENSION=mk
 
 # highlight versions 2 and 3 have different commandline options. Specifically,
 # the -X option that is used for version 2 is replaced by the -O xhtml option