metanorma / metanorma-iso

Metanorma processor for ISO standards
BSD 2-Clause "Simplified" License
13 stars 5 forks source link

Inconsistent xrefs to list items #1159

Closed opoudjis closed 3 months ago

opoudjis commented 3 months ago

We are getting:

Clause 1 a) Clause 2, List 1 a) Clause 2, List 2 a) Clause 2 List 1 a) 1)

That's because the criterion on when to insert the comma is triggered in prefix_container_template(container, node, target) as:

        nested_xref = @i18n.nested_xref # %1, %2"
        container_label = anchor_xref(node, container)
        if @xrefs.anchor(target, :type) == "listitem" &&
            !@xrefs.anchor(target, :refer_list)
          nested_xref = "%1 %2"
          # n = @xrefs.anchor(container, :label) and container_label = n
        end

The comma is meant to be triggered if there are two lists in the clause; but that is being lost if the pointer is to a nested list.