Method: IsoDoc::Function::XrefGen#termexample_anchor_names

Defined in:
lib/isodoc/function/xref_gen.rb

#termexample_anchor_names(docxml) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/isodoc/function/xref_gen.rb', line 29

def termexample_anchor_names(docxml)
  docxml.xpath(ns("//term[descendant::termexample]")).each do |t|
    examples = t.xpath(ns(".//termexample"))
    examples.each_with_index do |n, i|
      return if n["id"].nil? || n["id"].empty?
      idx = examples.size == 1 ? "" : (i + 1).to_s
      @anchors[n["id"]] = {
        type: "termexample",
        label: idx, xref: l10n("#{@anchors.dig(t['id'], :xref)}, "\
                               "#{@note_xref_lbl} #{i + 1}") }
    end
  end
end