-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypst-cv.lua
48 lines (44 loc) · 1.92 KB
/
typst-cv.lua
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
46
47
48
local pandoc = require 'pandoc'
function Header(el)
-- Check if the header has attributes
if el.attributes then
-- Create a list for Typst raw blocks
local typst_blocks = {}
for key, value in pairs(el.attributes) do
if key == "date" then
table.insert(typst_blocks, pandoc.RawBlock("typst", "#body-side(["))
table.insert(typst_blocks, el)
table.insert(typst_blocks,
pandoc.RawBlock("typst", string.format("], side: company-location()[%s])", value)))
return typst_blocks
elseif key == "location" then
table.insert(typst_blocks, pandoc.RawBlock("typst", "#body-side(["))
table.insert(typst_blocks, el)
table.insert(typst_blocks, pandoc.RawBlock("typst", string.format("], side: event-date()[%s])", value)))
return typst_blocks
elseif key == "photo" then
table.insert(typst_blocks, pandoc.RawBlock("typst", "#body-side(["))
table.insert(typst_blocks, el)
table.insert(typst_blocks,
pandoc.RawBlock("typst", string.format("], side: profile-photo(%s))", value)))
return typst_blocks
end
end
end
if el.classes:includes("hidden") then
local typst_blocks = {}
table.insert(typst_blocks, pandoc.RawBlock("typst", "#hidden-heading()["))
table.insert(typst_blocks, el)
table.insert(typst_blocks, pandoc.RawBlock("typst", "]"))
return typst_blocks
end
-- If no attributes or no matching key, return the header unchanged
return el
end
function OrderedList(el)
local typst_blocks = {}
table.insert(typst_blocks, pandoc.RawBlock("typst", "#block(width: full-width)["))
table.insert(typst_blocks, el)
table.insert(typst_blocks, pandoc.RawBlock("typst", "]"))
return typst_blocks
end