* [Buildroot] [RFC PATCH v2] docs/website: Add Makefile to pre-generate the website
@ 2024-02-06 14:53 Ismael Luceno
2024-02-06 15:04 ` Ismael Luceno
2024-02-06 15:10 ` Yann E. MORIN
0 siblings, 2 replies; 3+ messages in thread
From: Ismael Luceno @ 2024-02-06 14:53 UTC (permalink / raw)
To: buildroot; +Cc: Ismael Luceno
Supports the current includes plus smu [0] lightweight markup.
[0] https://github.com/Gottox/smu
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
docs/website/Makefile | 33 +++++++++++++++++++++++++++++++++
docs/website/incfile.awk | 23 +++++++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 docs/website/Makefile
create mode 100644 docs/website/incfile.awk
diff --git a/docs/website/Makefile b/docs/website/Makefile
new file mode 100644
index 000000000000..42069967f7ec
--- /dev/null
+++ b/docs/website/Makefile
@@ -0,0 +1,33 @@
+.PHONY: all
+all:
+
+# Avoid implicit rules
+MAKEFLAGS += -r
+
+AWK ?= mawk
+
+SRCDIR := ${CURDIR}
+DEPLOYDIR := ${CURDIR}/out
+
+src-pages != find ${SRCDIR} -maxdepth 1 -name \*.html -o -name \*.smu
+dst-pages := ${src-pages:${SRCDIR}/%=${DEPLOYDIR}/%}
+dst-pages := ${dst-pages:.smu=.html}
+
+all: ${dst-pages}
+
+conf-files := ${MAKEFILE_LIST}
+conf-files += $(wildcard ${HOME}/.tidyrc)
+conf-files += ${SRCDIR}/incfile.awk
+
+${DEPLOYDIR}/%.html: ${SRCDIR}/%.html ${conf-files}
+ mkdir -p "${@D}"
+ tmpfile=$$(mktemp) && \
+ ${AWK} -f incfile.awk $< > "$$tmpfile" && \
+ { tidy -q -m -i "$$tmpfile"; :; } && \
+ mv "$$tmpfile" $@
+
+${DEPLOYDIR}/%.html: ${SRCDIR}/%.smu ${conf-files}
+ mkdir -p "${@D}"
+ tmpfile=$$(mktemp) && \
+ ${AWK} -f incfile.awk $< | smu | tidy -q -m > "$$tmpfile" && \
+ mv "$$tmpfile" $@
diff --git a/docs/website/incfile.awk b/docs/website/incfile.awk
new file mode 100644
index 000000000000..350a88e7b956
--- /dev/null
+++ b/docs/website/incfile.awk
@@ -0,0 +1,23 @@
+BEGIN {
+ FS="\""
+}
+
+{
+ do {
+ if (match($0, /^<!--#include file="([^"]*)" *-->$/)) {
+ file_stack[++file_cur] = $2
+ } else {
+ print
+ }
+ if (file_cur) {
+ e = getline < file_stack[file_cur]
+ if (!e) {
+ --file_cur
+ } else if (e == -1) {
+ printf "%s: read error\n", \
+ file_stack[file_cur] \
+ > "/dev/stderr"
+ }
+ }
+ } while (file_cur)
+}
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Buildroot] [RFC PATCH v2] docs/website: Add Makefile to pre-generate the website
2024-02-06 14:53 [Buildroot] [RFC PATCH v2] docs/website: Add Makefile to pre-generate the website Ismael Luceno
@ 2024-02-06 15:04 ` Ismael Luceno
2024-02-06 15:10 ` Yann E. MORIN
1 sibling, 0 replies; 3+ messages in thread
From: Ismael Luceno @ 2024-02-06 15:04 UTC (permalink / raw)
To: buildroot
On 06/Feb/2024 15:53, Ismael Luceno wrote:
> Supports the current includes plus smu [0] lightweight markup.
>
> [0] https://github.com/Gottox/smu
> Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
Changes from v1:
- Processes includes before passing through smu
- Still imperfect because smu mangles many html tags
To do:
- Maybe special-case html header and footer for smu files.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [RFC PATCH v2] docs/website: Add Makefile to pre-generate the website
2024-02-06 14:53 [Buildroot] [RFC PATCH v2] docs/website: Add Makefile to pre-generate the website Ismael Luceno
2024-02-06 15:04 ` Ismael Luceno
@ 2024-02-06 15:10 ` Yann E. MORIN
1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2024-02-06 15:10 UTC (permalink / raw)
To: Ismael Luceno; +Cc: buildroot
Ismael, All,
I'll do the rest of my review in this new iteration! ;-)
On 2024-02-06 15:53 +0100, Ismael Luceno spake thusly:
[--SNIP--]
> +${DEPLOYDIR}/%.html: ${SRCDIR}/%.smu ${conf-files}
> + mkdir -p "${@D}"
> + tmpfile=$$(mktemp) && \
> + ${AWK} -f incfile.awk $< | smu | tidy -q -m > "$$tmpfile" && \
Don't use pipes, otherwise we can't catch the failure of any
intermediate command. For example, if we can get the awk script to
properly fail in case of error, using pipes will not allow the Makefile
to catch issues.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-06 15:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-06 14:53 [Buildroot] [RFC PATCH v2] docs/website: Add Makefile to pre-generate the website Ismael Luceno
2024-02-06 15:04 ` Ismael Luceno
2024-02-06 15:10 ` Yann E. MORIN
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.