Skip to content

Commit 89e0113

Browse files
committed
revealjs-codeblock: fix filter for pandoc 2.16.1 & Lua 5.3.3 combo
The filter already worked with pandoc 2.16.1, but only when compiled with Lua 5.3.6. The Lua interpreter included in Ubuntu doesn't allow non-table values as arguments to `ipairs`.
1 parent 0b05213 commit 89e0113

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

revealjs-codeblock/revealjs-codeblock.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ local function is_pre_tag_attribute(attribute)
2424
end
2525

2626
local function is_data_line_number_in_attributes(attributes)
27-
for _, attribute in ipairs(attributes) do
28-
if attribute[1] == 'data-line-numbers' then return true end
27+
for k in pairs(attributes) do
28+
if k == 'data-line-numbers' then return true end
2929
end
3030
return false
3131
end
@@ -54,10 +54,9 @@ function CodeBlock(block)
5454
table.concat(css_classes, ' '))
5555
table.insert(code_tag_attributes, class_attribute)
5656
end
57-
for _, attribute in ipairs(block.attributes) do
58-
attribute_string = string.format('%s="%s"', attribute[1],
59-
attribute[2])
60-
if is_pre_tag_attribute(attribute[1]) then
57+
for k, v in pairs(block.attributes) do
58+
attribute_string = string.format('%s="%s"', k, v)
59+
if is_pre_tag_attribute(k) then
6160
table.insert(pre_tag_attributes, attribute_string)
6261
else
6362
table.insert(code_tag_attributes, attribute_string)

0 commit comments

Comments
 (0)