Start working on ctation rendering

pull/185/merge^2
Matti Pastell 2019-03-01 10:47:29 +02:00
parent 11f95b3844
commit 935303d175
3 changed files with 19 additions and 1 deletions

View File

@ -5,3 +5,4 @@ Mustache
YAML
Compat 0.25.0
Requires
BibTeX

View File

@ -0,0 +1,3 @@
{{#article}}
{{author}}. ({{year}}). {{title}}. {{journal}}. {{volume}}:{{{pages}}}. doi: {{{doi}}}.
{{/article}}

View File

@ -104,6 +104,7 @@ Multiple lines
##
using Revise
import Weave: WeaveMarkdown
import Mustache
md = """
@ -115,5 +116,18 @@ cite [@Bezanson2017] again
"""
m = WeaveMarkdown.parse_markdown(md, "test/documents/bibtex/testdocs.bib");
m = WeaveMarkdown.parse_markdown(md, joinpath(@__DIR__, "documents/bibtex/testdocs.bib"));
m
# Render references
tpl = Mustache.template_from_file(joinpath(@__DIR__, "../templates/html_citations.tpl"))
ref = WeaveMarkdown.CITATIONS[:references]["Bezanson2017"]
ref[ref["type"]] = "true"
ref["author"] = replace(ref["author"], r"\sand\s"i => ", ")
for key in keys(ref)
ref[key] = replace(ref[key], r"\{|\}" => "")
ref[key] = replace(ref[key], "--" => "—")
end
Mustache.render(tpl, ref)
r2 = Dict("author" => "Matti Pastell", "title" => "Some paper", "article" => "true")
Mustache.render(tpl, r2)