generate valid HTML, including head & style

This commit is contained in:
Christian Hesse 2025-09-16 12:01:32 +02:00
parent 6b0c9ab17d
commit 7a790b88c0
2 changed files with 20 additions and 2 deletions

View file

@ -11,8 +11,10 @@ HTML = $(MARKDOWN:.md=.html)
all: $(CAPSMAN) $(LOCAL) $(WIFI) $(HTML) checksums.json
%.html: %.md Makefile
markdown $< | sed 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' > $@
%.html: %.md contrib/head.html Makefile
sed 's|__TITLE__|$(shell head -n1 $<)|' < contrib/head.html > $@
markdown -f toc,idanchor $< | sed -e 's/href="\([-_\./[:alnum:]]*\)\.md"/href="\1.html"/g' -e '/<h[1234] /s| id="\(.*\)">| id="\L\1">|' >> $@
printf '</body></html>' >> $@
%.capsman.rsc: %.template.rsc Makefile
sed -e '/\/interface\/wifi\//d' -e '/\/interface\/wireless\//d' -e 's|%TEMPL%|.capsman|' \

16
contrib/head.html Normal file
View file

@ -0,0 +1,16 @@
<!DOCTYPE html><html lang="en">
<head><title>RouterOS Scripts :: __TITLE__</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
body { font-family: sans-serif; }
h2 { border-bottom: 1px solid #ccc; color: #000; }
h2 a { color: black; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
blockquote { border-left: 4px solid #ccc; padding: 0 10px; color: #777; }
code { margin: 0 2px; padding: 2px 5px; border: 1px solid #ccc; background-color: #f8f8f8; border-radius: 3px; }
pre { background-color: #f8f8f8; border: 1px solid #ccc; overflow: auto; padding: 6px 10px; border-radius: 3px; }
pre code { margin: 0; padding: 0; border: 0; }
</style>
<link rel="icon" href="/logo.png" type="image/png">
</head><body>