Skip to content

Commit 6766e2c

Browse files
Merge pull request #16 from kazuyanagimoto/dev
fix #15
2 parents 0114e54 + eaab93f commit 6766e2c

2 files changed

Lines changed: 9 additions & 29 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ _site/
66
.Rproj.user
77
.Renviron
88
.DS_Store
9-
air.toml
9+
air.toml
10+
**/*.quarto_ipynb

_extensions/awesomecv/input-yaml.lua

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
local function parse_yaml(content)
22
local data = {}
3-
local key = nil
43
local item = {}
54
local in_details = false
65

@@ -11,10 +10,10 @@ local function parse_yaml(content)
1110
if line_trimmed == "" then
1211
-- Skip empty lines
1312
elseif indent_level == 0 and line_trimmed:match("^[%w_-]+:$") then
14-
if key and next(item) then
15-
data[key] = item
13+
-- New entry starts, save the previous one if it exists
14+
if next(item) then
15+
table.insert(data, item)
1616
end
17-
key = line_trimmed:gsub(":$", "")
1817
item = {}
1918
in_details = false
2019
elseif indent_level > 0 and line_trimmed:match("^title:%s*(.+)") then
@@ -37,37 +36,17 @@ local function parse_yaml(content)
3736
end
3837

3938
-- Add the last item
40-
if key and next(item) then
41-
data[key] = item
39+
if next(item) then
40+
table.insert(data, item)
4241
end
4342

4443
return data
4544
end
4645

4746
local function construct_entry(data)
4847
local typst_code = {}
49-
50-
-- Convert table to array if it's a dictionary
51-
local entries = {}
52-
if data and type(data) == "table" then
53-
-- Check if it's a dictionary (has string keys)
54-
local is_dict = false
55-
for k, v in pairs(data) do
56-
if type(k) == "string" then
57-
is_dict = true
58-
break
59-
end
60-
end
61-
62-
if is_dict then
63-
-- Convert dictionary values to array
64-
for k, v in pairs(data) do
65-
table.insert(entries, v)
66-
end
67-
else
68-
entries = data
69-
end
70-
end
48+
49+
local entries = data or {}
7150

7251
for _, item in ipairs(entries) do
7352
local entry_parts = {}

0 commit comments

Comments
 (0)