all repos — cgit @ c358aa3dfebf4fc1f3005dd960aa5c1c020eed76

a hyperfast web frontend for git written in c

filters/syntax-highlighting.sh (view raw)

 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
23case "$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		;;
39esac