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

53 lines
1.9 KiB
Lua
Raw Normal View History

2021-04-15 22:02:49 +01:00
--[[
************************************************************************
* Copyright 2021 by Bastien Dumont (bastien.dumont@posteo.net)
*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this file. If not, see <https://www.gnu.org/licenses/>.
*
************************************************************************
]]--
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.text, '^ [0-9]+,$')
2021-04-15 22:02:49 +01:00
and third.t == 'Space'
and last.t == 'Str'
and string.match(last.text, '^col. $'))
2021-04-15 22:02:49 +01:00
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