blob: 9db14f92d96be685d8f6a31c29ce0c20e80805c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/dash
# This script requires a shell supporting the ${var##pattern} syntax.
# It is supported by at least dash and bash, however not by busybox.
#
# 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 variables
BASENAME="$1"
EXTENSION="${BASENAME##*.}"
# Use .txt as a sensible default format
[ "${BASENAME}" = "${EXTENSION}" ] && EXTENSION=txt
[ -z "${EXTENSION}" ] && EXTENSION=txt
# Map Makefile and Makefile.* to .mk
[ "${BASENAME%%.*}" = "Makefile" ] && EXTENSION=mk
# This is for version 3 and above of the "highlight" package
exec highlight --force -f -I -O xhtml -S "$EXTENSION" 2>/dev/null
|