diff -urP /var/empty/ws.sh/bin/mkws 1.0/ws.sh/bin/mkws --- /var/empty/ws.sh/bin/mkws Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/bin/mkws Wed Jun 24 11:20:30 2020 @@ -0,0 +1,35 @@ +#!/bin/sh +PATH=./bin:$PATH + +usage() { + >&2 printf "usage: %s url [path]\n" "$(basename "$0")" + exit 1 +} + +test $# -lt 1 && usage + +srcdir=${2:-.} +shareddir=${MKWSTHEMEDIR:-"$srcdir"/share} +LANG=${LANG:-en_US.UTF-8} + +if ! test -f $srcdir/index.upphtml +then + >&2 printf "no index.upphtml file found\n" + exit 1 +fi + +echo "Making theme.css" +pp "$shareddir"/theme.uppcss "$1" > theme.css + +for t in $srcdir/*.upphtml +do + echo "Making $(basename ${t%.upphtml}.html)" + pp "$shareddir"/l.upphtml "$t" "$1" > \ + "$(basename ${t%.upphtml}.html)" +done + +echo "Making sitemap.xml" +pp "$shareddir"/sitemap.uppxml "$1" > sitemap.xml + +echo "Making robots.txt" +pp "$shareddir"/robots.upptxt "$1" > robots.txt Binary files /var/empty/ws.sh/bin/pp and 1.0/ws.sh/bin/pp differ diff -urP /var/empty/ws.sh/share/l.upphtml 1.0/ws.sh/share/l.upphtml --- /var/empty/ws.sh/share/l.upphtml Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/share/l.upphtml Wed Jun 24 11:20:30 2020 @@ -0,0 +1,24 @@ + + + + + +My website + + + + + + + + + + + +#! +pp "$1" +#! + + + + diff -urP /var/empty/ws.sh/share/man/man1/mkws.1 1.0/ws.sh/share/man/man1/mkws.1 --- /var/empty/ws.sh/share/man/man1/mkws.1 Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/share/man/man1/mkws.1 Wed Jun 24 11:20:25 2020 @@ -0,0 +1,97 @@ +.Dd Dec 13, 2019 +.Dt mkws 1 +.Os +.Sh NAME +.Nm mkws +.Nd make web site +.Sh SYNOPSIS +.Nm +.Ar url +.Op path +.Sh DESCRIPTION +The +.Nm +utility uses +.Xr pp 1 +and the theme files in the +.Ev MKWSTHEMEPATH +directory +to preprocess all files in +.Op path +in order to produce a static web site in the current directory. If no +.Op path +is specified, the current directory is used instead. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Ar url +The url of the web site. It is used for generating the +.Pa robots.txt +and +.Pa sitemap.xml +files. +.It Op path +The path where the unpreprocessed files are located. If no +.Op path +is specified, the current directory is used instead. +.El +.Sh ENVIRONMENT +.Bl -tag -width MKWSTHEMEDIR +.It Ev MKWSTHEMEDIR +The directory containing the theme files. See the +.Em FILES +section for the minimum required files for a theme. If no +.Ev MKWSTHEMEDIR +variable is set +.Pa [path]/share +wil be used. +.It Ev LANG +The language for the website. It will be parsed to fill in the +.Em lang +attribute of the +.Em html +element and then +.Em charset +.Em meta +element. +.El +.Sh FILES +.Bl -tag -width "/tmp/vi.recover +.It Pa $MKWSTHEMEDIR/l.upphtml +The layout file of the website. It contains the +.Em DOCTYPE , +.Em html , +.Em head , +.Em title , +.Em meta +, +.Em link +, +.Em body +elements. +.It Pa $MKWSTHEMEDIR/robots.upptxt +The +.Pa robots.txt +template. +.It Pa $MKWSTHEMEDIR/sitemap.xml +The +.Pa sitemap.txt +template. +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Make https://example.com web site using the unpreprocessed files in the +current directory +.Pp +.Dl $ mkws https://example.com +.Pp +Make https://example.com web site using the unpreprocessed files in the +.Ar ~/src/ws +directory +.Pp +.Dl $ mkws https://example.com ~/src/ws +.Sh SEE ALSO +.Xr sh 1 +.Xr pp 1 +.Xr locale 1 diff -urP /var/empty/ws.sh/share/man/man1/pp.1 1.0/ws.sh/share/man/man1/pp.1 --- /var/empty/ws.sh/share/man/man1/pp.1 Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/share/man/man1/pp.1 Wed Jun 24 11:20:30 2020 @@ -0,0 +1,46 @@ +.Dd Apr 25, 2019 +.Dt pp 1 +.Os +.Sh NAME +.Nm pp +.Nd preprocessor +.Sh SYNOPSIS +.Nm pp +.Op Fl d +.Ar file +.Op args ... +.Sh DESCRIPTION +The +.Nm +utility processes +.Ar file +to produce output that is used as input to another +program. +.Pp +It executes code enclosed in +.Dq #!\en +delimiters using +.Xr sh 1 . +.Op args ... +are passed to the embbeded script and are available +via the usual +.Em $1, $2, ... +positional parameters. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl d +.Nm +will dump the generated +.Xr sh 1 +code instead of executing it. This is useful for debugging. +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Preprocess file with arguments: +.Pp +.Dl $ pp file.upphtml a b +.Pp +.Sh SEE ALSO +.Xr sh 1 diff -urP /var/empty/ws.sh/share/robots.upptxt 1.0/ws.sh/share/robots.upptxt --- /var/empty/ws.sh/share/robots.upptxt Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/share/robots.upptxt Wed Jun 24 11:20:30 2020 @@ -0,0 +1,2 @@ +user-agent: * +sitemap: "$1"/sitemap.xml diff -urP /var/empty/ws.sh/share/sitemap.uppxml 1.0/ws.sh/share/sitemap.uppxml --- /var/empty/ws.sh/share/sitemap.uppxml Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/share/sitemap.uppxml Wed Jun 24 11:20:30 2020 @@ -0,0 +1,15 @@ + + +#! +for f in *.html +do +#! + + $1/$(basename $f) + $(stat -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' "$f") + 1.0 + +#! +done +#! + diff -urP /var/empty/ws.sh/share/theme.uppcss 1.0/ws.sh/share/theme.uppcss --- /var/empty/ws.sh/share/theme.uppcss Thu Jan 1 02:00:00 1970 +++ 1.0/ws.sh/share/theme.uppcss Wed Jun 24 11:20:30 2020 @@ -0,0 +1 @@ +