diff options
author | EuAndreh <eu@euandre.org> | 2025-01-06 13:51:03 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-01-06 13:51:03 -0300 |
commit | f3bffc527d5f7a440da642f8c9e3a171b81153f2 (patch) | |
tree | bff5b0a918bc108dc504cd14f2aedbebdef28fbe | |
parent | Cleanup repo, reinit in sh (diff) | |
download | gistatic-f3bffc527d5f7a440da642f8c9e3a171b81153f2.tar.gz gistatic-f3bffc527d5f7a440da642f8c9e3a171b81153f2.tar.xz |
m
-rw-r--r-- | Makefile | 21 | ||||
-rwxr-xr-x | src/gistatic.in | 641 | ||||
-rw-r--r-- | src/static/logo.svg | 62 | ||||
-rw-r--r-- | src/static/style.css | 133 | ||||
-rw-r--r-- | src/templates/files.html | 311 | ||||
-rw-r--r-- | src/templates/log.html | 83 | ||||
-rw-r--r-- | src/templates/refs.html | 213 |
7 files changed, 344 insertions, 1120 deletions
@@ -10,7 +10,7 @@ CONTRIBLANGS = .SUFFIXES: -.SUFFIXES: .c .o .to .in +.SUFFIXES: .in .in: sed \ @@ -38,7 +38,24 @@ tests/resources/repositories/repo-1/.git \ tests/resources/repositories/repo-2/.git: ln -s .gitdir $@ -check: all gistatic-tests \ + +shellcheck: + shellcheck src/gistatic.in + +emit-index: src/gistatic + rm -rf tmp/index/ + ./src/gistatic -i -o tmp/index/ ~/dev/published/git-permalink/ ../capim/ ../libedn/ ../listatic/ ../lisp-cli/ + ln -rfs tmp/git-permalink tmp/index/git-permalink + +emit-repo: src/gistatic + rm -rf tmp/git-permalink/ + time ./src/gistatic -o tmp/git-permalink/ -u FIXME-url-1 ~/dev/published/git-permalink/ + +run: shellcheck emit-index emit-repo + + + +check: all \ tests/resources/repositories/repo-1/.git \ tests/resources/repositories/repo-2/.git sh tests/build-sample.sh diff --git a/src/gistatic.in b/src/gistatic.in index 21980a5..f3cb2d6 100755 --- a/src/gistatic.in +++ b/src/gistatic.in @@ -21,7 +21,7 @@ See "man gistatic" for more information.' MSG_MISSING_CLIARG_EN='Missing %s' MSG_INCOMPATIBLE_OPTIONS_EN='Incompatible options: ' -MSG_MISSING_ARGS_EN='[PATH | [PATHS]]' +MSG_MISSING_ARGS_EN='REPOSITORY' MSG_LANGNAME_EN='en' MSG_INDEX_DESCRIPTION_EN='Index of repositories' MSG_DEFAULT_TITLE_EN='Repositories' @@ -105,9 +105,13 @@ tac() { } escape() { - echo "$1" | - sed -e 's|&|\&|g;s|<|\<|g;s|>|\>|g;s|"|\"|g' \ - -e "s|'|\'|g" + printf '%s' "$1" | + sed \ + -e 's|&|\&|g' \ + -e 's|<|\<|g' \ + -e 's|>|\>|g' \ + -e 's|"|\"|g' \ + -e "s|'|\'|g" } realpath() { @@ -139,284 +143,284 @@ version() { # print_logo() { - cat <<EOF -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"> - <path d="M 0 8 L 1 8 L 1 9 L 0 9 L 0 8 Z" /> - <path d="M 0 13 L 1 13 L 1 14 L 0 14 L 0 13 Z" /> - <path d="M 1 8 L 2 8 L 2 9 L 1 9 L 1 8 Z" /> - <path d="M 1 13 L 2 13 L 2 14 L 1 14 L 1 13 Z" /> - <path d="M 2 8 L 3 8 L 3 9 L 2 9 L 2 8 Z" /> - <path d="M 2 13 L 3 13 L 3 14 L 2 14 L 2 13 Z" /> - <path d="M 3 8 L 4 8 L 4 9 L 3 9 L 3 8 Z" /> - <path d="M 3 13 L 4 13 L 4 14 L 3 14 L 3 13 Z" /> - <path d="M 4 7 L 5 7 L 5 8 L 4 8 L 4 7 Z" /> - <path d="M 4 8 L 5 8 L 5 9 L 4 9 L 4 8 Z" /> - <path d="M 4 13 L 5 13 L 5 14 L 4 14 L 4 13 Z" /> - <path d="M 5 6 L 6 6 L 6 7 L 5 7 L 5 6 Z" /> - <path d="M 5 7 L 6 7 L 6 8 L 5 8 L 5 7 Z" /> - <path d="M 5 13 L 6 13 L 6 14 L 5 14 L 5 13 Z" /> - <path d="M 6 5 L 7 5 L 7 6 L 6 6 L 6 5 Z" /> - <path d="M 6 6 L 7 6 L 7 7 L 6 7 L 6 6 Z" /> - <path d="M 6 14 L 7 14 L 7 15 L 6 15 L 6 14 Z" /> - <path d="M 7 1 L 8 1 L 8 2 L 7 2 L 7 1 Z" /> - <path d="M 7 14 L 8 14 L 8 15 L 7 15 L 7 14 Z" /> - <path d="M 7 15 L 8 15 L 8 16 L 7 16 L 7 15 Z" /> - <path d="M 7 2 L 8 2 L 8 3 L 7 3 L 7 2 Z" /> - <path d="M 7 3 L 8 3 L 8 4 L 7 4 L 7 3 Z" /> - <path d="M 7 4 L 8 4 L 8 5 L 7 5 L 7 4 Z" /> - <path d="M 7 5 L 8 5 L 8 6 L 7 6 L 7 5 Z" /> - <path d="M 8 1 L 9 1 L 9 2 L 8 2 L 8 1 Z" /> - <path d="M 8 15 L 9 15 L 9 16 L 8 16 L 8 15 Z" /> - <path d="M 9 1 L 10 1 L 10 2 L 9 2 L 9 1 Z" /> - <path d="M 9 2 L 10 2 L 10 3 L 9 3 L 9 2 Z" /> - <path d="M 9 6 L 10 6 L 10 7 L 9 7 L 9 6 Z" /> - <path d="M 9 15 L 10 15 L 10 16 L 9 16 L 9 15 Z" /> - <path d="M 10 2 L 11 2 L 11 3 L 10 3 L 10 2 Z" /> - <path d="M 10 3 L 11 3 L 11 4 L 10 4 L 10 3 Z" /> - <path d="M 10 4 L 11 4 L 11 5 L 10 5 L 10 4 Z" /> - <path d="M 10 5 L 11 5 L 11 6 L 10 6 L 10 5 Z" /> - <path d="M 10 6 L 11 6 L 11 7 L 10 7 L 10 6 Z" /> - <path d="M 11 6 L 12 6 L 12 7 L 11 7 L 11 6 Z" /> - <path d="M 11 8 L 12 8 L 12 9 L 11 9 L 11 8 Z" /> - <path d="M 10 15 L 11 15 L 11 16 L 10 16 L 10 15 Z" /> - <path d="M 11 10 L 12 10 L 12 11 L 11 11 L 11 10 Z" /> - <path d="M 11 12 L 12 12 L 12 13 L 11 13 L 11 12 Z" /> - <path d="M 11 14 L 12 14 L 12 15 L 11 15 L 11 14 Z" /> - <path d="M 11 15 L 12 15 L 12 16 L 11 16 L 11 15 Z" /> - <path d="M 12 6 L 13 6 L 13 7 L 12 7 L 12 6 Z" /> - <path d="M 12 8 L 13 8 L 13 9 L 12 9 L 12 8 Z" /> - <path d="M 12 10 L 13 10 L 13 11 L 12 11 L 12 10 Z" /> - <path d="M 12 12 L 13 12 L 13 13 L 12 13 L 12 12 Z" /> - <path d="M 12 14 L 13 14 L 13 15 L 12 15 L 12 14 Z" /> - <path d="M 13 6 L 14 6 L 14 7 L 13 7 L 13 6 Z" /> - <path d="M 13 8 L 14 8 L 14 9 L 13 9 L 13 8 Z" /> - <path d="M 13 10 L 14 10 L 14 11 L 13 11 L 13 10 Z" /> - <path d="M 13 12 L 14 12 L 14 13 L 13 13 L 13 12 Z" /> - <path d="M 13 13 L 14 13 L 14 14 L 13 14 L 13 13 Z" /> - <path d="M 13 14 L 14 14 L 14 15 L 13 15 L 13 14 Z" /> - <path d="M 14 7 L 15 7 L 15 8 L 14 8 L 14 7 Z" /> - <path d="M 14 8 L 15 8 L 15 9 L 14 9 L 14 8 Z" /> - <path d="M 14 9 L 15 9 L 15 10 L 14 10 L 14 9 Z" /> - <path d="M 14 10 L 15 10 L 15 11 L 14 11 L 14 10 Z" /> - <path d="M 14 11 L 15 11 L 15 12 L 14 12 L 14 11 Z" /> - <path d="M 14 12 L 15 12 L 15 13 L 14 13 L 14 12 Z" /> -</svg> -EOF + cat <<-'EOF' + <?xml version="1.0" encoding="UTF-8" standalone="no"?> + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"> + <path d="M 0 8 L 1 8 L 1 9 L 0 9 L 0 8 Z" /> + <path d="M 0 13 L 1 13 L 1 14 L 0 14 L 0 13 Z" /> + <path d="M 1 8 L 2 8 L 2 9 L 1 9 L 1 8 Z" /> + <path d="M 1 13 L 2 13 L 2 14 L 1 14 L 1 13 Z" /> + <path d="M 2 8 L 3 8 L 3 9 L 2 9 L 2 8 Z" /> + <path d="M 2 13 L 3 13 L 3 14 L 2 14 L 2 13 Z" /> + <path d="M 3 8 L 4 8 L 4 9 L 3 9 L 3 8 Z" /> + <path d="M 3 13 L 4 13 L 4 14 L 3 14 L 3 13 Z" /> + <path d="M 4 7 L 5 7 L 5 8 L 4 8 L 4 7 Z" /> + <path d="M 4 8 L 5 8 L 5 9 L 4 9 L 4 8 Z" /> + <path d="M 4 13 L 5 13 L 5 14 L 4 14 L 4 13 Z" /> + <path d="M 5 6 L 6 6 L 6 7 L 5 7 L 5 6 Z" /> + <path d="M 5 7 L 6 7 L 6 8 L 5 8 L 5 7 Z" /> + <path d="M 5 13 L 6 13 L 6 14 L 5 14 L 5 13 Z" /> + <path d="M 6 5 L 7 5 L 7 6 L 6 6 L 6 5 Z" /> + <path d="M 6 6 L 7 6 L 7 7 L 6 7 L 6 6 Z" /> + <path d="M 6 14 L 7 14 L 7 15 L 6 15 L 6 14 Z" /> + <path d="M 7 1 L 8 1 L 8 2 L 7 2 L 7 1 Z" /> + <path d="M 7 14 L 8 14 L 8 15 L 7 15 L 7 14 Z" /> + <path d="M 7 15 L 8 15 L 8 16 L 7 16 L 7 15 Z" /> + <path d="M 7 2 L 8 2 L 8 3 L 7 3 L 7 2 Z" /> + <path d="M 7 3 L 8 3 L 8 4 L 7 4 L 7 3 Z" /> + <path d="M 7 4 L 8 4 L 8 5 L 7 5 L 7 4 Z" /> + <path d="M 7 5 L 8 5 L 8 6 L 7 6 L 7 5 Z" /> + <path d="M 8 1 L 9 1 L 9 2 L 8 2 L 8 1 Z" /> + <path d="M 8 15 L 9 15 L 9 16 L 8 16 L 8 15 Z" /> + <path d="M 9 1 L 10 1 L 10 2 L 9 2 L 9 1 Z" /> + <path d="M 9 2 L 10 2 L 10 3 L 9 3 L 9 2 Z" /> + <path d="M 9 6 L 10 6 L 10 7 L 9 7 L 9 6 Z" /> + <path d="M 9 15 L 10 15 L 10 16 L 9 16 L 9 15 Z" /> + <path d="M 10 2 L 11 2 L 11 3 L 10 3 L 10 2 Z" /> + <path d="M 10 3 L 11 3 L 11 4 L 10 4 L 10 3 Z" /> + <path d="M 10 4 L 11 4 L 11 5 L 10 5 L 10 4 Z" /> + <path d="M 10 5 L 11 5 L 11 6 L 10 6 L 10 5 Z" /> + <path d="M 10 6 L 11 6 L 11 7 L 10 7 L 10 6 Z" /> + <path d="M 11 6 L 12 6 L 12 7 L 11 7 L 11 6 Z" /> + <path d="M 11 8 L 12 8 L 12 9 L 11 9 L 11 8 Z" /> + <path d="M 10 15 L 11 15 L 11 16 L 10 16 L 10 15 Z" /> + <path d="M 11 10 L 12 10 L 12 11 L 11 11 L 11 10 Z" /> + <path d="M 11 12 L 12 12 L 12 13 L 11 13 L 11 12 Z" /> + <path d="M 11 14 L 12 14 L 12 15 L 11 15 L 11 14 Z" /> + <path d="M 11 15 L 12 15 L 12 16 L 11 16 L 11 15 Z" /> + <path d="M 12 6 L 13 6 L 13 7 L 12 7 L 12 6 Z" /> + <path d="M 12 8 L 13 8 L 13 9 L 12 9 L 12 8 Z" /> + <path d="M 12 10 L 13 10 L 13 11 L 12 11 L 12 10 Z" /> + <path d="M 12 12 L 13 12 L 13 13 L 12 13 L 12 12 Z" /> + <path d="M 12 14 L 13 14 L 13 15 L 12 15 L 12 14 Z" /> + <path d="M 13 6 L 14 6 L 14 7 L 13 7 L 13 6 Z" /> + <path d="M 13 8 L 14 8 L 14 9 L 13 9 L 13 8 Z" /> + <path d="M 13 10 L 14 10 L 14 11 L 13 11 L 13 10 Z" /> + <path d="M 13 12 L 14 12 L 14 13 L 13 13 L 13 12 Z" /> + <path d="M 13 13 L 14 13 L 14 14 L 13 14 L 13 13 Z" /> + <path d="M 13 14 L 14 14 L 14 15 L 13 15 L 13 14 Z" /> + <path d="M 14 7 L 15 7 L 15 8 L 14 8 L 14 7 Z" /> + <path d="M 14 8 L 15 8 L 15 9 L 14 9 L 14 8 Z" /> + <path d="M 14 9 L 15 9 L 15 10 L 14 10 L 14 9 Z" /> + <path d="M 14 10 L 15 10 L 15 11 L 14 11 L 14 10 Z" /> + <path d="M 14 11 L 15 11 L 15 12 L 14 12 L 14 11 Z" /> + <path d="M 14 12 L 15 12 L 15 13 L 14 13 L 14 12 Z" /> + </svg> + EOF } print_style() { - cat <<EOF -:root { - --color: black; - --background-color: white; - --background-contrast-color: hsl(0, 0%, 98%); - --hover-color: hsl(0, 0%, 93%); - --nav-color: hsl(0, 0%, 87%); - --selected-color: hsl(0, 0%, 80%); - --diff-added-color: hsl(120, 100%, 23%); - --diff-removed-color: hsl(0, 100%, 47%); -} - -@media(prefers-color-scheme: dark) { - :root { - --color: white; - --background-color: black; - --background-contrast-color: hsl(0, 0%, 2%); - --hover-color: hsl(0, 0%, 7%); - --nav-color: hsl(0, 0%, 13%); - --selected-color: hsl(0, 0%, 20%); - } - - body { - color: var(--color); - background-color: var(--background-color); - } - - a { - color: hsl(211, 100%, 60%); - } - - a:visited { - color: hsl(242, 100%, 80%); - } -} - -body { - font-family: monospace; - max-width: 1100px; - margin: 0 auto 0 auto; -} - -.logo { - height: 6em; - width: 6em; -} - -.header-horizontal-grouping { - display: flex; - align-items: center; - margin-top: 1em; - margin-bottom: 1em; -} - -.header-description { - margin-left: 2em; -} - -nav { - margin-top: 2em; -} - -nav ul { - display: flex; - list-style-type: none; - margin-bottom: 0; -} - -nav li { - margin-left: 10px; -} - -nav a, nav a:visited { - padding: 2px 8px 0px 8px; - color: var(--color); -} - -.selected-nav-item { - background-color: var(--nav-color); -} - -hr { - margin-top: 0; - border: 0; - border-top: 3px solid var(--nav-color); -} - -table { - margin: 2em auto; -} - -th { - padding-bottom: 1em; -} - -tbody tr:hover { - background-color: var(--hover-color); -} - -td { - padding-left: 1em; - padding-right: 1em; -} - - -/* commit page */ - -.diff-added, .diff-removed { - text-decoration: none; -} - -.diff-added:target, .diff-removed:target { - background-color: var(--selected-color); -} - -.diff-added, .diff-added:visited { - color: var(--diff-added-color); -} - -.diff-removed, .diff-removed:visited { - color: var(--diff-removed-color); -} - - -/* log page */ - -.log-commit-box { - padding: 1em; - margin: 1em; - background-color: var(--background-contrast-color); -} - -.log-commit-tag { - padding: 2px; - border: 1px solid; - color: var(--color); -} - -.log-head-highlight { - background-color: #ff8888; /* FIXME: hsl + dark-mode */ -} - -.log-branch-highlight { - background-color: #88ff88; /* FIXME: hsl + dark-mode */ -} - -.log-tag-highlight { - background-color: #ffff88; /* FIXME: hsl + dark-mode */ -} - -.pre-wrapping { - overflow: auto; - margin: 1em; -} - -.log-notes { - /* FIXME: yellow box goes until the end of the screen */ - padding: 1em; - background-color: #ffd; /* FIXME: hsl + dark-mode */ -} - -.log-pagination { - text-align: center; - margin: 2em; -} - - -footer { - text-align: center; -} -EOF + cat <<-'EOF' + :root { + --color: black; + --background-color: white; + --background-contrast-color: hsl(0, 0%, 98%); + --hover-color: hsl(0, 0%, 93%); + --nav-color: hsl(0, 0%, 87%); + --selected-color: hsl(0, 0%, 80%); + --diff-added-color: hsl(120, 100%, 23%); + --diff-removed-color: hsl(0, 100%, 47%); + } + + @media(prefers-color-scheme: dark) { + :root { + --color: white; + --background-color: black; + --background-contrast-color: hsl(0, 0%, 2%); + --hover-color: hsl(0, 0%, 7%); + --nav-color: hsl(0, 0%, 13%); + --selected-color: hsl(0, 0%, 20%); + } + + body { + color: var(--color); + background-color: var(--background-color); + } + + a { + color: hsl(211, 100%, 60%); + } + + a:visited { + color: hsl(242, 100%, 80%); + } + } + + body { + font-family: monospace; + max-width: 1100px; + margin: 0 auto 0 auto; + } + + .logo { + height: 6em; + width: 6em; + } + + .header-horizontal-grouping { + display: flex; + align-items: center; + margin-top: 1em; + margin-bottom: 1em; + } + + .header-description { + margin-left: 2em; + } + + nav { + margin-top: 2em; + } + + nav ul { + display: flex; + list-style-type: none; + margin-bottom: 0; + } + + nav li { + margin-left: 10px; + } + + nav a, nav a:visited { + padding: 2px 8px 0px 8px; + color: var(--color); + } + + .selected-nav-item { + background-color: var(--nav-color); + } + + hr { + margin-top: 0; + border: 0; + border-top: 3px solid var(--nav-color); + } + + table { + margin: 2em auto; + } + + th { + padding-bottom: 1em; + } + + tbody tr:hover { + background-color: var(--hover-color); + } + + td { + padding-left: 1em; + padding-right: 1em; + } + + + /* commit page */ + + .diff-added, .diff-removed { + text-decoration: none; + } + + .diff-added:target, .diff-removed:target { + background-color: var(--selected-color); + } + + .diff-added, .diff-added:visited { + color: var(--diff-added-color); + } + + .diff-removed, .diff-removed:visited { + color: var(--diff-removed-color); + } + + + /* log page */ + + .log-commit-box { + padding: 1em; + margin: 1em; + background-color: var(--background-contrast-color); + } + + .log-commit-tag { + padding: 2px; + border: 1px solid; + color: var(--color); + } + + .log-head-highlight { + background-color: #ff8888; /* FIXME: hsl + dark-mode */ + } + + .log-branch-highlight { + background-color: #88ff88; /* FIXME: hsl + dark-mode */ + } + + .log-tag-highlight { + background-color: #ffff88; /* FIXME: hsl + dark-mode */ + } + + .pre-wrapping { + overflow: auto; + margin: 1em; + } + + .log-notes { + /* FIXME: yellow box goes until the end of the screen */ + padding: 1em; + background-color: #ffd; /* FIXME: hsl + dark-mode */ + } + + .log-pagination { + text-align: center; + margin: 2em; + } + + + footer { + text-align: center; + } + EOF } print_index_header() { - cat <<EOF -<!DOCTYPE html> -<html lang="$(escape "$MSG_LANGNAME")"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <meta name="description" content="$(escape "$MSG_INDEX_DESCRIPTION")" /> - <link rel="icon" type="image/svg+xml" href="logo.svg" /> - <link rel="stylesheet" type="text/css" href="style.css" /> - <title>$(escape "$TITLE")"</title> - </head> - <body> - <header> - <div class="header-horizontal-grouping"> - <img alt="$(escape "$MSG_LOGO_ALT_INDEX")" src="logo.svg" /> - <h1 class="header-description"> - $(escape "$TITLE") - </h1> - </div> - <hr /> - </header> - <main> - <table> - <thead> - <tr> - <th> - $(escape "$MSG_NAME") - </th> - <th> - $(escape "$MSG_DESCRIPTION") - </th> - <th> - $(escape "$MSG_LAST_COMMIT") - </th> - </tr> - </thead> - <tbody> + cat <<-EOF + <!DOCTYPE html> + <html lang="$(escape "$MSG_LANGNAME")"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1" /> + <meta name="description" content="$(escape "$MSG_INDEX_DESCRIPTION")" /> + <link rel="icon" type="image/svg+xml" href="logo.svg" /> + <link rel="stylesheet" type="text/css" href="style.css" /> + <title>$(escape "$TITLE")</title> + </head> + <body> + <header> + <div class="header-horizontal-grouping"> + <img alt="$(escape "$MSG_LOGO_ALT_INDEX")" src="logo.svg" /> + <h1 class="header-description"> + $(escape "$TITLE") + </h1> + </div> + <hr /> + </header> + <main> + <table> + <thead> + <tr> + <th> + $(escape "$MSG_NAME") + </th> + <th> + $(escape "$MSG_DESCRIPTION") + </th> + <th> + $(escape "$MSG_LAST_COMMIT") + </th> + </tr> + </thead> + <tbody> EOF } @@ -424,46 +428,47 @@ print_index_row() { repo="$(basename "$(realpath "${1%.git}")")" description="$(cat "$1/description" 2>/dev/null ||:)" last_commit_date="$(git -C "$1" log -1 --format=%cd --date='format:%Y-%m:%d %H:%M' 2>/dev/null ||:)" - cat <<EOF - <tr> - <td> - <a href="$(escape "$repo")"> - $(escape "$repo") - </a> - </td> - <td> - $(escape "$description") - </td> - <td> - $(escape "$last_commit_date") - </td> - </tr> -EOF + cat <<-EOF + <tr> + <td> + <a href="$(escape "$repo")"> + $(escape "$repo") + </a> + </td> + <td> + $(escape "$description") + </td> + <td> + $(escape "$last_commit_date") + </td> + </tr> + EOF } print_index_footer() { - cat <<EOF - </tbody> - </table> - </main> - <footer> - <hr /> - <p> - $MSG_ESCAPED_FOOTER_TEMPLATE - </p> - </footer> - </body> -</html> -EOF + cat <<-EOF + </tbody> + </table> + </main> + <footer> + <hr /> + <p> + $MSG_ESCAPED_FOOTER_TEMPLATE + </p> + </footer> + </body> + </html> + EOF } index_write() { - rm -f "$OUTDIR/index.html" - print_index_header >> "$OUTDIR/index.html" - for r in "$@"; do - print_index_row "$r" >> "$OUTDIR/index.html" - done - print_index_footer >> "$OUTDIR/index.html" + { + print_index_header + for r in "$@"; do + print_index_row "$r" + done + print_index_footer + } > "$OUTDIR/index.html" print_logo > "$OUTDIR/logo.svg" print_style > "$OUTDIR/style.css" @@ -486,12 +491,12 @@ cached_run() { fi if [ -e "$CACHE_DIR/$TARGET_PATH" ]; then - cp "$CACHE_DIR/$TARGET_PATH" "$OUTDIR/$TARGET_PATH" + $CMD "$CACHE_DIR/$TARGET_PATH" "$OUTDIR/$TARGET_PATH" else { genlog "$OUTDIR/$TARGET_PATH" "$@" - cp "$CACHE_DIR/$TARGET_PATH" "$OUTDIR/$TARGET_PATH" + $CMD "$CACHE_DIR/$TARGET_PATH" "$OUTDIR/$TARGET_PATH" } & parallel_n=$((parallel_n + 1)) if [ "$parallel_n" = "$MAX_JOBS" ]; then @@ -1179,6 +1184,9 @@ repo_write() { description="$(cat "$1/description" 2>/dev/null ||:)" CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/gistatic/$repo" + print_logo > "$OUTDIR/logo.svg" + print_style > "$OUTDIR/style.css" + repo_tarballs_write "$repo" print_repo_refs "$repo" "$description" > "$OUTDIR/refs.html" repo_commits_write "$repo" "$description" @@ -1186,8 +1194,6 @@ repo_write() { print_repo_index_page "$repo" "$description" > "$OUTDIR/index.html" repo_trees_write "$repo" "$description" - print_logo > "$OUTDIR/logo.svg" - print_style > "$OUTDIR/style.css" cd - > /dev/null } @@ -1222,7 +1228,8 @@ MAIN_BRANCH='main' MAIN_BRANCH_SET=false REPO= DESCRIPTION= -while getopts 'b:o:t:u:j:iqhV' flag; do +CMD='ln' +while getopts 'b:o:t:u:j:isqhV' flag; do case "$flag" in b) MAIN_BRANCH="$OPTARG" @@ -1246,6 +1253,9 @@ while getopts 'b:o:t:u:j:iqhV' flag; do q) VERBOSE=false ;; + s) + CMD='ln -s' + ;; h) usage help @@ -1270,7 +1280,6 @@ assert_arg() { exit 2 fi } - assert_arg "$OUTDIR" '-o DIRECTORY' if [ "$INDEX" = false ]; then diff --git a/src/static/logo.svg b/src/static/logo.svg deleted file mode 100644 index ce566b2..0000000 --- a/src/static/logo.svg +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"> - <path d="M 0 8 L 1 8 L 1 9 L 0 9 L 0 8 Z" /> - <path d="M 0 13 L 1 13 L 1 14 L 0 14 L 0 13 Z" /> - <path d="M 1 8 L 2 8 L 2 9 L 1 9 L 1 8 Z" /> - <path d="M 1 13 L 2 13 L 2 14 L 1 14 L 1 13 Z" /> - <path d="M 2 8 L 3 8 L 3 9 L 2 9 L 2 8 Z" /> - <path d="M 2 13 L 3 13 L 3 14 L 2 14 L 2 13 Z" /> - <path d="M 3 8 L 4 8 L 4 9 L 3 9 L 3 8 Z" /> - <path d="M 3 13 L 4 13 L 4 14 L 3 14 L 3 13 Z" /> - <path d="M 4 7 L 5 7 L 5 8 L 4 8 L 4 7 Z" /> - <path d="M 4 8 L 5 8 L 5 9 L 4 9 L 4 8 Z" /> - <path d="M 4 13 L 5 13 L 5 14 L 4 14 L 4 13 Z" /> - <path d="M 5 6 L 6 6 L 6 7 L 5 7 L 5 6 Z" /> - <path d="M 5 7 L 6 7 L 6 8 L 5 8 L 5 7 Z" /> - <path d="M 5 13 L 6 13 L 6 14 L 5 14 L 5 13 Z" /> - <path d="M 6 5 L 7 5 L 7 6 L 6 6 L 6 5 Z" /> - <path d="M 6 6 L 7 6 L 7 7 L 6 7 L 6 6 Z" /> - <path d="M 6 14 L 7 14 L 7 15 L 6 15 L 6 14 Z" /> - <path d="M 7 1 L 8 1 L 8 2 L 7 2 L 7 1 Z" /> - <path d="M 7 14 L 8 14 L 8 15 L 7 15 L 7 14 Z" /> - <path d="M 7 15 L 8 15 L 8 16 L 7 16 L 7 15 Z" /> - <path d="M 7 2 L 8 2 L 8 3 L 7 3 L 7 2 Z" /> - <path d="M 7 3 L 8 3 L 8 4 L 7 4 L 7 3 Z" /> - <path d="M 7 4 L 8 4 L 8 5 L 7 5 L 7 4 Z" /> - <path d="M 7 5 L 8 5 L 8 6 L 7 6 L 7 5 Z" /> - <path d="M 8 1 L 9 1 L 9 2 L 8 2 L 8 1 Z" /> - <path d="M 8 15 L 9 15 L 9 16 L 8 16 L 8 15 Z" /> - <path d="M 9 1 L 10 1 L 10 2 L 9 2 L 9 1 Z" /> - <path d="M 9 2 L 10 2 L 10 3 L 9 3 L 9 2 Z" /> - <path d="M 9 6 L 10 6 L 10 7 L 9 7 L 9 6 Z" /> - <path d="M 9 15 L 10 15 L 10 16 L 9 16 L 9 15 Z" /> - <path d="M 10 2 L 11 2 L 11 3 L 10 3 L 10 2 Z" /> - <path d="M 10 3 L 11 3 L 11 4 L 10 4 L 10 3 Z" /> - <path d="M 10 4 L 11 4 L 11 5 L 10 5 L 10 4 Z" /> - <path d="M 10 5 L 11 5 L 11 6 L 10 6 L 10 5 Z" /> - <path d="M 10 6 L 11 6 L 11 7 L 10 7 L 10 6 Z" /> - <path d="M 11 6 L 12 6 L 12 7 L 11 7 L 11 6 Z" /> - <path d="M 11 8 L 12 8 L 12 9 L 11 9 L 11 8 Z" /> - <path d="M 10 15 L 11 15 L 11 16 L 10 16 L 10 15 Z" /> - <path d="M 11 10 L 12 10 L 12 11 L 11 11 L 11 10 Z" /> - <path d="M 11 12 L 12 12 L 12 13 L 11 13 L 11 12 Z" /> - <path d="M 11 14 L 12 14 L 12 15 L 11 15 L 11 14 Z" /> - <path d="M 11 15 L 12 15 L 12 16 L 11 16 L 11 15 Z" /> - <path d="M 12 6 L 13 6 L 13 7 L 12 7 L 12 6 Z" /> - <path d="M 12 8 L 13 8 L 13 9 L 12 9 L 12 8 Z" /> - <path d="M 12 10 L 13 10 L 13 11 L 12 11 L 12 10 Z" /> - <path d="M 12 12 L 13 12 L 13 13 L 12 13 L 12 12 Z" /> - <path d="M 12 14 L 13 14 L 13 15 L 12 15 L 12 14 Z" /> - <path d="M 13 6 L 14 6 L 14 7 L 13 7 L 13 6 Z" /> - <path d="M 13 8 L 14 8 L 14 9 L 13 9 L 13 8 Z" /> - <path d="M 13 10 L 14 10 L 14 11 L 13 11 L 13 10 Z" /> - <path d="M 13 12 L 14 12 L 14 13 L 13 13 L 13 12 Z" /> - <path d="M 13 13 L 14 13 L 14 14 L 13 14 L 13 13 Z" /> - <path d="M 13 14 L 14 14 L 14 15 L 13 15 L 13 14 Z" /> - <path d="M 14 7 L 15 7 L 15 8 L 14 8 L 14 7 Z" /> - <path d="M 14 8 L 15 8 L 15 9 L 14 9 L 14 8 Z" /> - <path d="M 14 9 L 15 9 L 15 10 L 14 10 L 14 9 Z" /> - <path d="M 14 10 L 15 10 L 15 11 L 14 11 L 14 10 Z" /> - <path d="M 14 11 L 15 11 L 15 12 L 14 12 L 14 11 Z" /> - <path d="M 14 12 L 15 12 L 15 13 L 14 13 L 14 12 Z" /> -</svg> diff --git a/src/static/style.css b/src/static/style.css deleted file mode 100644 index d1fc04d..0000000 --- a/src/static/style.css +++ /dev/null @@ -1,133 +0,0 @@ -:root { - --row-light-gray: #eee; - --row-background-light-gray: #ccc; - --background-light-gray: #999; - font-family: sans-serif; -} - -a { - color: black; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -#horizontal-aligner-of-logo-and-header-items { - display: flex; -} - -#vertical-aligner-of-header-items { - display: flex; - flex-direction: row; -} - -div#vertical-aligner-of-header-items > h2 { - font-weigth: normal; - color: red; -} - -#repository-logo { - width: 5em; - margin: 2em; -} - -hr { - border: none; - height: 5px; - background-color: var(--background-light-gray); -} - -nav ul { - display: flex; - list-style-type: none; - border-bottom: 5px solid var(--background-light-gray); -} - -nav li { - margin-left: 10px; -} - -nav a { - padding-top: 2px; - padding-left: 8px; - padding-right: 8px; -} - -nav .selected-nav-item a { - background-color: var(--background-light-gray); -} - -main { - padding: 2em; -} - -table { - text-align: left; - border: none; - border-collapse: collapse; - width: 100%; -} - -table tr.table-no-highlight-row { - background-color: white; -} - -table tr.table-no-highlight-row:hover { - background-color: white; -} - -table tr:hover { - background-color: var(--row-background-light-gray); -} - -tr:nth-child(odd) { - background-color: white; -} - -tr:nth-child(even) { - background-color: var(--row-light-gray); -} - -footer { - text-align: center; -} - -/* Page log.html */ - -.log-commit-box { - padding: 1em; - background-color: var(--row-light-gray); -} - -.log-head-highlight { - padding: 2px; - background-color: #ff8888; - border: 1px solid; -} - -.log-branch-highlight { - padding: 2px; - background-color: #88ff88; - border: 1px solid; -} - -.log-tag-highlight { - padding: 2px; - background-color: #ffff88; - border: 1px solid; -} - - -/* Page tree.html */ - -table#files-table td:nth-child(1) { - width: 10%; - padding-right: 2em; -} - -.files-row-item-directory { - color: blue; - font-weight: bold; -} diff --git a/src/templates/files.html b/src/templates/files.html deleted file mode 100644 index fb556be..0000000 --- a/src/templates/files.html +++ /dev/null @@ -1,311 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - - <link rel="icon" type="image/svg+xml" href="../static/logo.svg" /> - <link rel="stylesheet" type="text/css" href="../static/styles.css" /> - <link rel="alternate" type="application/atom+xml" href="$PREFIX/commits.xml" title="$PROJECT_NAME - commit feed" hreflang="en" /> - <link rel="alternate" type="application/atom+xml" href="$PREFIX/tags.xml" title="$PROJECT_NAME - tags feed" hreflang="en" /> - - <title>$PROJECT_NAME - $PROJECT_DESCRIPTION</title> - - <meta property="og:site_name" content="Repository for $PROJECT_NAME" /> - <meta property="og:locale" content="en" /> - <meta property="og:title" content="$PROJECT_NAME" /> - <meta property="og:description" content="$PROJECT_DESCRIPTION" /> - <meta name="description" content="$PROJECT_DESCRIPTION" /> - </head> - <body> - <header> - <div id="horizontal-aligner-of-logo-and-header-items"> - <img id="repository-logo" src="../static/logo.svg" alt="Logo image of the repository" /> - <div id="vertical-aligner-of-project-name-and-description"> - <h1> - $PROJECT_NAME - </h1> - <h2> - $PROJECT_DESCRIPTION - </h2> - <code> - git clone $PROJECT_CLONE_URL - </code> - </div> - </div> - <nav> - <ul> - <li class="selected-nav-item"> - <a href="$PREFIX/files.html"> - files - </a> - </li> - <li> - <a href="$PREFIX/files.html"> - log - </a> - </li> - <li> - <a href="$PREFIX/files.html"> - refs - </a> - </li> - </ul> - </nav> - </header> - <main> - <table id="files-table"> - <tr class="table-no-highlight-row"> - <th> - Mode - </th> - <th> - Name - </th> - <th> - Size - </th> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - .gitignore - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - CHAGELOG.md - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - COPYING - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - Makefile - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - README.md - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - TODOs.md - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - d--------- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html" class="files-row-item-directory"> - <code> - aux/ - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - description - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - d--------- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html" class="files-row-item-directory"> - <code> - doc/ - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - -rw-r--r-- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html"> - <code> - long-description - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - d--------- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html" class="files-row-item-directory"> - <code> - src/ - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - <tr> - <td> - <code> - d--------- - </code> - </td> - <td> - <a href="$PREFIX/tree/main/$FILE.html" class="files-row-item-directory"> - <code> - tests/ - </code> - </a> - </td> - <td> - <code> - 123B - </code> - </td> - </tr> - </table> - <hr /> - <section> - <h1>README</h1> - <p>This does something.</p> - </section> - </main> - <footer> - <hr /> - <p> - Generated by gistatic $VERSION at $NOW - </p> - </footer> - </body> -</html> diff --git a/src/templates/log.html b/src/templates/log.html deleted file mode 100644 index 9f85189..0000000 --- a/src/templates/log.html +++ /dev/null @@ -1,83 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - - <link rel="icon" type="image/svg+xml" href="../static/logo.svg" /> - <link rel="stylesheet" type="text/css" href="../static/styles.css" /> - <link rel="alternate" type="application/atom+xml" href="$PREFIX/commits.xml" title="$PROJECT_NAME - commit feed" hreflang="en" /> - <link rel="alternate" type="application/atom+xml" href="$PREFIX/tags.xml" title="$PROJECT_NAME - tags feed" hreflang="en" /> - - <title>$PROJECT_NAME - $PROJECT_DESCRIPTION</title> - - <meta property="og:site_name" content="Repository for $PROJECT_NAME" /> - <meta property="og:locale" content="en" /> - <meta property="og:title" content="$PROJECT_NAME" /> - <meta property="og:description" content="$PROJECT_DESCRIPTION" /> - <meta name="description" content="$PROJECT_DESCRIPTION" /> - </head> - <body> - <header> - <div id="horizontal-aligner-of-logo-and-header-items"> - <img id="repository-logo" src="../static/logo.svg" alt="Logo image of the repository" /> - <div id="vertical-aligner-of-project-name-and-description"> - <h1> - $PROJECT_NAME - </h1> - <h2> - $PROJECT_DESCRIPTION - </h2> - <code> - git clone $PROJECT_CLONE_URL - </code> - </div> - </div> - <nav> - <ul> - <li> - <a href="$PREFIX/"> - files - </a> - </li> - <li class="selected-nav-item"> - <a href="$PREFIX/log"> - log - </a> - </li> - <li> - <a href="$PREFIX/refs/"> - refs - </a> - </li> - </ul> - </nav> - </header> - <main> - <div class="log-commit-box"> - <p> - <a href="$PREFIX/commits/$SHA.html">739a235c</a> - | - EuAndreh - <a href="$PREFIX/commits/SHA.html" class="log-head-highlight">HEAD</a> - <a href="$PREFIX/tree/main.html" class="log-branch-highlight">main</a> - <a href="$PREFIX/tags/v0.2.1.html" class="log-tag-highlight">v0.2.1</a> - </p> - <pre>Only display filename if it's set - -This prevents None from showing up in different places when pastes are -submitted through the API.</pre> - <pre>Notes: - See CI logs with: - git notes --ref=refs/notes/ci-logs show 92bfa3c5f06558cebcfa06bf78159e76254e07fd - git notes --ref=refs/notes/ci-data show 92bfa3c5f06558cebcfa06bf78159e76254e07fd</pre> - </div> - </main> - <footer> - <hr /> - <p> - Generated by gistatic $VERSION at $NOW - </p> - </footer> - </body> -</html> diff --git a/src/templates/refs.html b/src/templates/refs.html deleted file mode 100644 index 8af5803..0000000 --- a/src/templates/refs.html +++ /dev/null @@ -1,213 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - - <link rel="icon" type="image/svg+xml" href="../static/logo.svg" /> - <link rel="stylesheet" type="text/css" href="../static/styles.css" /> - <link rel="alternate" type="application/atom+xml" href="$PREFIX/commits.xml" title="$PROJECT_NAME - commit feed" hreflang="en" /> - <link rel="alternate" type="application/atom+xml" href="$PREFIX/tags.xml" title="$PROJECT_NAME - tags feed" hreflang="en" /> - - <title>$PROJECT_NAME - $PROJECT_DESCRIPTION</title> - - <meta property="og:site_name" content="Repository for $PROJECT_NAME" /> - <meta property="og:locale" content="en" /> - <meta property="og:title" content="$PROJECT_NAME" /> - <meta property="og:description" content="$PROJECT_DESCRIPTION" /> - <meta name="description" content="$PROJECT_DESCRIPTION" /> - </head> - <body> - <header> - <div id="horizontal-aligner-of-logo-and-header-items"> - <img id="repository-logo" src="../static/logo.svg" alt="Logo image of the repository" /> - <div id="vertical-aligner-of-project-name-and-description"> - <h1> - $PROJECT_NAME - </h1> - <h2> - $PROJECT_DESCRIPTION - </h2> - <code> - git clone $PROJECT_CLONE_URL - </code> - </div> - </div> - <nav> - <ul> - <li> - <a href="$PREFIX/"> - files - </a> - </li> - <li> - <a href="$PREFIX/log/"> - log - </a> - </li> - <li class="selected-nav-item"> - <a href="$PREFIX/refs/"> - refs - </a> - </li> - </ul> - </nav> - </header> - <main> - <table> - <tr class="table-no-highlight-row"> - <th> - Branch - </th> - <th> - Commit message - </th> - <th> - Author - </th> - <th> - Date - </th> - </tr> - <tr> - <td> - <a href="$PREFIX/log/main.html"> - <code> - main - </code> - </a> - </td> - <td> - <a href="$PREFIX/commits/$SHA.html"> - aux/workflow/public.sh: Mark as executable - </a> - </td> - <td> - EuAndreh - </td> - <td> - 2021-01-02 15:26 -3 - </td> - </tr> - <tr class="table-no-highlight-row"> - <td colspan="4"> </td> - </tr> - <tr class="table-no-highlight-row"> - <th> - Tag - </th> - <th> - Download - </th> - <th> - Author - </th> - <th> - Date - </th> - </tr> - <tr> - <td> - <a href="$PREFIX/tags/v0.2.1.html"> - v0.2.1 - </a> - </td> - <td> - <a href="$PREFIX/snapshots/remembering-0.2.1.tar.xz"> - remembering-0.2.1.tar.xz - </a> - (<a href="$PREFIX/snapshots/remembering-0.2.1.tar.xz.asc">sig</a>) - </td> - <td> - EuAndreh - </td> - <td> - 2021-01-05 15:26 -3 - </td> - </tr> - <tr> - <td> - <a href="$PREFIX/tags/v0.2.0.html"> - v0.2.0 - </a> - </td> - <td> - <a href="$PREFIX/snapshots/remembering-0.2.0.tar.xz"> - remembering-0.2.0.tar.xz - </a> - (<a href="$PREFIX/snapshots/remembering-0.2.0.tar.xz.asc">sig</a>) - </td> - <td> - EuAndreh - </td> - <td> - 2021-01-04 15:26 -3 - </td> - </tr> - <tr> - <td> - <a href="$PREFIX/tags/v0.1.2.html"> - v0.1.2 - </a> - </td> - <td> - <a href="$PREFIX/snapshots/remembering-0.1.2.tar.xz"> - remembering-0.2.1.tar.xz - </a> - (<a href="$PREFIX/snapshots/remembering-0.1.2.tar.xz.asc">sig</a>) - </td> - <td> - EuAndreh - </td> - <td> - 2021-01-03 15:26 -3 - </td> - </tr> - <tr> - <td> - <a href="$PREFIX/tags/v0.1.1.html"> - v0.1.1 - </a> - </td> - <td> - <a href="$PREFIX/snapshots/remembering-0.1.1.tar.xz"> - remembering-0.2.1.tar.xz - </a> - (<a href="$PREFIX/snapshots/remembering-0.1.1.tar.xz.asc">sig</a>) - </td> - <td> - EuAndreh - </td> - <td> - 2021-01-02 15:26 -3 - </td> - </tr> - <tr> - <td> - <a href="$PREFIX/tags/v0.1.0.html"> - v0.1.0 - </a> - </td> - <td> - <a href="$PREFIX/snapshots/remembering-0.1.0.tar.xz"> - remembering-0.2.1.tar.xz - </a> - (<a href="$PREFIX/snapshots/remembering-0.1.0.tar.xz.asc">sig</a>) - </td> - <td> - EuAndreh - </td> - <td> - 2021-01-01 15:26 -3 - </td> - </tr> - </table> - </main> - <footer> - <hr /> - <p> - Generated by gistatic $VERSION at $NOW - </p> - </footer> - </body> -</html> |