aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2015-07-22 05:02:10 +0200
committerVirtualTam <virtualtam@flibidi.net>2015-08-04 16:02:21 +0200
commit992af0b9d77cb4fbac2c37ef8d5896042d67a2a3 (patch)
tree4726baf18e7057eac3f9b6bdb5991fe6117814fc /Makefile
parent96db105e4c0833324f7168edb5673278de8ccd54 (diff)
downloadShaarli-992af0b9d77cb4fbac2c37ef8d5896042d67a2a3.tar.gz
Shaarli-992af0b9d77cb4fbac2c37ef8d5896042d67a2a3.tar.zst
Shaarli-992af0b9d77cb4fbac2c37ef8d5896042d67a2a3.zip
Doc: sync from Wiki, generate HTML
Closes #291 Fixes #227 Modifications - HTML content: match the new Wiki structure - Makefile - generate a custom HTML sidebar - include the sidebar on all pages - infer and prepend page titles - handle relative links - add title metadata, e.g. Shaarli - <Page Name> Signed-off-by: VirtualTam <virtualtam@flibidi.net>
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