-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"; \
- done;
\ No newline at end of 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