aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile36
1 files changed, 33 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d69fac46..05578525 100644
--- a/Makefile
+++ b/Makefile
@@ -126,8 +126,38 @@ doc: clean
126 @git clone https://github.com/shaarli/Shaarli.wiki.git doc 126 @git clone https://github.com/shaarli/Shaarli.wiki.git doc
127 @rm -rf doc/.git 127 @rm -rf doc/.git
128 128
129### Generate a custom sidebar
130#
131# Sidebar content:
132# - convert GitHub-flavoured relative links to standard Markdown
133# - trim HTML, only keep the list (<ul>[...]</ul>) part
134htmlsidebar:
135 @echo '<div id="local-sidebar">' > doc/sidebar.html
136 @awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
137 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
138 '!m { print $$0 }' doc/_Sidebar.md > doc/tmp.md
139 @pandoc -f markdown -t html5 -s doc/tmp.md | awk '/(ul>|li>)/' >> doc/sidebar.html
140 @echo '</div>' >> doc/sidebar.html
141 @rm doc/tmp.md
142
129### Convert local markdown documentation to HTML 143### Convert local markdown documentation to HTML
130htmldoc: 144#
131 for file in `find doc/ -maxdepth 1 -name "*.md"`; do \ 145# For all pages:
132 pandoc -f markdown_github -t html5 -s -c "github-markdown.css" -o doc/`basename $$file .md`.html "$$file"; \ 146# - infer title from the file name
147# - convert GitHub-flavoured relative links to standard Markdown
148# - insert the sidebar menu
149htmlpages:
150 @for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
151 base=`basename $$file .md`; \
152 sed -i "1i #$${base//-/ }" $$file; \
153 awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
154 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
155 '!m { print $$0 }' $$file > doc/tmp.md; \
156 mv doc/tmp.md $$file; \
157 pandoc -f markdown_github -t html5 -s \
158 -c "github-markdown.css" \
159 -T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \
160 -o doc/$$base.html $$file; \
133 done; 161 done;
162
163htmldoc: doc htmlsidebar htmlpages