dot

packages and services management
Log | Files | Refs | README

commit 314e0af77a11b758f98e2b35bfe55dc15b1799e2
parent b5d7974b543a06135b68eb651604464b531650b7
Author: Josuah Demangeonā  ā µ <mail@josuah.net>
Date:   Thu, 23 Mar 2017 23:04:35 +0100

fixed www-index

Diffstat:
A.mblaze/profile | 1+
Mbin/www-git | 75++++++++++++++++++++++++++++++++-------------------------------------------
Rbuild/libressl -> build/libssl | 0
Aman/www-git.1 | 21+++++++++++++++++++++
4 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/.mblaze/profile b/.mblaze/profile @@ -0,0 +1 @@ +Sendmail: msmtp diff --git a/bin/www-git b/bin/www-git @@ -1,7 +1,7 @@ # Static Git index generator inspired from git.2f30.org/stagit -# 1: path to the parent root +# 1: path to the parent 1 # 2: title of the page head() @@ -16,9 +16,13 @@ head() </head> <body> +<a href="%s">&lt;</a> <b>%s</b> +- <span style="color: grey;">%s</span> +- <a href="%s">files</a> +- <a href="%s/commit">commits</a> <hr> -' "$2" "$1" "$1" "${PWD##*/}" +' "$2" "$1" "$1" "$1" "$repo" "$desc" "$1/git/$repo" "$1/git/$repo" } @@ -68,35 +72,30 @@ commit() } -# 1: target base directory - commits() { - mkdir -p "$1/commit" + mkdir -p "$pwd/$repo/commit" printf '<table>\n<thead>\n<tr>' printf '<th>%s</th>' 'Date' 'Commit message' 'Author' printf '</tr>\n</thead>\n<tbody>\n' + git log --format='<tr><td>%ad</td><td><a href="%H.html">%s</a></td><td>%an</td></tr>' --date='short' + for hash in $(git log --format='%H') do { - head '../..' "Commits - ${PWD##*/}" + head '../../..' "Commits - ${PWD##*/}" commit "$hash" foot - } > "$1/commit/$hash.html" - - git log --format="<tr>$( - printf '<td>%s</td>' \ - '%ad' '<a href="%H.html">%s</a>' '%an' - )</tr>" --date='short' "$hash" + } > "$pwd/$repo/commit/$hash.html" done printf '\n</tbody>\n</table>\n' } -# 1: path to the file to process. +#1 file to display file() { @@ -118,11 +117,9 @@ file() } -# 1: target base directory - files() { - mkdir -p "$1/file" + mkdir -p "$pwd/$repo/file" printf '<table>\n<thead>\n<tr>' printf '<th>%s</th>' 'Mode' 'Name' 'Size' @@ -130,15 +127,15 @@ files() git ls-files | while IFS='' read -r file do - [ -z "${file##*/*}" ] && mkdir -p "$1/file/${file%/*}" - - root="$(printf %s "$file" | sed 's|[^/]*||g; s|.|../|g').." + [ -z "${file##*/*}" ] && mkdir -p "$pwd/$repo/file/${file%/*}" { - head "../../$root" "$file - ${PWD##*/}" + head "../../$( + printf %s "$file" | sed 's|[^/]*||g; s|/|../|g' + ).." "$file - $repo" file "$file" foot - } > "$1/file/$file.html" + } > "$pwd/$repo/file/$file.html" printf '<tr>' printf '<td>%s</td>' \ @@ -154,51 +151,43 @@ files() } -# 1: target base directory - repo() { - pwd 1>&2 - mkdir -p "$1/commit" + mkdir -p "$pwd/$repo/commit" { - head ../../.. "Commits - ${1##*/}" - commits "$1" + head '../../..' "Commits - $repo" + commits foot - } > "$1/commit/index.html" + } > "$pwd/$repo/commit/index.html" { - head ../.. "Files - ${1##*/}" - files "$1" + head '../..' "Files - $repo" + files foot - } > "$1/index.html" + } > "$pwd/$repo/index.html" printf '<tr>' - printf '<td><a href="git/%s">%s</a></td>' "${PWD##*/}" "${PWD##*/}" - printf '<td>%s</td>' "$( - grep "${PWD##*/}" "${1%/git/*}/description" | - sed 's/^[^ ]* //' - )" + printf '<td><a href="git/%s">%s</a></td>' "$repo" "$repo" + printf '<td>%s</td>' "$desc" printf '</tr>\n' } -# @: paths to repositories - repos() { - mkdir -p git + mkdir -p git && cd git || exit 1 printf '<table>\n' - for repo in "$@" + while read -r repo desc do printf '%s\n' "$repo" 1>&2 - mkdir -p "${repo##*/}" + mkdir -p "$repo" - (pwd="$PWD" && cd "$repo" && repo "$pwd/git/${repo##*/}" || exit 1) - done + (pwd="$PWD"; cd "$2/$repo" && repo) + done < "../$1" printf '</table>\n' } diff --git a/build/libressl b/build/libssl diff --git a/man/www-git.1 b/man/www-git.1 @@ -0,0 +1,21 @@ +.Dd mar 23, 2017 +.Dt WWW-GIT +.Os +.. +.Sh NAME +.. +.Nm www-git +.Nd generate static website with the git command +.. +.Sh SYNOPSIS +.. +.Nm +.. +.Sh DESCRIPTION +.. +.Nm +will create a +.Pa git +subdirectory in current directory with one subdirectory per git repository. +Repositories are specified from the +.Pa description file .