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 6c26381c909845511d8ab543fd1f9a02cbe4edf4
parent 7a77428445c64e270c28c4affc7d27d557f7bf06
Author: Jaron Swab <jaron@swab.dev>
Date:   Wed,  9 Jun 2021 20:36:14 +0000

updated create.sh

Diffstat:
Mcreate.sh | 25+++++++++++--------------
Mfavicon.png | 0
Mlogo.png | 0
Mstagit-index.c | 6+++---
Mstyle.css | 184+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------
5 files changed, 167 insertions(+), 48 deletions(-)

diff --git a/create.sh b/create.sh @@ -1,9 +1,9 @@ #!/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; +cp "$HOME"/stagit/style.css /var/www/git/style.css; +cp "$HOME"/stagit/logo.png /var/www/git/logo.png; +cp "$HOME"/stagit/favicon.png /var/www/git/favicon.png; # path must be absolute. reposdir="/var/www/git" @@ -17,25 +17,22 @@ 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 + #echo "basename d == ${d}" + #echo "basename r == ${r}" - 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 + cd "${curdir}/${d}.git" && touch git-daemon-export-ok; + cd "${curdir}/${d}" || mkdir -p "${curdir}/${d}" && cd "${curdir}/${d}" || exit 1; + + echo "running stagit on ${reposdir}/${r} ..." + "$HOME"/stagit/stagit -c ".cache" -u "https://git.swab.dev/$d/" "${reposdir}/${d}.git" # 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 +echo "\n"; exit 0; diff --git a/favicon.png b/favicon.png Binary files differ. diff --git a/logo.png b/logo.png Binary files differ. diff --git a/stagit-index.c b/stagit-index.c @@ -118,15 +118,15 @@ writelog(FILE *fp) if (!strcmp(p, ".git")) *p = '\0'; - fputs("<tr><td><a href=\"", fp); + fputs("<tr class=\"repo\"><td class=\"rname\"><a href=\"", fp); xmlencode(fp, stripped_name, strlen(stripped_name)); fputs("/log.html\">", fp); xmlencode(fp, stripped_name, strlen(stripped_name)); - fputs("</a></td><td>", fp); + fputs("</a></td><td class=\"rdesc\">", fp); xmlencode(fp, description, strlen(description)); //fputs("</td><td>", fp); //xmlencode(fp, owner, strlen(owner)); - fputs("</td><td>", fp); + fputs("</td><td class=\"rdate\">", fp); if (author) printtimeshort(fp, &(author->when)); fputs("</td></tr>", fp); diff --git a/style.css b/style.css @@ -18,13 +18,16 @@ } body { - color: var(--nord-white); - background-color: var(--nord00); font-family: monospace; + font-size: 1em; } -h1, h2, h3, h4, h5, h6 { - font-size: 1em; +h1 { + font-size: 1.2em; + margin: 0; +} + +h2, h3, h4, h5, h6 { margin: 0; } @@ -36,25 +39,18 @@ img { border: 0; } -a { - color: var(--nord-skyblue); +.repo { + padding: 5px; } -a.d, -a.h, -a.i, -a.line { - color: var(--nord-skyblue); - text-decoration: none; -} - -#blob a { - color: var(--nord-skyblue); +.rname { + font-weight: bold; + padding-bottom: 5px; } -#blob a:hover { - color: var(--nord-skyblue); - text-decoration: none; +.rdesc { + font-style: italic; + padding-bottom: 5px; } table thead td { @@ -70,14 +66,6 @@ table td { white-space: nowrap; } -#branches tr:hover td, -#tags tr:hover td, -#index tr:hover td, -#log tr:hover td, -#files tr:hover td { - background-color: var(--nord03); -} - #index tr td:nth-child(2), #tags tr td:nth-child(3), #branches tr td:nth-child(3), @@ -97,10 +85,6 @@ td.num { color: var(--nord-red); } -.desc { - color: var(--nord-offwhite); -} - hr { border: 0; border-top: 1px solid #555; @@ -132,3 +116,141 @@ pre a.i:hover, pre a.d:hover { text-decoration: none; } + +@media +only screen and (max-width: 760px), +(min-device-width: 768px) and (max-device-width: 1024px) { + /* force tables to not be "table like" anymore */ + #log table, thead, tbody, th, td, tr { + display: block; + } + + /* hide table headers (but not display: none; for accessibility) */ + #log thead tr { + position: absolute; + top: -9999px; + left: -9999px; + } + + #index thead tr { + position: absolute; + top: -9999px; + left: -9999px; + } + + #log tr { + padding-top: 10px; + padding-bottom: 10px; + border-bottom: 1px solid var(--nord02); + } + + #log td { + /* behave like a "row" */ + text-align: left; + border: none; + position: relative; + padding-left: 50%; + } + + #log td:before { + /* Now like a table header */ + position: absolute; + left: 6px; + padding-right: 10px; + white-space: nowrap; + } + + /* Label the data */ + #index td:nth-of-type(3):before { content: "Last Commit: "; } + + /* Label the data */ + #log td:nth-of-type(1):before { content: "Date:"; } + #log td:nth-of-type(2):before { content: "Commit Message:"; } + #log td:nth-of-type(3):before { content: "Author:"; } + #log td:nth-of-type(4):before { content: "Files Changed:"; } + #log td:nth-of-type(5):before { content: "Additions:"; } + #log td:nth-of-type(6):before { content: "Deletions:"; } +} + +/* Set color scheme based on user's browser */ +@media (prefers-color-scheme: dark) { + body { + color: var(--nord-white); + background-color: var(--nord00); + } + + .desc { + color: var(--nord-offwhite); + } + + #branches tr:hover td, + #tags tr:hover td, + #index tr:hover td, + #log tr:hover td, + #files tr:hover td { + background-color: var(--nord03); + } + + a { + color: var(--nord-skyblue); + text-decoration: none; + } + + a.d, + a.h, + a.i, + a.line { + color: var(--nord-skyblue); + text-decoration: none; + } + + #blob a { + color: var(--nord-skyblue); + } + + #blob a:hover { + color: var(--nord-skyblue); + text-decoration: none; + } +} + +@media (prefers-color-scheme: light) { + body { + color: var(--nord00); + background-color: var(--nord-white); + } + + .desc { + color: var(--nord03); + } + + #branches tr:hover td, + #tags tr:hover td, + #index tr:hover td, + #log tr:hover td, + #files tr:hover td { + background-color: var(--nord-lightgray); + } + + a { + color: var(--nord-blue); + text-decoration: none; + } + + a.d, + a.h, + a.i, + a.line { + color: var(--nord-blue); + text-decoration: none; + } + + #blob a { + color: var(--nord-blue); + } + + #blob a:hover { + color: var(--nord-blue); + text-decoration: none; + } +}