1
- inventory = {
2
- mutate = ' https://siuba.org/api/verbs-mutate-transmute/' ,
3
- [' plotnine.positions.position.position' ] = ' someurl'
4
- }
1
+ inventory = {}
2
+ traverse = ' topdown'
5
3
6
4
-- from https://stackoverflow.com/a/7615129/1144523
7
5
function str_split (inputstr , sep )
8
6
if sep == nil then
9
- sep = " %s"
7
+ sep = " %s"
10
8
end
11
9
local t = {}
12
10
for str in string.gmatch (inputstr , " ([^" .. sep .. " ]+)" ) do
@@ -16,13 +14,25 @@ function str_split (inputstr, sep)
16
14
end
17
15
18
16
17
+ function Meta (meta )
18
+ for k , v in pairs (meta .interlinks .sources ) do
19
+ local json = quarto .json .decode (read_file_contents (v .fallback ))
20
+ for inv_k , inv_v in pairs (json .items ) do
21
+ inventory [inv_v .name ] = inv_v
22
+ end
23
+ end
24
+
25
+ -- print(quarto.utils.dump(inventory))
26
+
27
+ end
28
+
29
+
19
30
-- Reformat all heading text
20
31
function Header (el )
21
32
el .content = pandoc .Emph (el .content )
22
33
return el
23
34
end
24
35
25
-
26
36
function Code (el )
27
37
if el .attr .classes :find (" ref" ) == nil then
28
38
return el
@@ -40,8 +50,11 @@ function Code(el)
40
50
end
41
51
42
52
dst = inventory [ref_name ]
53
+ -- print(type(ref_name))
54
+ -- print("DST ====")
55
+ -- print(quarto.utils.dump(inventory))
43
56
if dst ~= nil then
44
- return pandoc .Link (out_name , dst )
57
+ return pandoc .Link (out_name , dst . uri )
45
58
end
46
59
47
60
return el
@@ -59,20 +72,6 @@ function map(tbl, fn)
59
72
return result
60
73
end
61
74
62
- local inventory = {}
63
- function Meta (meta )
64
- for k , v in pairs (meta .interlinks .sources ) do
65
- print (k )
66
- print (pandoc .utils .stringify (v .fallback ))
67
- local json = quarto .json .decode (read_file_contents (v .fallback ))
68
- for inv_k , inv_v in pairs (json .items ) do
69
- inventory [inv_v .name ] = inv_v
70
- end
71
- end
72
- quarto .utils .dump (inventory )
73
-
74
- end
75
-
76
75
function read_file_contents (file )
77
76
local f = io.open (pandoc .utils .stringify (file ), " r" )
78
77
if f == nil then
0 commit comments