about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFerry Huberts <ferry.huberts@pelagic.nl>2012-10-09 13:10:48 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2012-10-09 13:19:12 +0200
commitd14faf4424ae06ced696c15f205c85fe55b8e6e7 (patch)
tree882b444c1bde093b83f594f874366f90839f2c74
parentui-repolist: do not use agefile if it's date could not be parsed (diff)
downloadcgit-pink-d14faf4424ae06ced696c15f205c85fe55b8e6e7.tar.gz
cgit-pink-d14faf4424ae06ced696c15f205c85fe55b8e6e7.zip
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>
-rwxr-xr-xfilters/syntax-highlighting.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
index 0639b10..47f6267 100755
--- a/filters/syntax-highlighting.sh
+++ b/filters/syntax-highlighting.sh
@@ -39,8 +39,11 @@
 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
67bb8c901e60ae5acb2e6074abfea3ac165b40&follow=1'>Free part.parts.ptrJune McEnroe 2020-04-26Rename part->id to part->contentIDJune McEnroe 2020-04-26Iterate through nested multiparts to find content for AtomJune McEnroe 2020-04-26Include Cc address in reply mailtosJune McEnroe 2020-04-26Use %R for RFC numbers in STANDARDS sectionJune McEnroe 2020-04-26Add mailto spec to STANDARDSJune McEnroe 2020-04-26Increase space between nav itemsJune McEnroe 2020-04-26Add mailto address for the archiveJune McEnroe 2020-04-26Put dates on new lines in indexJune McEnroe 2020-04-26Include <> around Message-Id in mailto: URLsJune McEnroe 2020-04-26Add link to index on thread pagesJune McEnroe 2020-04-26Fall back to Content-Type name parameter for attachmentsJune McEnroe 2020-04-26Remove margins in article.message headerJune McEnroe 2020-04-26Generate index.atomJune McEnroe 2020-04-26Generate XHTML content in Atom entriesJune McEnroe 2020-04-25Style index pageJune McEnroe 2020-04-25Render index.htmlJune McEnroe 2020-04-25Wrap <summary> replies count in <data>June McEnroe 2020-04-25Accumulate thread envelopes before concatenationJune McEnroe 2020-04-24Free envelope in concatDataJune McEnroe 2020-04-24Use replyTo address in mailto:June McEnroe 2020-04-23Wrap quoted lines in <q>June McEnroe