summaryrefslogtreecommitdiffhomepage
path: root/git/source-filter.sh
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-12-15 19:42:53 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-12-16 22:45:13 +0800
commit1cb80b2d9f3245bfc9e3f02f84b6af681054131a (patch)
tree47cbb38ce9e7b3e92b0262e35bf8dfcdbe929526 /git/source-filter.sh
parent465c4ba5b4f0b4f69fd3773fc4f9f9650b7fffa0 (diff)
add cgit
Diffstat (limited to 'git/source-filter.sh')
-rwxr-xr-xgit/source-filter.sh104
1 files changed, 104 insertions, 0 deletions
diff --git a/git/source-filter.sh b/git/source-filter.sh
new file mode 100755
index 0000000..4d3f8da
--- /dev/null
+++ b/git/source-filter.sh
@@ -0,0 +1,104 @@
1#!/bin/sh
2
3# Note: the highlight command (http://www.andre-simon.de/) uses css for syntax
4# highlighting, so you'll probably want something like the following included
5# in your css file:
6#
7# Style definition file generated by highlight 2.4.8, http://www.andre-simon.de/
8#
9# table.blob .num { color:#2928ff; }
10# table.blob .esc { color:#ff00ff; }
11# table.blob .str { color:#ff0000; }
12# table.blob .dstr { color:#818100; }
13# table.blob .slc { color:#838183; font-style:italic; }
14# table.blob .com { color:#838183; font-style:italic; }
15# table.blob .dir { color:#008200; }
16# table.blob .sym { color:#000000; }
17# table.blob .kwa { color:#000000; font-weight:bold; }
18# table.blob .kwb { color:#830000; }
19# table.blob .kwc { color:#000000; font-weight:bold; }
20# table.blob .kwd { color:#010181; }
21#
22#
23# Style definition file generated by highlight 2.6.14, http://www.andre-simon.de/
24#
25# body.hl { background-color:#ffffff; }
26# pre.hl { color:#000000; background-color:#ffffff; font-size:10pt; font-family:'Courier New';}
27# .hl.num { color:#2928ff; }
28# .hl.esc { color:#ff00ff; }
29# .hl.str { color:#ff0000; }
30# .hl.dstr { color:#818100; }
31# .hl.slc { color:#838183; font-style:italic; }
32# .hl.com { color:#838183; font-style:italic; }
33# .hl.dir { color:#008200; }
34# .hl.sym { color:#000000; }
35# .hl.line { color:#555555; }
36# .hl.mark { background-color:#ffffbb;}
37# .hl.kwa { color:#000000; font-weight:bold; }
38# .hl.kwb { color:#830000; }
39# .hl.kwc { color:#000000; font-weight:bold; }
40# .hl.kwd { color:#010181; }
41#
42#
43# Style definition file generated by highlight 3.8, http://www.andre-simon.de/
44#
45# body.hl { background-color:#e0eaee; }
46# pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New';}
47# .hl.num { color:#b07e00; }
48# .hl.esc { color:#ff00ff; }
49# .hl.str { color:#bf0303; }
50# .hl.pps { color:#818100; }
51# .hl.slc { color:#838183; font-style:italic; }
52# .hl.com { color:#838183; font-style:italic; }
53# .hl.ppc { color:#008200; }
54# .hl.opt { color:#000000; }
55# .hl.lin { color:#555555; }
56# .hl.kwa { color:#000000; font-weight:bold; }
57# .hl.kwb { color:#0057ae; }
58# .hl.kwc { color:#000000; font-weight:bold; }
59# .hl.kwd { color:#010181; }
60#
61#
62# Style definition file generated by highlight 3.13, http://www.andre-simon.de/
63#
64# body.hl { background-color:#e0eaee; }
65# pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New',monospace;}
66# .hl.num { color:#b07e00; }
67# .hl.esc { color:#ff00ff; }
68# .hl.str { color:#bf0303; }
69# .hl.pps { color:#818100; }
70# .hl.slc { color:#838183; font-style:italic; }
71# .hl.com { color:#838183; font-style:italic; }
72# .hl.ppc { color:#008200; }
73# .hl.opt { color:#000000; }
74# .hl.ipl { color:#0057ae; }
75# .hl.lin { color:#555555; }
76# .hl.kwa { color:#000000; font-weight:bold; }
77# .hl.kwb { color:#0057ae; }
78# .hl.kwc { color:#000000; font-weight:bold; }
79# .hl.kwd { color:#010181; }
80#
81#
82# The following environment variables can be used to retrieve the configuration
83# of the repository for which this script is called:
84# CGIT_REPO_URL ( = repo.url setting )
85# CGIT_REPO_NAME ( = repo.name setting )
86# CGIT_REPO_PATH ( = repo.path setting )
87# CGIT_REPO_OWNER ( = repo.owner setting )
88# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting )
89# CGIT_REPO_SECTION ( = section setting )
90# CGIT_REPO_CLONE_URL ( = repo.clone-url setting )
91
92
93# store filename and extension in local vars
94BASENAME="$1"
95EXTENSION="${BASENAME##*.}"
96
97[ "${BASENAME}" = "${EXTENSION}" ] && EXTENSION=txt
98[ -z "${EXTENSION}" ] && EXTENSION=txt
99
100# map Makefile and Makefile.* to .mk
101[ "${BASENAME%%.*}" = "Makefile" ] && EXTENSION=mk
102
103# This is for version 3
104exec highlight --force --inline-css -f -I -O xhtml -S "$EXTENSION" 2>/dev/null | tee /tmp/highlight