star-ty

Generate content for online publication
git clone git://git.meso-star.fr/star-ty.git
Log | Files | Refs | README | LICENSE

commit 2a13dbc5be2e85e6ee54b4e0b1abb9e6f25a96aa
parent 2683af1d701ea328b26c2ba07c27bc6c58af8268
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 12 Nov 2025 11:17:12 +0100

Add hooks to the example provided

They are used to generate the HTML version of the Star-Typesetting
manual pages. A new script dynamically generates the HTML page that
lists them.

Diffstat:
MMakefile | 10+++++++++-
Aexample/home/documentation.sh | 16++++++++++++++++
Aexample/home/hooks/00-find-man-pages.sh | 28++++++++++++++++++++++++++++
Aexample/home/hooks/01-convert-man-pages.sh | 29+++++++++++++++++++++++++++++
Aexample/home/hooks/man-pages.sh | 15+++++++++++++++
Mexample/home/index.tsv | 1+
6 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -48,15 +48,19 @@ install: sty-genhead install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-hooks.1; \ install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-index.1; \ install 644 "$(DESTDIR)$(MANPREFIX)/man1" doc/sty-list.1; \ - install 655 "$(DESTDIR)$(MANPREFIX)/man7" doc/star-typesetting.7; \ + install 644 "$(DESTDIR)$(MANPREFIX)/man7" doc/star-typesetting.7; \ install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-ty" README.md; \ install 644 "$(DESTDIR)$(PREFIX)/share/doc/star-ty" COPYING; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/Makefile; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/config.mk; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/sty.css; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty" example/menu.tsv; \ + install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home" example/home/documentation.sh; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home" example/home/index.tsv; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home" example/home/overview.md; \ + install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks" example/home/hooks/00-find-man-pages.sh; \ + install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks" example/home/hooks/01-convert-man-pages.sh; \ + install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks" example/home/hooks/man-pages.sh; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples" example/examples/index.tsv; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples" example/examples/lorem-ipsum-fr.md; \ install 644 "$(DESTDIR)$(APPPREFIX)/star-ty/examples" example/examples/lorem-ipsum-la.md; \ @@ -85,7 +89,11 @@ uninstall: rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/menu.tsv" rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/index.tsv" rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/about.sh" + rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/documentation.sh" rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/overview.md" + rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks/00-find-man-pages.sh" + rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks/01-convert-man-pages.sh" + rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/home/hooks/man-pages.sh" rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/index.tsv" rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/lorem-ipsum-fr.md" rm -f "$(DESTDIR)$(APPPREFIX)/star-ty/examples/lorem-ipsum-la.md" diff --git a/example/home/documentation.sh b/example/home/documentation.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Copyright (C) 2017-2025 |Méso|Star> (contact@meso-star.com) +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +. "hooks/man-pages.sh" + +echo "# Manual pages" + +printf "%s\n" "${man_pages}" | while read -r i; do + printf -- "- [%s](%s.html)\n" "${i}" "${i}" +done diff --git a/example/home/hooks/00-find-man-pages.sh b/example/home/hooks/00-find-man-pages.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# Copyright (C) 2017-2025 |Méso|Star> (contact@meso-star.com) +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +. "hooks/man-pages.sh" + +copy_man() # manual page +{ + # shellcheck disable=SC2154 + echo "${MANPATH}" | sed 's/:/\n/g' | sed '/^$/d' | \ + while read -r i; do + f="$(find "${i}" -type f -name "$1")"; + if [ -n "${f}" ]; then + cp "${f}" ./ + >&2 printf "Found the manual page %s in %s\n" "$1" "${i}" + break + fi + done +} + +printf "%s\n" "${man_pages}" | while read -r i; do + copy_man "${i}" +done diff --git a/example/home/hooks/01-convert-man-pages.sh b/example/home/hooks/01-convert-man-pages.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# Copyright (C) 2017-2025 |Méso|Star> (contact@meso-star.com) +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +. "hooks/man-pages.sh" + +# Man to convert is submitted on stdin +man2html() # output_filename +{ + ( + cd .. + sty-genhead "${OLDPWD##*/}/$1" + mandoc -O man=./%N.%S.html,fragment -T html -I os=UNIX + cat ./templates/footer.html + ) > "$1" +} + +printf "%s\n" "${man_pages}" | while read -r i; do + man2html "${i}.html" < "${i}" + + # Write the generated files to standard output to inform the build + # system which files it needs to handle during installation. + printf '%s/%s.html\n' "${PWD##*/}" "${i}" +done diff --git a/example/home/hooks/man-pages.sh b/example/home/hooks/man-pages.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Copyright (C) 2017-2025 |Méso|Star> (contact@meso-star.com) +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +export man_pages="\ + sty-genhead.1 + sty-hooks.1 + sty-index.1 + sty-list.1 + star-typesetting.7" diff --git a/example/home/index.tsv b/example/home/index.tsv @@ -1,3 +1,4 @@ # Label web-page [languages] Star Typesetting about.html How to? overview.html +Documentation documentation.html