[prev in list] [next in list] [prev in thread] [next in thread]
List: cgit
Subject: [PATCH 1/1] highlight: fix syntax highlighting for program versions > 2
From: mailings () hupie ! com (Ferry Huberts)
Date: 2012-02-19 17:33:01
Message-ID: 1329672781-26158-1-git-send-email-mailings () hupie ! com
[Download RAW message or body]
From: Ferry Huberts <ferry.huberts at pelagic.nl>
Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
---
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic