From: Ferry Huberts <[email protected]>
Signed-off-by: Ferry Huberts <[email protected]>
---
filters/syntax-highlighting.sh | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
index 6283ce9..9ff3d34 100755
--- a/filters/syntax-highlighting.sh
+++ b/filters/syntax-highlighting.sh
@@ -42,4 +42,15 @@ EXTENSION="${BASENAME##*.}"
# map Makefile and Makefile.* to .mk
[ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk
-exec highlight --force -f -I -X -S $EXTENSION 2>/dev/null
+# get highlight version
+regex='^[[:space:]]*highlight[[:space:]]+version[[:space:]]+([[:digit:]]+).*'
+highlightVersion="$(highlight --version | grep -E "${regex}" | sed -r
"s/${regex}/\1/")"
+
+if [[ "${highlightVersion}" == "2" ]]; then
+ # for highlight 2.x
+ exec highlight --force -f -I -X -S $EXTENSION 2>/dev/null
+else
+ # for other versions
+ exec highlight --force -f -I -O xhtml -S $EXTENSION 2>/dev/null
+fi
+
--
1.7.7.6
_______________________________________________
cgit mailing list
[email protected]
http://hjemli.net/mailman/listinfo/cgit