X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=Makefile;h=05578525097b1526b55d101a9f77d0e0b13ec903;hb=53cc2b93b85a080c6c06bc3633fb454241fc5699;hp=d69fac46b2a6fccd1a85c3b4d55e1f45c9ff88a6;hpb=96db105e4c0833324f7168edb5673278de8ccd54;p=github%2Fshaarli%2FShaarli.git
diff --git a/Makefile b/Makefile
index d69fac46..05578525 100644
--- a/Makefile
+++ b/Makefile
@@ -126,8 +126,38 @@ doc: clean
@git clone https://github.com/shaarli/Shaarli.wiki.git doc
@rm -rf doc/.git
+### Generate a custom sidebar
+#
+# Sidebar content:
+# - convert GitHub-flavoured relative links to standard Markdown
+# - trim HTML, only keep the list (
) part
+htmlsidebar:
+ @echo '' >> doc/sidebar.html
+ @rm doc/tmp.md
+
### Convert local markdown documentation to HTML
-htmldoc:
- for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
- pandoc -f markdown_github -t html5 -s -c "github-markdown.css" -o doc/`basename $$file .md`.html "$$file"; \
+#
+# For all pages:
+# - infer title from the file name
+# - convert GitHub-flavoured relative links to standard Markdown
+# - insert the sidebar menu
+htmlpages:
+ @for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
+ base=`basename $$file .md`; \
+ sed -i "1i #$${base//-/ }" $$file; \
+ awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
+ 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
+ '!m { print $$0 }' $$file > doc/tmp.md; \
+ mv doc/tmp.md $$file; \
+ pandoc -f markdown_github -t html5 -s \
+ -c "github-markdown.css" \
+ -T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \
+ -o doc/$$base.html $$file; \
done;
+
+htmldoc: doc htmlsidebar htmlpages