author | Lars Hjemli <hjemli@gmail.com> | 2009-08-09 12:56:23 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-08-09 12:56:23 (UTC) |
commit | e6cd7121edf55c13f04cd5d6fca8f07c4035ce0a (patch) (unidiff) | |
tree | 2ef0da9fd8bcf5ea79008605678224f613daf44c /filters/syntax-highlighting.sh | |
parent | db8b8cb9467625cb8d9ecb67863aa67590e59cc0 (diff) | |
download | cgit-e6cd7121edf55c13f04cd5d6fca8f07c4035ce0a.zip cgit-e6cd7121edf55c13f04cd5d6fca8f07c4035ce0a.tar.gz cgit-e6cd7121edf55c13f04cd5d6fca8f07c4035ce0a.tar.bz2 |
Add some example filter scripts
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'filters/syntax-highlighting.sh') (more/less context) (show whitespace changes)
-rwxr-xr-x | filters/syntax-highlighting.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh new file mode 100755 index 0000000..999ad0c --- a/dev/null +++ b/filters/syntax-highlighting.sh | |||
@@ -0,0 +1,39 @@ | |||
1 | #!/bin/sh | ||
2 | # This script can be used to implement syntax highlighting in the cgit | ||
3 | # tree-view by refering to this file with the source-filter or repo.source- | ||
4 | # filter options in cgitrc. | ||
5 | # | ||
6 | # Note: the highlight command (http://www.andre-simon.de/) uses css for syntax | ||
7 | # highlighting, so you'll probably want something like the following included | ||
8 | # in your css file (generated by highlight 2.4.8 and adapted for cgit): | ||
9 | # | ||
10 | # table.blob .num { color:#2928ff; } | ||
11 | # table.blob .esc { color:#ff00ff; } | ||
12 | # table.blob .str { color:#ff0000; } | ||
13 | # table.blob .dstr { color:#818100; } | ||
14 | # table.blob .slc { color:#838183; font-style:italic; } | ||
15 | # table.blob .com { color:#838183; font-style:italic; } | ||
16 | # table.blob .dir { color:#008200; } | ||
17 | # table.blob .sym { color:#000000; } | ||
18 | # table.blob .kwa { color:#000000; font-weight:bold; } | ||
19 | # table.blob .kwb { color:#830000; } | ||
20 | # table.blob .kwc { color:#000000; font-weight:bold; } | ||
21 | # table.blob .kwd { color:#010181; } | ||
22 | |||
23 | case "$1" in | ||
24 | *.c) | ||
25 | highlight -f -I -X -S c | ||
26 | ;; | ||
27 | *.h) | ||
28 | highlight -f -I -X -S c | ||
29 | ;; | ||
30 | *.sh) | ||
31 | highlight -f -I -X -S sh | ||
32 | ;; | ||
33 | *.css) | ||
34 | highlight -f -I -X -S css | ||
35 | ;; | ||
36 | *) | ||
37 | highlight -f -I -X -S txt | ||
38 | ;; | ||
39 | esac | ||