commit: f9abc1d4273dc6dc2a61e13105f435c61a8f24ba
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 29 11:17:18 2024 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Oct 29 11:17:18 2024 +0000
URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=f9abc1d4
bin/gen-eclass-html.sh: Add eclasses fallback for the offline version
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Makefile | 2 +-
bin/gen-eclass-html.sh | 45 +++++++++++++++++++++++++++++++--------------
2 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/Makefile b/Makefile
index 4fbbd90..a94361f 100644
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@ eclass-reference/text.xml:
@echo "Install app-doc/eclass-manpages and" >&2
@echo "run bin/gen-eclass-html.sh before calling make." >&2
@echo "Creating a placeholder index as fallback." >&2
- bin/gen-eclass-html.sh -n
+ OFFLINE="$(OFFLINE)" bin/gen-eclass-html.sh -n
appendices/todo-list/index.html: $(XMLS)
diff --git a/bin/gen-eclass-html.sh b/bin/gen-eclass-html.sh
index b17fbc5..9dd6a56 100755
--- a/bin/gen-eclass-html.sh
+++ b/bin/gen-eclass-html.sh
@@ -180,31 +180,48 @@ Note that most eclasses have an accompanying manual page.
These man pages can be
installed by emerging <c>app-doc/eclass-manpages</c>.
</p>
-</body>
-
-<section>
-<title>Contents</title>
-<body>
EOF
-if [[ -n ${NOMAN} ]]; then
+if [[ -z ${NOMAN} ]]; then
+ cat <<- 'EOF' >> "${OUTPUTDIR}"/text.xml || exit 1
+ </body>
+
+ <section>
+ <title>Contents</title>
+ <body>
+
+ <ul class="list-group">
+ EOF
+ for i in $(find "${OUTPUTDIR}" -maxdepth 1 -mindepth 1 -type d | sort);
do
+ echo "<li><uri link=\"$(basename $i)/index.html\">$(basename
$i)</uri></li>" \
+ >> "${OUTPUTDIR}"/text.xml || exit 1
+ done
+ cat <<- 'EOF' >> "${OUTPUTDIR}"/text.xml || exit 1
+ </ul>
+ </body>
+ </section>
+ EOF
+elif [[ ${OFFLINE} -ne 0 ]]; then
+ # Offline version, absence of eclasses is expected => note
+ cat <<- 'EOF' >> "${OUTPUTDIR}"/text.xml || exit 1
+ <note>
+ The offline version of the devmanual does not include the documentation
+ for the eclasses.
+ </note>
+ </body>
+ EOF
+else
+ # Otherwise, presumably something went wrong => warning
cat <<- 'EOF' >> "${OUTPUTDIR}"/text.xml || exit 1
<warning>
This is only a placeholder. If you see this text in the output document,
then the eclass documentation is missing.
</warning>
+ </body>
EOF
-else
- echo '<ul class="list-group">' >> "${OUTPUTDIR}"/text.xml || exit 1
- for i in $(find "${OUTPUTDIR}" -maxdepth 1 -mindepth 1 -type d | sort);
do
- echo "<li><uri link=\"$(basename $i)/index.html\">$(basename
$i)</uri></li>" >> "${OUTPUTDIR}"/text.xml || exit 1
- done
- echo '</ul>' >> "${OUTPUTDIR}"/text.xml || exit 1
fi
cat << 'EOF' >> "${OUTPUTDIR}"/text.xml || exit 1
-</body>
-</section>
</chapter>
</guide>
EOF