Remplacer has_class par méthode Pandoc.List:includes
This commit is contained in:
parent
3e782fe447
commit
de094f0f49
|
@ -205,26 +205,12 @@ local function labelize_span(span)
|
|||
end
|
||||
end
|
||||
|
||||
local function has_class(elem, class)
|
||||
if elem.classes then
|
||||
for i = 1, #elem.classes do
|
||||
if elem.classes[i] == class then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
else
|
||||
error('function has_class used on an element of type ' ..
|
||||
elem.t .. ' that cannot have classes.')
|
||||
end
|
||||
end
|
||||
|
||||
local current_note_labels = {}
|
||||
|
||||
local collect_note_labels = {
|
||||
Span = function(span)
|
||||
if span.identifier ~= '' and
|
||||
(config.only_explicit_labels == 'false' or has_class(span, 'label'))
|
||||
(config.only_explicit_labels == 'false' or span.classes:includes('label'))
|
||||
then
|
||||
table.insert(current_note_labels, span.identifier)
|
||||
end
|
||||
|
@ -435,7 +421,7 @@ local function format_reference(target, info_type)
|
|||
end
|
||||
|
||||
local function make_reference(span)
|
||||
if has_class(span, 'ref') then
|
||||
if span.classes:includes('ref') then
|
||||
local target = analyze_reference_span(span)
|
||||
if not target.is_external then
|
||||
local info_type = span.attributes.type or config.default_info_type
|
||||
|
|
Loading…
Reference in New Issue
Block a user