From de0282de4ce3ba8f1f42a408333d14b8b680f63e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 16 Sep 2025 23:21:24 +0800 Subject: [PATCH] Generate HTML documentation --- .gitignore | 1 + Makefile | 38 ++++++++++++++++++++++++++++++++++++++ scripts/moddirs | 11 +++++++++++ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..35b5e99aee31762e1675c5a067f7628b7a191422 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d7a31259b5290e88444a19cc1f91d52e4d342ffb --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2021-2025 Hare authors +# SPDX-FileCopyrightText: 2025 Runxi Yu + +.POSIX: +.SUFFIXES: +HARE=hare +HAREFLAGS= + +DESTDIR= +PREFIX=/usr/local +SRCDIR=$(PREFIX)/src +HARESRCDIR=$(SRCDIR)/hare +THIRDPARTYDIR=$(HARESRCDIR)/third-party + +check: + $(HARE) $(HAREFLAGS) test + +install: + install -dm644 ds/ $(DESTDIR)$(THIRDPARTYDIR)/ + +uninstall: + rm -rf $(DESTDIR)$(THIRDPARTYDIR)/ds/ + +html: + mkdir -p html + for d in $$(scripts/moddirs); do \ + find $$d -type d | sed -E '/(\+|-)/d'; \ + done \ + | while read path; do \ + mod=$$(echo $$path | sed -E 's@/@::@g'); \ + echo $$mod; \ + mkdir -p html/$$path; \ + echo haredoc -Fhtml $$mod; \ + haredoc -Fhtml $$mod | sed "s@stdlib@third-party@g" > html/$$path/index.html; \ + done + +.PHONY: check install uninstall html diff --git a/scripts/moddirs b/scripts/moddirs new file mode 100755 index 0000000000000000000000000000000000000000..0ccdca207c5452a7905e0083e07c337696a507bf --- /dev/null +++ b/scripts/moddirs @@ -0,0 +1,11 @@ +#!/bin/sh +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2021-2025 Hare authors +# SPDX-FileCopyrightText: 2025 Runxi Yu + +for i in *; do + case "$i" in + .* | html | scripts) ;; + *) find -- "$i" -prune -type d ;; + esac +done -- 2.48.1