csl-clio/Filtres-Pandoc/suppress-column-label-patrologia.lua~

33 lines
1.0 KiB
Lua
Raw Normal View History

2021-04-15 22:02:49 +01:00
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