diff options
author | VirtualTam <virtualtam@flibidi.net> | 2015-08-04 16:07:13 +0200 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2015-08-04 16:07:13 +0200 |
commit | 27cf2e671d1f35bd8c9383d008cd3733fc1c6e0d (patch) | |
tree | 4726baf18e7057eac3f9b6bdb5991fe6117814fc /Makefile | |
parent | 96db105e4c0833324f7168edb5673278de8ccd54 (diff) | |
parent | 992af0b9d77cb4fbac2c37ef8d5896042d67a2a3 (diff) | |
download | Shaarli-27cf2e671d1f35bd8c9383d008cd3733fc1c6e0d.tar.gz Shaarli-27cf2e671d1f35bd8c9383d008cd3733fc1c6e0d.tar.zst Shaarli-27cf2e671d1f35bd8c9383d008cd3733fc1c6e0d.zip |
Merge pull request #294 from virtualtam/doc/update
Doc: sync from Wiki, generate HTML
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 33 insertions, 3 deletions
@@ -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 | ||
134 | htmlsidebar: | ||
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 |
130 | htmldoc: | 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 | ||
149 | htmlpages: | ||
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 | |||
163 | htmldoc: doc htmlsidebar htmlpages | ||