[prev in list] [next in list] [prev in thread] [next in thread]
List: cgit
Subject: [PATCH v3 1/2] syntax-highlight: when the file has no extension, assume text
From: mailings () hupie ! com (Ferry Huberts)
Date: 2012-04-05 10:12:42
Message-ID: 1333620763-17079-1-git-send-email-mailings () hupie ! com
[Download RAW message or body]
From: Ferry Huberts <ferry.huberts at pelagic.nl>
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 at pelagic.nl>
---
filters/syntax-highlighting.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
index 5fcc9c9..8b09180 100755
--- a/filters/syntax-highlighting.sh
+++ b/filters/syntax-highlighting.sh
@@ -39,6 +39,9 @@
BASENAME="$1"
EXTENSION="${BASENAME##*.}"
+[ "${BASENAME}" == "${EXTENSION}" ] && EXTENSION=txt
+[ -z "${EXTENSION}" ] && EXTENSION=txt
+
# map Makefile and Makefile.* to .mk
[ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk
--
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