diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/note.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/note.lua b/tools/note.lua index 16acbc8..d684aaa 100644 --- a/tools/note.lua +++ b/tools/note.lua @@ -1,4 +1,5 @@ -local stringify = (require 'pandoc.utils').stringify +local stringify = require('pandoc.utils').stringify +local text = require('text') local meta_tools = require("tools/meta_tools") local status_map = {"seedling", "budding", "evergreen"} @@ -12,6 +13,19 @@ function Link(link) end end +function Image(image) + if not string.find(image.src, "://") then + local s_begin, s_end = string.find(image.src, "youtube:") + if s_begin ~= nil then + local url = "https://www.youtube.com/embed/" .. string.sub(image.src, s_end+1, -1) + local video = pandoc.RawInline("html", string.format("<div class=\"youtube-video\"><iframe width=\"728px\" height=\"410px\" src=\"%s\"></iframe></div>", url)) + return {video} + end + else + return image + end +end + function Pandoc(doc) doc.meta["main_class"] = "html-note-page" doc.meta["main_container"] = "main-container" |