From bcee1a0f4615d90bd714adf8bea79baffe006579 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 29 Dec 2021 19:16:35 +0100 Subject: Added lightbox --- filters/macros.lua | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'filters') diff --git a/filters/macros.lua b/filters/macros.lua index dc04cfd..2864bef 100644 --- a/filters/macros.lua +++ b/filters/macros.lua @@ -4,36 +4,21 @@ function note(el) return el end -function gallery(el) - el.classes = pandoc.List() - el.classes:insert("c-gallery") - - local cur = pandoc.Div(pandoc.List(), { class = "c-gallery__current" }) - local imageList = pandoc.Div(pandoc.List(), { class = "c-gallery__items" }) - - pandoc.walk_block(el, { - Image = function(iel) - iel.classes = pandoc.List() - iel.classes:insert("c-gallery__img") +function figure(el) + local images = pandoc.List() - local lel = pandoc.Link(iel, iel.src) - lel.classes = pandoc.List() - lel.classes:insert("c-gallery__item") + pandoc.walk_block(el, { Image = function(iel) images:insert(iel) end }) - imageList.content:insert(lel) - end, - }) - - el.content = { cur, imageList } - - return el + return pandoc.RawBlock("html", + "
") end function Div(el) if el.classes:includes("note") then el = note(el) - elseif el.classes:includes("gallery") then - el = gallery(el) + elseif el.classes:includes("figure") then + el = figure(el) end return el -- cgit v1.2.3-70-g09d2