* [PATCH 1/1] highlight: fix syntax highlighting for program versions > 2
@ 2012-02-19 17:33 mailings
0 siblings, 0 replies; only message in thread
From: mailings @ 2012-02-19 17:33 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-02-19 17:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-19 17:33 [PATCH 1/1] highlight: fix syntax highlighting for program versions > 2 mailings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).