@@ -75,6 +75,17 @@ local header_code = {
7575]] ,
7676}
7777
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+
7889--- Add a block to the document's header-includes meta-data field.
7990-- @param meta the document's metadata block
8091-- @param blocks list of Pandoc block elements (e.g. RawBlock or Para)
@@ -87,7 +98,7 @@ local function add_header_includes(meta, blocks)
8798 -- add any exisiting meta['header-includes']
8899 -- it could be a MetaList or a single String
89100 if meta [' header-includes' ] then
90- if meta [' header-includes' ]. t == ' MetaList ' then
101+ if type ( meta [' header-includes' ]) == ' List ' then
91102 header_includes :extend (meta [' header-includes' ])
92103 else
93104 header_includes :insert (meta [' header-includes' ])
@@ -132,10 +143,10 @@ function process_metadata(meta)
132143
133144 if (user_options [' remove-after' ]) then
134145
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
137148
138- if user_options [' remove-after' ]. t == ' MetaInlines ' then
149+ if type ( user_options [' remove-after' ]) == ' Inlines ' then
139150
140151 options .remove_indent_after :insert (
141152 utils .stringify (user_options [' remove-after' ]))
@@ -155,13 +166,13 @@ function process_metadata(meta)
155166
156167 if (user_options [' dont-remove-after' ]) then
157168
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
160171
161172 -- list of strings to be removed
162173 local blacklist = pandoc .List ({})
163174
164- if user_options [' dont-remove-after' ]. t == ' MetaInlines ' then
175+ if type ( user_options [' dont-remove-after' ]) == ' Inlines ' then
165176
166177 blacklist :insert (
167178 utils .stringify (user_options [' dont-remove-after' ]))
0 commit comments