diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 44 |
1 files changed, 9 insertions, 35 deletions
@@ -192,44 +192,18 @@ doxygen: clean | |||
192 | @rm -rf doxygen | 192 | @rm -rf doxygen |
193 | @( cat Doxyfile ; echo "PROJECT_NUMBER=`git describe`" ) | doxygen - | 193 | @( cat Doxyfile ; echo "PROJECT_NUMBER=`git describe`" ) | doxygen - |
194 | 194 | ||
195 | ### update the local copy of the documentation | ||
196 | doc: clean | ||
197 | @rm -rf doc | ||
198 | @git clone https://github.com/shaarli/Shaarli.wiki.git doc | ||
199 | @rm -rf doc/.git | ||
200 | |||
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 | ||
206 | htmlsidebar: | ||
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 | |||
215 | ### Convert local markdown documentation to HTML | 195 | ### Convert local markdown documentation to HTML |
216 | # | 196 | # |
217 | # For all pages: | 197 | # For all pages: |
218 | # - infer title from the file name | ||
219 | # - convert GitHub-flavoured relative links to standard Markdown | 198 | # - convert GitHub-flavoured relative links to standard Markdown |
220 | # - insert the sidebar menu | 199 | # - generate html documentation with mkdocs |
221 | htmlpages: | 200 | htmlpages: |
222 | @for file in `find doc/ -maxdepth 1 -name "*.md"`; do \ | 201 | python3 -m venv venv/ |
223 | base=`basename $$file .md`; \ | 202 | bash -c 'source venv/bin/activate; \ |
224 | sed -i "1i #$${base//-/ }" $$file; \ | 203 | pip install mkdocs; \ |
225 | awk 'BEGIN { FS = "[\\[\\]]{2}" }'\ | 204 | mkdocs build' |
226 | 'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\ | 205 | find doc/html/ -type f -exec chmod a-x '{}' \; |
227 | '!m { print $$0 }' $$file > doc/tmp.md; \ | 206 | rm -r venv |
228 | mv doc/tmp.md $$file; \ | 207 | |
229 | pandoc -f markdown_github -t html5 -s \ | 208 | doc_html: authors htmlpages |
230 | -c "github-markdown.css" \ | ||
231 | -T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \ | ||
232 | -o doc/$$base.html $$file; \ | ||
233 | done; | ||
234 | 209 | ||
235 | htmldoc: authors doc htmlsidebar htmlpages | ||