summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2017-12-17 21:39:36 +0100
committerJonas Bernoulli <jonas@bernoul.li>2017-12-17 21:39:36 +0100
commit05338d893f3879391d7283324364b472e3f4f4d1 (patch)
tree1eeecc43db2111d3cfa91f7864e39b7e5c7b60b8 /Makefile
parent93876b61a565d5696d278828d4ad687e64cb3ee1 (diff)
make: inject style switcher into generated html manual
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 13 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2df3cf4..602c58c 100644
--- a/Makefile
+++ b/Makefile
@@ -82,13 +82,26 @@ dir: $(PKG).info
@printf "Generating $@\n"
@printf "%s" $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@
+HTML_FIXUP_CSS = '/<link rel="stylesheet" type="text\/css" href="\/assets\/page.css">/a\
+<link class="s-css-s--style" rel="stylesheet" title="Default" href="/assets/themes/default.css">\
+\n<link class="s-css-s--style" rel="stylesheet alternate" title="Default high contrast" href="/assets/themes/default-high-contrast.css">\
+\n<link class="s-css-s--style" rel="stylesheet alternate" title="Solarized dark xterm" href="/assets/themes/solarized-dark-xterm.css">\
+\n<link class="s-css-s--style" rel="stylesheet alternate" title="Black on white" href="/assets/themes/black-on-white.css">\
+\n<script src="/assets/js/simple-css-switch.js"></script>'
+HTML_FIXUP_ONLOAD = 's/<body lang="en">/<body lang="en" onload="simpleCssSwitch()">/'
+HTML_FIXUP_MENU = '/<\/body>/i<div id="s-css-s--menu"><\/div>'
+
%.html: %.texi
@printf "Generating $@\n"
@$(MAKEINFO) --html --no-split $(MANUAL_HTML_ARGS) $<
+ @sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $@
html-dir: $(PKG).texi
@printf "Generating $(PKG)/*.html\n"
@$(MAKEINFO) --html $(MANUAL_HTML_ARGS) $<
+ @for f in $$(find $(PKG) -name '*.html') ; do \
+ sed -i -e $(HTML_FIXUP_CSS) -e $(HTML_FIXUP_ONLOAD) -e $(HTML_FIXUP_MENU) $$f ; \
+ done
%.pdf: %.texi
@printf "Generating $@\n"