diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-07-10 08:08:59 +0000 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-07-10 08:08:59 +0000 |
commit | 5abb40c5be90e5257cdfae51c165f00c5398f32c (patch) | |
tree | 40a115444d89d6f6c82b854c185790686d0bdb95 /usr | |
parent | 673c18cbf2c80de0aa5aa03b24cd026cf742412b (diff) |
starting to move studio website to ca, now moving configs
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/lib/cgit/filters/about-formatting-edited.sh | 29 | ||||
-rwxr-xr-x | usr/lib/cgit/filters/syntax-highlighting-edited.sh | 33 | ||||
-rw-r--r-- | usr/share/webapps/cgit/highlight.css | 24 | ||||
-rw-r--r-- | usr/share/webapps/cgit/mycgit.css | 6 |
4 files changed, 92 insertions, 0 deletions
diff --git a/usr/lib/cgit/filters/about-formatting-edited.sh b/usr/lib/cgit/filters/about-formatting-edited.sh new file mode 100755 index 00000000..e919e54d --- /dev/null +++ b/usr/lib/cgit/filters/about-formatting-edited.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# This may be used with the about-filter or repo.about-filter setting in cgitrc. +# It passes formatting of about pages to differing programs, depending on the usage. + +# Markdown support requires python and markdown-python. +# RestructuredText support requires python and docutils. +# Man page support requires groff. + +# 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 ) + +# note `pwd` when cgit run this script is /, can be tested by `cat '<p>$(pwd)</p>'` +# so need to get those scripts location via $0, $0 is /usr/lib/cgit/filters/about-formatting-edited.sh +dir="$(dirname "$0")/html-converters/" +case "$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')" in + *.markdown|*.mdown|*.md|*.mkd) exec cmark;; +# *.rst) exec "$dir/rst2html";; + *.[1-9]) exec "$dir/man2html";; + *.htm|*.html) exec cat;; + *.txt|*) exec "$dir/txt2html";; +esac diff --git a/usr/lib/cgit/filters/syntax-highlighting-edited.sh b/usr/lib/cgit/filters/syntax-highlighting-edited.sh new file mode 100755 index 00000000..111b1928 --- /dev/null +++ b/usr/lib/cgit/filters/syntax-highlighting-edited.sh @@ -0,0 +1,33 @@ +#!/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. +# +# Note: the highlight command (https://gitlab.com/saalen/highlight) uses css for syntax +# highlighting, I choose to output a file /usr/share/webapps/cgit/highlight.css +# by `highlight -O xhtml --print-style` and import it in mycgit.css for cgit to use. +# +# 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 ) + +syntax= +case "$1" in + nginx.conf) syntax=nginx;; + pacman.conf) syntax=ini;; + cgitrc) syntax=ini;; + .gitolite.rc) syntax=perl;; +esac + +# `--force` needed for highlight; one example is `< textfile highlight -O ansi --force`, without `--force` will error 1 and no output +if [ "$syntax" ]; then + exec highlight --force -f -I -O xhtml -S "$syntax" 2>/dev/null +else + exec highlight --force -f -I -O xhtml --syntax-by-name "$1" 2>/dev/null +fi diff --git a/usr/share/webapps/cgit/highlight.css b/usr/share/webapps/cgit/highlight.css new file mode 100644 index 00000000..c8a733d1 --- /dev/null +++ b/usr/share/webapps/cgit/highlight.css @@ -0,0 +1,24 @@ +/* Style definition file generated by highlight 4.15, http://andre-simon.de/ */ +/* highlight theme: Kwrite Editor */ +body.hl { background-color:#e0eaee; } +pre.hl { color:#000000; background-color:#e0eaee; font-size:10pt; font-family:'Courier New',monospace; white-space: pre-wrap; } +.hl.num { color:#b07e00; } +.hl.esc { color:#ff00ff; } +.hl.sng { color:#bf0303; } +.hl.pps { color:#818100; } +.hl.slc { color:#838183; font-style:italic; } +.hl.com { color:#838183; font-style:italic; } +.hl.ppc { color:#008200; } +.hl.opt { color:#000000; } +.hl.ipl { color:#0057ae; } +.hl.lin { color:#555555; user-select: none;-webkit-user-select: none; } +.hl.hvr { cursor:help; } +.hl.erm { color:#ff0000; font-weight:bold; border:solid 1px red; margin-left: 3em; } +.hl.err { color:#ff0000; font-weight:bold; } +.hl.kwa { color:#000000; font-weight:bold; } +.hl.kwb { color:#0057ae; } +.hl.kwc { color:#000000; } +.hl.kwd { color:#010181; } +.hl.kwe { color:#0d5bc3; } +.hl.kwf { color:#750dc3; } + diff --git a/usr/share/webapps/cgit/mycgit.css b/usr/share/webapps/cgit/mycgit.css new file mode 100644 index 00000000..bc1ac964 --- /dev/null +++ b/usr/share/webapps/cgit/mycgit.css @@ -0,0 +1,6 @@ +@import "cgit.css"; +@import "highlight.css"; + +div#cgit pre { tab-size: 4; } + +div#cgit table.diff { tab-size: 4; } |