aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 19 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 1d8a73a2..1ddd60f8 100644
--- a/Makefile
+++ b/Makefile
@@ -194,42 +194,28 @@ doxygen: clean
194 194
195### update the local copy of the documentation 195### update the local copy of the documentation
196doc: clean 196doc: clean
197 @rm -rf doc 197 @rm -rf doc/md/
198 @git clone https://github.com/shaarli/Shaarli.wiki.git doc 198 @git clone https://github.com/shaarli/Shaarli.wiki.git doc/md
199 @rm -rf doc/.git 199 mv doc/md/Home.md doc/md/index.md
200 200 @rm -rf doc/md/.git
201### Generate a custom sidebar
202#
203# Sidebar content:
204# - convert GitHub-flavoured relative links to standard Markdown
205# - trim HTML, only keep the list (<ul>[...]</ul>) part
206htmlsidebar:
207 @echo '<div id="local-sidebar">' > doc/sidebar.html
208 @awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
209 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
210 '!m { print $$0 }' doc/_Sidebar.md > doc/tmp.md
211 @pandoc -f markdown -t html5 -s doc/tmp.md | awk '/(ul>|li>)/' >> doc/sidebar.html
212 @echo '</div>' >> doc/sidebar.html
213 @rm doc/tmp.md
214 201
215### Convert local markdown documentation to HTML 202### Convert local markdown documentation to HTML
216# 203#
217# For all pages: 204# For all pages:
218# - infer title from the file name
219# - convert GitHub-flavoured relative links to standard Markdown 205# - convert GitHub-flavoured relative links to standard Markdown
220# - insert the sidebar menu 206# - generate html documentation with mkdocs
221htmlpages: 207htmlpages:
222 @for file in `find doc/ -maxdepth 1 -name "*.md"`; do \ 208 # Rename local [[links]] to regular links.
223 base=`basename $$file .md`; \ 209 @for file in `find doc/md/ -maxdepth 1 -name "*.md"`; do \
224 sed -i "1i #$${base//-/ }" $$file; \ 210 sed -e "s/\[\[\(.*\)\]\]/[\1](\1)/g" "$$file" > doc/md/tmp.md; \
225 awk 'BEGIN { FS = "[\\[\\]]{2}" }'\ 211 mv doc/md/tmp.md $$file; \
226 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\ 212 done
227 '!m { print $$0 }' $$file > doc/tmp.md; \ 213
228 mv doc/tmp.md $$file; \ 214 python3 -m venv venv/
229 pandoc -f markdown_github -t html5 -s \ 215 bash -c 'source venv/bin/activate; \
230 -c "github-markdown.css" \ 216 pip install mkdocs; \
231 -T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \ 217 mkdocs build'
232 -o doc/$$base.html $$file; \ 218 find doc/html/ -type f -exec chmod a-x '{}' \;
233 done; 219 rm -r venv
234 220
235htmldoc: authors doc htmlsidebar htmlpages 221doc_html: authors doc htmlpages