diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-03-06 18:59:57 -0500 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-03-06 18:59:57 -0500 |
commit | 361d396d01f6cdeb49970c0eeb705da442879f05 (patch) | |
tree | b0ebbccecf38e857418e4e52641ceaf757f61206 /syntax-highlighting-client.sh | |
download | cgit-syntax-highlighting-361d396d01f6cdeb49970c0eeb705da442879f05.tar.xz cgit-syntax-highlighting-361d396d01f6cdeb49970c0eeb705da442879f05.zip |
Initial commit
Diffstat (limited to 'syntax-highlighting-client.sh')
-rwxr-xr-x | syntax-highlighting-client.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/syntax-highlighting-client.sh b/syntax-highlighting-client.sh new file mode 100755 index 0000000..76aced1 --- /dev/null +++ b/syntax-highlighting-client.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script can be used to implement syntax highlighting in the cgit +# tree-view by referring to this file with the source-filter or repo.source- +# filter options in cgitrc. +# +# This script requires that syntax-highlighting-server.py be started to handle +# highlighting requests. + +# configure this to your syntax-highlighting port +base_url="http://localhost:4872/" + +path=$(curl -Gso /dev/null \ + -w "%{url_effective}" \ + --data-urlencode "filename=$1" \ + /highlight) + +exec curl -sSf \ + -H 'Content-Type: text/plain' \ + -H 'Expect:' \ + --data-binary @- \ + "${base_url%/}$path" |