blob: 1159988104e80ec888fcabe2f4274d50133dad26 (
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
|
if FORMAT:match 'latex' then
-- Setting custom `listings` style
function Meta(m)
m["header-includes"] = pandoc.MetaBlocks({pandoc.RawBlock("latex",[[
\lstdefinestyle{weaver}{
basicstyle=\small\ttfamily,
backgroundcolor=\color{gray!10},
xleftmargin=0.5cm,
numbers=left,
numbersep=5pt,
numberstyle=\tiny\color{gray},
captionpos=b
}
\lstset{style=weaver}
]])})
return m
end
function CodeBlock(b)
-- Remove `path` attribute and merge it with `id`
if b.attributes.path and b.identifier then
b.identifier = b.attributes.path .. b.identifier
b.attributes.path = nil
end
-- Add ID to caption
if b.identifier then
if b.attributes.caption then
b.attributes.caption = b.identifier .. ": " .. b.attributes.caption
else
b.attributes.caption = b.identifier
end
end
return b
end
end
|