diff options
author | Lucas Fryzek <lucas.fryzek@gmail.com> | 2022-11-02 18:35:40 -0400 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@gmail.com> | 2022-11-02 18:35:40 -0400 |
commit | 1920b397fad8b1d6cd0233a5aa9a12365b16a287 (patch) | |
tree | 2b10edd83a77f59dcfdce2f3a38bea4126e06fd1 /tools/note.lua |
Initial commit
Diffstat (limited to 'tools/note.lua')
-rw-r--r-- | tools/note.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/note.lua b/tools/note.lua new file mode 100644 index 0000000..3ec9a51 --- /dev/null +++ b/tools/note.lua @@ -0,0 +1,19 @@ +local stringify = (require 'pandoc.utils').stringify + +local status_map = {"seadling", "budding", "evergreen"} + +function Pandoc(doc) + doc.meta["front_page"] = false + + local status = stringify(doc.meta["status"]) + local status_name = status_map[tonumber(status)] + local text = pandoc.Para(status_name) + local image = pandoc.RawBlock("html", string.format("<img src=\"/assets/%s.svg\">", status_name)) + + local div = pandoc.Div({image, text}) + div.classes = {"plant-status"} + + local status_info = pandoc.MetaBlocks(div) + doc.meta["note_status"] = status_info + return pandoc.Pandoc(doc.blocks, doc.meta) +end |