Commit 3c12a2b 1 parent 567c5be commit 3c12a2b Copy full SHA for 3c12a2b
File tree 1 file changed +19
-9
lines changed
1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -3,16 +3,26 @@ function Pandoc (doc)
3
3
-- `true` ensures that headings are numbered.
4
4
doc .blocks = pandoc .utils .make_sections (true , nil , doc .blocks )
5
5
6
- -- Shift the heading levels by 1
7
- doc .blocks = doc .blocks :walk {
8
- Header = function (h )
9
- if h .level > 2 then
10
- h .classes :insert ' unnumbered'
11
- end
12
- h .level = h .level + 1
13
- return h
6
+ -- Check if doc.blocks is not nil
7
+ if doc .blocks then
8
+ -- Check if walk method exists
9
+ if doc .blocks .walk then
10
+ -- Shift the heading levels by 1
11
+ doc .blocks = doc .blocks :walk {
12
+ Header = function (h )
13
+ if h .level > 2 then
14
+ h .classes :insert ' unnumbered'
15
+ end
16
+ h .level = h .level + 1
17
+ return h
18
+ end
19
+ }
20
+ else
21
+ print (" Error: walk method does not exist" )
14
22
end
15
- }
23
+ else
24
+ print (" Error: doc.blocks is nil" )
25
+ end
16
26
17
27
-- Return the modified document
18
28
return doc
You can’t perform that action at this time.
0 commit comments