csl-clio/Filtres-Pandoc/suppress-column-label-patrologia.lua~
2021-04-15 23:02:49 +02:00

33 lines
1.0 KiB
Lua
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local function isPatrologiaReference(first, second, third, last)
return first.t == 'Emph'
and (
(
#first.content == 3
and string.match(first.content[1].text, '^Patrologi[ea]$')
and first.content[2].t == 'Space'
and first.content[3].t == 'Str'
and string.match('|grecque|Graeca|latine|Latina|orientale|orientalis|', '|' .. first.content[3].text .. '|')
)
or
(
#first.content == 1
and first.content[1].t == 'Str'
and string.match('|PG|PL|PO|', '|' .. first.content[1].text .. '|')
)
)
and (second.t == 'Str'
and string.match(second.c, '^ [0-9]+,$')
and third.t == 'Space'
and last.t == 'Str'
and string.match(last.c, '^col. $'))
end
function Inlines (inlines)
for i = #inlines, 6, -1 do
if isPatrologiaReference(inlines[i-3], inlines[i-2], inlines[i-1], inlines[i]) then
inlines:remove(i)
end
end
return inlines
end