@@ -75,6 +75,17 @@ local header_code = {
75
75
]] ,
76
76
}
77
77
78
+ --- Returns the type of a metadata value.
79
+ --
80
+ -- @param v a metadata value
81
+ -- @return string one of Blocks, Inlines, List, table, string, or boolean.
82
+ local type = PANDOC_VERSION > ' 2.16.2'
83
+ and utils .type
84
+ or function (v )
85
+ local metatag = type (v ) == ' table' and v .t and v .t :gsub (' ^Meta' , ' ' )
86
+ return metatag and metatag ~= ' Map' and metatag or type (v )
87
+ end
88
+
78
89
--- Add a block to the document's header-includes meta-data field.
79
90
-- @param meta the document's metadata block
80
91
-- @param blocks list of Pandoc block elements (e.g. RawBlock or Para)
@@ -87,7 +98,7 @@ local function add_header_includes(meta, blocks)
87
98
-- add any exisiting meta['header-includes']
88
99
-- it could be a MetaList or a single String
89
100
if meta [' header-includes' ] then
90
- if meta [' header-includes' ]. t == ' MetaList ' then
101
+ if type ( meta [' header-includes' ]) == ' List ' then
91
102
header_includes :extend (meta [' header-includes' ])
92
103
else
93
104
header_includes :insert (meta [' header-includes' ])
@@ -132,10 +143,10 @@ function process_metadata(meta)
132
143
133
144
if (user_options [' remove-after' ]) then
134
145
135
- if user_options [' remove-after' ]. t == ' MetaInlines ' or
136
- user_options [' remove-after' ]. t == ' MetaList ' then
146
+ if type ( user_options [' remove-after' ]) == ' Inlines ' or
147
+ type ( user_options [' remove-after' ]) == ' List ' then
137
148
138
- if user_options [' remove-after' ]. t == ' MetaInlines ' then
149
+ if type ( user_options [' remove-after' ]) == ' Inlines ' then
139
150
140
151
options .remove_indent_after :insert (
141
152
utils .stringify (user_options [' remove-after' ]))
@@ -155,13 +166,13 @@ function process_metadata(meta)
155
166
156
167
if (user_options [' dont-remove-after' ]) then
157
168
158
- if user_options [' dont-remove-after' ]. t == ' MetaInlines ' or
159
- user_options [' dont-remove-after' ]. t == ' MetaList ' then
169
+ if type ( user_options [' dont-remove-after' ]) == ' Inlines ' or
170
+ type ( user_options [' dont-remove-after' ]) == ' List ' then
160
171
161
172
-- list of strings to be removed
162
173
local blacklist = pandoc .List ({})
163
174
164
- if user_options [' dont-remove-after' ]. t == ' MetaInlines ' then
175
+ if type ( user_options [' dont-remove-after' ]) == ' Inlines ' then
165
176
166
177
blacklist :insert (
167
178
utils .stringify (user_options [' dont-remove-after' ]))
0 commit comments