Method: IsoDoc::Function::XrefGen#sequential_figure_names

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

#sequential_figure_names(clause) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/isodoc/function/xref_gen.rb', line 131

def sequential_figure_names(clause)
  i = j = 0
  clause.xpath(ns(".//figure")).each do |t|
    if t.parent.name == "figure" then j += 1
    else
      j = 0
      i += 1
    end
    label = i.to_s + (j.zero? ? "" : "-#{j}")
    next if t["id"].nil? || t["id"].empty?
    @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure")
  end
end