about summary refs log tree commit diff stats
path: root/filters
diff options
context:
space:
mode:
authorFerry Huberts2012-10-09 13:10:48 +0200
committerJason A. Donenfeld2012-10-09 13:19:12 +0200
commitd14faf4424ae06ced696c15f205c85fe55b8e6e7 (patch)
tree882b444c1bde093b83f594f874366f90839f2c74 /filters
parentui-repolist: do not use agefile if it's date could not be parsed (diff)
downloadcgit-d14faf4424ae06ced696c15f205c85fe55b8e6e7.tar.gz
cgit-d14faf4424ae06ced696c15f205c85fe55b8e6e7.zip
syntax-highlight: when the file has no extension, assume text
There are 2 situations:
1- empty extension: assuming text is better than highlight
   producing no output because of a missing argument.
2- no extension at all: assuming text is better than setting
   the extension to the filename, which is what now happens.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/syntax-highlighting.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh index 0639b10..47f6267 100755 --- a/filters/syntax-highlighting.sh +++ b/filters/syntax-highlighting.sh
@@ -39,8 +39,11 @@
39BASENAME="$1" 39BASENAME="$1"
40EXTENSION="${BASENAME##*.}" 40EXTENSION="${BASENAME##*.}"
41 41
42[ "${BASENAME}" = "${EXTENSION}" ] && EXTENSION=txt
43[ -z "${EXTENSION}" ] && EXTENSION=txt
44
42# map Makefile and Makefile.* to .mk 45# map Makefile and Makefile.* to .mk
43[ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk 46[ "${BASENAME%%.*}" = "Makefile" ] && EXTENSION=mk
44 47
45# highlight versions 2 and 3 have different commandline options. Specifically, 48# highlight versions 2 and 3 have different commandline options. Specifically,
46# the -X option that is used for version 2 is replaced by the -O xhtml option 49# the -X option that is used for version 2 is replaced by the -O xhtml option