From 6ad51e433cd115765e353711802525e8fb1e444a Mon Sep 17 00:00:00 2001 From: Hiromasa Ihara Date: Tue, 2 Jan 2024 06:39:29 +0900 Subject: [PATCH] Docs: reproduce single_document.adoc from nav.adoc and sed script (#2468) Co-authored-by: Hiromasa Ihara <118803+miettal@users.noreply.github.com> Co-authored-by: Hiroyuki Ikegami --- doc/tools/create_single_page_html.sh | 24 +++++++++++++++++++++++- doc/tools/create_single_page_pdf.sh | 24 +++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/doc/tools/create_single_page_html.sh b/doc/tools/create_single_page_html.sh index 8d049183c05..73462e6e19c 100644 --- a/doc/tools/create_single_page_html.sh +++ b/doc/tools/create_single_page_html.sh @@ -7,4 +7,26 @@ cd ${DIR}/../modules/ROOT/pages echo "Creating ${DIR}/../modules/ROOT/pages/single_document.html" -asciidoctor -b html5 -o single_document.html single_document.adoc \ No newline at end of file +SED_ARG="s/xref:/include::/" +for NUM in $(seq 1 1 5); do + SED_ARG="${SED_ARG} -e s/^*\{$NUM\}.\(inc.*\)\[.*\]$/\1[leveloffset=+$NUM]/" +done + +cat << SEC | asciidoctor -b html5 -o single_document.html - += OpenEMS - Open Energy Management System +ifndef::toc[] +(c) 2023 OpenEMS Association e.V. +:doctype: book +:sectnums: +:sectnumlevels: 4 +:toc: +:toclevels: 2 +:toc-title: Inhalt +:experimental: +:keywords: AsciiDoc +:source-highlighter: highlight.js +:icons: font +endif::toc[] + +$(cat ../nav.adoc | sed -e $(echo ${SED_ARG}) -e 's/^* \(.*\)$/== \1/g' | head -n-1) +SEC diff --git a/doc/tools/create_single_page_pdf.sh b/doc/tools/create_single_page_pdf.sh index 04b2001f94d..ce11af2c00a 100644 --- a/doc/tools/create_single_page_pdf.sh +++ b/doc/tools/create_single_page_pdf.sh @@ -10,4 +10,26 @@ cd ${DIR}/../modules/ROOT/${LANG} echo "Creating ${DIR}/../modules/ROOT/${LANG}/single_document.pdf" -asciidoctor-pdf -o single_document.pdf single_document.adoc \ No newline at end of file +SED_ARG="s/xref:/include::/" +for NUM in $(seq 1 1 5); do + SED_ARG="${SED_ARG} -e s/^*\{$NUM\}.\(inc.*\)\[.*\]$/\1[leveloffset=+$NUM]/" +done + +cat << SEC | asciidoctor-pdf -o single_document.pdf - += OpenEMS - Open Energy Management System +ifndef::toc[] +(c) 2023 OpenEMS Association e.V. +:doctype: book +:sectnums: +:sectnumlevels: 4 +:toc: +:toclevels: 2 +:toc-title: Inhalt +:experimental: +:keywords: AsciiDoc +:source-highlighter: highlight.js +:icons: font +endif::toc[] + +$(cat ../nav.adoc | sed -e $(echo ${SED_ARG}) -e 's/^* \(.*\)$/== \1/g' | head -n-1) +SEC