Implement article indexing in ansi
This commit is contained in:
parent
0cc991a3f2
commit
7d71c4bfda
10 changed files with 94 additions and 42 deletions
19
Makefile
19
Makefile
|
|
@ -7,7 +7,8 @@ style := style.css
|
|||
images := images
|
||||
|
||||
# Main html template that pandoc uses to generate .html from .md files
|
||||
template := pandoc/template.html
|
||||
template_html := pandoc/template.html
|
||||
template_ansi := pandoc/template
|
||||
|
||||
# Template for extracting metadata of .md files in json format
|
||||
list_template := pandoc/meta-json-template.txt
|
||||
|
|
@ -34,25 +35,25 @@ $(articles_html): %.html: %.md
|
|||
mv ./articles.json.tmp $(article_list); \
|
||||
|
||||
# Build articles using pandoc
|
||||
pandoc $< --template $(template) --css $(style) --highlight-style zenburn --mathml --toc --output $@; \
|
||||
pandoc $< --template $(template_html) --css $(style) --highlight-style zenburn --mathml --toc --output $@; \
|
||||
|
||||
# Extract metadata from .md file, append filename field to the article object.
|
||||
# This is used to link to the article from index.html. Append article object to the article list.
|
||||
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(notdir $@)"}' )]' $(article_list) > articles.json.tmp; \
|
||||
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(patsubst %.html, %, $(notdir $@))"}')]' $(article_list) > articles.json.tmp; \
|
||||
mv ./articles.json.tmp $(article_list); \
|
||||
|
||||
$(articles_ansi): %: %.md
|
||||
pandoc $< --standalone --to ansi --output $@
|
||||
pandoc $< --template $(template_ansi) --to ansi --output $@
|
||||
|
||||
index.html: index.md $(articles_html)
|
||||
# Build index.html with metadata injected from articles_list
|
||||
pandoc $< --template $(template) --include-after-body shark.js --css $(style) --metadata-file $(article_list) --highlight-style zenburn --mathml --toc --output $@; \
|
||||
pandoc $< --template $(template_html) --include-after-body shark.js --css $(style) --metadata-file $(article_list) --highlight-style zenburn --mathml --toc --output $@; \
|
||||
|
||||
index: index.md $(articles_ansi)
|
||||
pandoc $< --standalone --to ansi --output $@
|
||||
index: index.md $(articles_html) $(articles_ansi)
|
||||
pandoc $< --template $(template_ansi) --metadata-file $(article_list) --to ansi --output $@
|
||||
|
||||
about.html: about.md
|
||||
pandoc $< --template $(template) --css $(style) --highlight-style zenburn --mathml --toc --output $@
|
||||
pandoc $< --template $(template_html) --css $(style) --highlight-style zenburn --mathml --toc --output $@
|
||||
|
||||
about: about.md
|
||||
pandoc $< --standalone --to ansi --output $@
|
||||
pandoc $< --template $(template_ansi) --to ansi --output $@
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue