hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 46b01f5413a773c17978b0c0399dd6732b3c24ce
parent b93bc49b99c75182e3281863d16e21d3c36a5f1c
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu,  4 Nov 2021 14:35:02 +0100

scripts/gen-docs: improve module listing

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mscripts/gen-docs | 23++++++++++++++++++-----
Mscripts/gen-stdlib | 10++++++----
2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/scripts/gen-docs b/scripts/gen-docs @@ -1,10 +1,22 @@ #!/bin/sh # Yes, I am entirely aware that this is a hack -modules=$(awk ' -/^modules="/ { sub(/.*="/, ""); print $1; mods = 1 } -/^[a-z][a-z0-9:_]+/ { if (mods == 1) { print $1 } } -/^[a-z][a-z0-9:_]+"$/ { if (mods == 1) { mods = 0; sub(/"/, ""); print $1 } } -' < scripts/gen-stdlib) +srcdir="$(dirname "$0")" +getmods() ( + DOCS=1 + . $srcdir/gen-stdlib + IFS=" +" + for module in $modules; do + if [ -z "$(echo "$module" | cut -sf1)" ] + then + echo "$module" + else + module="$(echo "$module" | cut -sf1)" + echo $module + fi + done +) +modules="$(getmods)" mkdir -p docs/html/ @@ -16,6 +28,7 @@ fi haredoc -Fhtml > docs/html/index.html for mod in $modules compress format encoding math crypto hare rt iobus do + echo $mod path="$(echo $mod | sed -e 's?::?/?g')" mkdir -p docs/html/$path haredoc -Fhtml $mod >docs/html/$path/index.html diff --git a/scripts/gen-stdlib b/scripts/gen-stdlib @@ -1034,8 +1034,6 @@ uuid() { gen_ssa uuid crypto::random strio fmt endian io bytes bufio strings strconv } -printf '# This file is generated by the gen-stdlib script, do not edit it by hand\n\n' - # List of modules and their supported platforms. Place a tab between the module # and its platform list, and spaces between each supported platform. Omitting # the platform list implies all platforms are supported. @@ -1147,5 +1145,9 @@ stdlib() { unset IFS } -genrules -genrules test +if [ ${DOCS:-0} -ne 1 ] +then + printf '# This file is generated by the gen-stdlib script, do not edit it by hand\n\n' + genrules + genrules test +fi