all repos — cgit @ d14faf4424ae06ced696c15f205c85fe55b8e6e7

a hyperfast web frontend for git written in c

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>
Ferry Huberts ferry.huberts@pelagic.nl
Tue, 09 Oct 2012 13:10:48 +0200
commit

d14faf4424ae06ced696c15f205c85fe55b8e6e7

parent

e52a5226b83dc5232adb7d9076cae3ad4b123df4

1 files changed, 4 insertions(+), 1 deletions(-)

jump to
M filters/syntax-highlighting.shfilters/syntax-highlighting.sh

@@ -39,8 +39,11 @@ # store filename and extension in local vars

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