text-crossrefs: coding improvements

This commit is contained in:
Bastien Dumont
2025-12-21 20:40:26 +01:00
parent af22b6e167
commit 73ddd5becf

View File

@ -133,7 +133,7 @@ local function format_config_to_openxml()
end
local function set_configuration_item_from_metadata(item, metamap)
metakey = 'tcrf-' .. string.gsub(item, '_', '-')
local metakey = 'tcrf-' .. string.gsub(item, '_', '-')
if metamap[metakey] then
if IS_CONFIG_ARRAY[item] then
-- The metadata values is a list of MetaInlines,
@ -258,7 +258,7 @@ end
local function labelize_span(span)
if span.identifier ~= '' then
local label = span.identifier
local label_begin = make_label(label, 'begin')
local label_begin = make_label(label)
return { label_begin, span }
end
end
@ -311,7 +311,7 @@ local function map_text_to_note_labels(labels_in_current_note)
end
end
function set_notelabels(note)
local function set_notelabels(note)
local labels_in_current_note = {}
note:walk(collect_note_labels(labels_in_current_note))
if #labels_in_current_note > 0 then
@ -350,7 +350,7 @@ local function parse_possible_range(reference)
-- If reference is a string representing a range,
-- returns the strings representing the boundaries of the range.
-- Else, returns the string.
local range_first, range_second = nil
local range_first, range_second = nil, nil
local delim_beg, delim_end = string.find(reference,
config.references_range_separator,
1, true)
@ -364,6 +364,7 @@ end
local function parse_next_reference(raw_references, beg_of_search)
-- Returns the ref corresponding to the next reference string
-- and the index which the parsing should be resumed at.
-- Returns false if there is no reference string left.
local current_ref = false
local next_ref_beg = nil
if beg_of_search < #raw_references then