blob: 04cead6f366996c4115537bf9f139364bea870e4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
local common = require 'filters.lib.common'
local vars = {}
function alert(el)
el.classes = pandoc.List()
el.classes:insert("o-alert")
el.classes:insert("o-alert--primary")
el.classes:insert("s-alerts__alert")
return common.wide(el)
end
function figure(el)
local images = pandoc.List()
pandoc.walk_block(el, { Image = function(iel) images:insert(iel) end })
images[1].classes:insert("c-figure__image")
local class = "c-figure js-lightbox__image"
if vars.layout and vars.layout.is_exhibit then
class = class .. " u-d-none@js"
end
el = pandoc.List()
el:insert(pandoc.RawBlock("html", "<figure class=\"" .. class .. "\">"))
el:insert(pandoc.Link(images[1], images[1].src, nil, { class = "c-figure__link" }))
el:insert(pandoc.RawBlock("html", "</figure>"))
return common.wide(el)
end
function Div(el)
if el.classes:includes("alert") then
el = alert(el)
elseif el.classes:includes("figure") then
el = figure(el)
end
return el
end
function meta(meta) vars = meta end
return { { Meta = meta }, { Div = Div } }
|