stagit

A personal fork of Stagit; a static git page generator.
git clone git://git.swab.dev/stagit.git
Log | Files | Refs | README | LICENSE

commit 7a77428445c64e270c28c4affc7d27d557f7bf06
parent 295e4b8cb95114bb74b582c7332bc4c171f36dd3
Author: Jaron Swab <jaron@swab.dev>
Date:   Sun, 28 Mar 2021 02:53:57 +0000

Initial customization

Diffstat:
A.gitignore | 4++++
Acreate.sh | 41+++++++++++++++++++++++++++++++++++++++++
Dexample_create.sh | 43-------------------------------------------
Mstagit-index.c | 6+++---
Mstagit.c | 8++++++--
Mstyle.css | 50+++++++++++++++++++++++++++++++++++++++-----------
6 files changed, 93 insertions(+), 59 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,4 @@ +stagit +stagit-index +*.o +*.html diff --git a/create.sh b/create.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +cd /var/www/git || exit 1; +cp /home/git/stagit/style.css /var/www/git/style.css; +cp /home/git/stagit/logo.png /var/www/git/logo.png; +cp /home/git/stagit/favicon.png /var/www/git/favicon.png; + +# path must be absolute. +reposdir="/var/www/git" +curdir="$(pwd)" + +# make index. +echo "creating index in ${reposdir} ..." +"$HOME"/stagit/stagit-index "${reposdir}/"*/ > "${curdir}/index.html" + +for dir in "${reposdir}/"*/; do + # strip .git suffix. + r=$(basename "${dir}") + d=$(basename "${dir}" ".git") + printf "%s... " "${d}" + + mkdir -p "${curdir}/${d}" + cd "${curdir}/${d}" || continue + + if [ -d "${reposdir}/${r}.git" ]; then + continue + else + echo "running stagit on ${reposdir}/${r} ..." + "$HOME"/stagit/stagit -c ".cache" -u "https://git.swab.dev/$d/" "${reposdir}/${r}" + fi + + # symlinks + ln -sf log.html index.html + ln -sf ../style.css style.css + ln -sf ../logo.png logo.png + ln -sf ../favicon.png favicon.png + + echo "done" +done + +exit 0; diff --git a/example_create.sh b/example_create.sh @@ -1,43 +0,0 @@ -#!/bin/sh -# - Makes index for repositories in a single directory. -# - Makes static pages for each repository directory. -# -# NOTE, things to do manually (once) before running this script: -# - copy style.css, logo.png and favicon.png manually, a style.css example -# is included. -# -# - write clone url, for example "git://git.codemadness.org/dir" to the "url" -# file for each repo. -# - write owner of repo to the "owner" file. -# - write description in "description" file. -# -# Usage: -# - mkdir -p htmldir && cd htmldir -# - sh example_create.sh - -# path must be absolute. -reposdir="/var/www/domains/git.codemadness.nl/home/src" -curdir="$(pwd)" - -# make index. -stagit-index "${reposdir}/"*/ > "${curdir}/index.html" - -# make files per repo. -for dir in "${reposdir}/"*/; do - # strip .git suffix. - r=$(basename "${dir}") - d=$(basename "${dir}" ".git") - printf "%s... " "${d}" - - mkdir -p "${curdir}/${d}" - cd "${curdir}/${d}" || continue - stagit -c ".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}" - - # symlinks - ln -sf log.html index.html - ln -sf ../style.css style.css - ln -sf ../logo.png logo.png - ln -sf ../favicon.png favicon.png - - echo "done" -done diff --git a/stagit-index.c b/stagit-index.c @@ -78,7 +78,7 @@ writeheader(FILE *fp) fputs("</span></td></tr><tr><td></td><td>\n" "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n" "<table id=\"index\"><thead>\n" - "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>" + "<tr><td><b>Name</b></td><td><b>Description</b></td>" "<td><b>Last commit</b></td></tr>" "</thead><tbody>\n", fp); } @@ -124,8 +124,8 @@ writelog(FILE *fp) xmlencode(fp, stripped_name, strlen(stripped_name)); fputs("</a></td><td>", fp); xmlencode(fp, description, strlen(description)); - fputs("</td><td>", fp); - xmlencode(fp, owner, strlen(owner)); + //fputs("</td><td>", fp); + //xmlencode(fp, owner, strlen(owner)); fputs("</td><td>", fp); if (author) printtimeshort(fp, &(author->when)); diff --git a/stagit.c b/stagit.c @@ -493,6 +493,10 @@ writeheader(FILE *fp, const char *title) fputs("</h1><span class=\"desc\">", fp); xmlencode(fp, description, strlen(description)); fputs("</span></td></tr>", fp); + fputs("<tr><td></td><td>\n", fp); + fputs("<span class=\"repo\">git clone ", fp); + fprintf(fp, "<a href=\"git://git.swab.dev/%s\">git://git.swab.dev/%s</a>", name, name); + fputs("</span></td></tr>", fp); if (cloneurl[0]) { fputs("<tr class=\"url\"><td></td><td>git clone <a href=\"", fp); xmlencode(fp, cloneurl, strlen(cloneurl)); @@ -724,9 +728,9 @@ writelogline(FILE *fp, struct commitinfo *ci) xmlencode(fp, ci->author->name, strlen(ci->author->name)); fputs("</td><td class=\"num\" align=\"right\">", fp); fprintf(fp, "%zu", ci->filecount); - fputs("</td><td class=\"num\" align=\"right\">", fp); + fputs("</td><td class=\"num add\" align=\"right\">", fp); fprintf(fp, "+%zu", ci->addcount); - fputs("</td><td class=\"num\" align=\"right\">", fp); + fputs("</td><td class=\"num sub\" align=\"right\">", fp); fprintf(fp, "-%zu", ci->delcount); fputs("</td></tr>\n", fp); } diff --git a/style.css b/style.css @@ -1,6 +1,25 @@ +:root { + --nord00: #2E3440; + --nord01: #3B4252; + --nord02: #434C5E; + --nord03: #4C566A; + --nord-lightgray: #D8DEE9; + --nord-offwhite: #E5E9F0; + --nord-white: #ECEFF4; + --nord-teal: #8FBCBB; + --nord-skyblue: #88C0D0; + --nord-greyblue: #81A1C1; + --nord-blue: #5E81AC; + --nord-red: #BF616A; + --nord-orange: #D08770; + --nord-yellow: #EBCB8B; + --nord-green: #A3BE8C; + --nord-purple: #B48EAD; +} + body { - color: #000; - background-color: #fff; + color: var(--nord-white); + background-color: var(--nord00); font-family: monospace; } @@ -17,23 +36,24 @@ img { border: 0; } -a:target { - background-color: #ccc; +a { + color: var(--nord-skyblue); } a.d, a.h, a.i, a.line { + color: var(--nord-skyblue); text-decoration: none; } #blob a { - color: #555; + color: var(--nord-skyblue); } #blob a:hover { - color: blue; + color: var(--nord-skyblue); text-decoration: none; } @@ -55,7 +75,7 @@ table td { #index tr:hover td, #log tr:hover td, #files tr:hover td { - background-color: #eee; + background-color: var(--nord03); } #index tr td:nth-child(2), @@ -69,8 +89,16 @@ td.num { text-align: right; } +.add { + color: var(--nord-green); +} + +.sub { + color: var(--nord-red); +} + .desc { - color: #555; + color: var(--nord-offwhite); } hr { @@ -84,19 +112,19 @@ pre { } pre a.h { - color: #00a; + color: var(--nord-purple); } .A, span.i, pre a.i { - color: #070; + color: var(--nord-green); } .D, span.d, pre a.d { - color: #e00; + color: var(--nord-red); } pre a.h:hover,