X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/9043b46f85eb43c918a172663af34c084587bd1a..bdae1d8a8d39206ac75ab86f8e9ef53b2f29432e:/filters/syntax-highlighting.sh diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh index 6b1c576..24f6bb4 100755 --- a/filters/syntax-highlighting.sh +++ b/filters/syntax-highlighting.sh @@ -23,12 +23,37 @@ # table.blob .kwb { color:#830000; } # table.blob .kwc { color:#000000; font-weight:bold; } # table.blob .kwd { color:#010181; } +# +# The following environment variables can be used to retrieve the configuration +# of the repository for which this script is called: +# CGIT_REPO_URL ( = repo.url setting ) +# CGIT_REPO_NAME ( = repo.name setting ) +# CGIT_REPO_PATH ( = repo.path setting ) +# CGIT_REPO_OWNER ( = repo.owner setting ) +# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting ) +# CGIT_REPO_SECTION ( = section setting ) +# CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) +# # store filename and extension in local vars 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 +# for version 3. +# +# Version 2 can be found (for example) on EPEL 5, while version 3 can be +# found (for example) on EPEL 6. +# +# This is for version 2 +exec highlight --force -f -I -X -S "$EXTENSION" 2>/dev/null -exec highlight --force -f -I -X -S $EXTENSION 2>/dev/null +# This is for version 3 +#exec highlight --force -f -I -O xhtml -S "$EXTENSION" 2>/dev/null