diff options
Diffstat (limited to 'roles/cgit/files/image')
-rw-r--r-- | roles/cgit/files/image/Dockerfile | 6 | ||||
-rw-r--r-- | roles/cgit/files/image/syntax-highlighting.py | 55 | ||||
-rw-r--r-- | roles/cgit/files/image/theme.css | 172 | ||||
-rw-r--r-- | roles/cgit/files/image/theme.html | 1 |
4 files changed, 1 insertions, 233 deletions
diff --git a/roles/cgit/files/image/Dockerfile b/roles/cgit/files/image/Dockerfile index 894e68a..3e94e58 100644 --- a/roles/cgit/files/image/Dockerfile +++ b/roles/cgit/files/image/Dockerfile @@ -1,12 +1,8 @@ FROM docker.io/fedora:41 -RUN dnf install cgit caddy fcgiwrap openssh-server python3-pygments -y +RUN dnf install cgit caddy fcgiwrap openssh-server python3-pygments python3-markdown -y COPY Caddyfile /etc/caddy/Caddyfile COPY start.sh start.sh RUN mkdir /usr/lib/cgit -p -COPY theme.css /usr/share/cgit/theme.css -COPY theme.html /usr/share/cgit/theme.html -COPY syntax-highlighting.py /usr/lib/cgit/syntax-highlighting.py -RUN chmod 777 /usr/lib/cgit/syntax-highlighting.py RUN adduser -m git CMD ["./start.sh"] diff --git a/roles/cgit/files/image/syntax-highlighting.py b/roles/cgit/files/image/syntax-highlighting.py deleted file mode 100644 index e912594..0000000 --- a/roles/cgit/files/image/syntax-highlighting.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 - -# This script uses Pygments and Python3. You must have both installed -# for this to work. -# -# http://pygments.org/ -# http://python.org/ -# -# It may be used with the source-filter or repo.source-filter settings -# in cgitrc. -# -# 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 ) - - -import sys -import io -from pygments import highlight -from pygments.util import ClassNotFound -from pygments.lexers import TextLexer -from pygments.lexers import guess_lexer -from pygments.lexers import guess_lexer_for_filename -from pygments.formatters import HtmlFormatter - - -sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace') -sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') -data = sys.stdin.read() -filename = sys.argv[1] -formatter = HtmlFormatter(style='pastie', nobackground=True) - -try: - lexer = guess_lexer_for_filename(filename, data) -except ClassNotFound: - # check if there is any shebang - if data[0:2] == '#!': - lexer = guess_lexer(data) - else: - lexer = TextLexer() -except TypeError: - lexer = TextLexer() - -# highlight! :-) -# printout pygments' css definitions as well -sys.stdout.write('<style>') -sys.stdout.write(formatter.get_style_defs('.highlight')) -sys.stdout.write('</style>') -sys.stdout.write(highlight(data, lexer, formatter, outfile=None)) diff --git a/roles/cgit/files/image/theme.css b/roles/cgit/files/image/theme.css deleted file mode 100644 index 54357b1..0000000 --- a/roles/cgit/files/image/theme.css +++ /dev/null @@ -1,172 +0,0 @@ -:root { - --bg_h: #1d2021; - --bg: #282828; - --bg_s: #32302f; - --bg1: #3c3836; - --bg2: #504945; - --bg3: #665c54; - --bg4: #7c6f64; - - --fg: #fbf1c7; - --fg1: #ebdbb2; - --fg2: #d5c4a1; - --fg3: #bdae93; - --fg4: #a89984; - - --red: #fb4934; - --green: #b8bb26; - --yellow: #fabd2f; - --blue: #83a598; - --purple: #d3869b; - --aqua: #8ec07c; - --gray: #928374; - --orange: #fe8019; - - --red-dim: #cc2412; - --green-dim: #98971a; - --yellow-dim: #d79921; - --blue-dim: #458588; - --purple-dim: #b16286; - --aqua-dim: #689d6a; - --gray-dim: #a89984; - --orange-dim: #d65d0e; -} - -body, #cgit, .path, div#cgit table.blob td.hashes, -div#cgit table.blob td.lines, div#cgit div.cgit-panel table, -div#cgit table.diffstat { - background: var(--bg) !important; - color: var(--fg) !important; - border: none -} - -a { - color: var(--fg) !important; - text-decoration: underline !important; -} - -select, input { - border: none; - background: var(--bg2); - color: var(--fg); -} - -/**************/ -/*** TABLES ***/ -/**************/ -div#cgit table.tabs td a.active { - background: var(--bg) !important; - color: var(--yellow) !important; -} - -div#cgit table.tabs, div#cgit div.content, -div#cgit table#header td.sub { - border: none; -} - -div#cgit table.list tr.nohover, -div#cgit table.list tr:nth-child(2n) { - background: var(--bg) !important; -} - -div#cgit table.list tr:nth-child(2n+1) { - background: var(--bg_s) !important; -} - -div#cgit table.list tr:hover:not(.nohover) { - background: var(--bg1) !important; -} - -/************/ -/*** CODE ***/ -/************/ -div#cgit table.blob td.linenumbers, -div#cgit table.blob { - border-color: var(--gray); -} - -div#cgit table.blob td.linenumbers a { - color: var(--gray) !important; - text-decoration: none !important; -} - -.markdown-body code, .markdown-body tt, -.markdown-body .highlight pre, .markdown-body pre { - background: var(--bg1) !important; -} - -/************/ -/*** AGES ***/ -/************/ -.age-hours { - color: var(--aqua) !important; -} - -.age-days { - color: var(--aqua-dim) !important; -} - -.age-weeks { - color: var(--fg) !important; -} - -.age-months { - color: var(--fg2) !important; -} - -.age-years { - color: var(--fg4) !important; -} - -/******************/ -/*** DECORATORS ***/ -/******************/ -div#cgit a.branch-deco { - background: var(--aqua); - border: none; - color: var(--bg) !important; -} - -div#cgit a.deco { - background: var(--yellow); - border: none; - color: var(--bg) !important; -} - -div#cgit a.tag-deco { - background: var(--gray); - border: none; - color: var(--bg) !important; -} - -/************/ -/*** DIFF ***/ -/************/ -div#cgit table.diff td div.hunk { - color: var(--blue); -} - -div#cgit table.diff td div.del { - color: var(--red); -} - -div#cgit table.diff td div.add { - color: var(--green); -} - -div#cgit table.diff td div.ctx { - color: var(--gray); -} - -div#cgit table.diff td div.head { - color: var(--fg); -} - -div#cgit table.diffstat td.graph td.add { - background: var(--green); -} - -div#cgit table.diffstat td.graph td.rem { - background: var(--red); -} - diff --git a/roles/cgit/files/image/theme.html b/roles/cgit/files/image/theme.html deleted file mode 100644 index f95b5d1..0000000 --- a/roles/cgit/files/image/theme.html +++ /dev/null @@ -1 +0,0 @@ -<link rel="stylesheet" type="text/css" href="/theme.css"> |