Class: IsoDoc::JIS::Xref

Inherits:
Iso::Xref
  • Object
show all
Defined in:
lib/isodoc/jis/xref.rb

Instance Method Summary collapse

Instance Method Details

#annex_name_lbl(clause, num) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/isodoc/jis/xref.rb', line 7

def annex_name_lbl(clause, num)
  obl = l10n("(#{@labels['inform_annex']})")
  clause["obligation"] == "normative" and
    obl = l10n("(#{@labels['norm_annex']})")
  title = Common::case_with_markup(@labels["annex"], "capital", @script)
  l10n("#{title} #{num}<br/>#{obl}")
end

#back_anchor_names(xml) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/isodoc/jis/xref.rb', line 15

def back_anchor_names(xml)
  if @parse_settings.empty? || @parse_settings[:clauses]
    i = Counter.new("@")
    xml.xpath(ns("//annex")).each do |c|
      if c["commentary"] == "true"
        commentary_names(c)
      else
        annex_names(c, i.increment(c).print)
      end
    end
    xml.xpath(ns(@klass.bibliography_xpath)).each do |b|
      preface_names(b)
    end
    xml.xpath(ns("//colophon/clause")).each { |b| preface_names(b) }
    xml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
  end
  references(xml) if @parse_settings.empty? || @parse_settings[:refs]
end

#commentary_name_anchors(clause, num, root, level) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/isodoc/jis/xref.rb', line 49

def commentary_name_anchors(clause, num, root, level)
  @anchors[clause["id"]] =
    { label: num, xref: l10n("#{@labels['clause']} #{num}"),
      container: root,
      title: clause_title(clause), level: level, type: "clause",
      elem: @labels["clause"] }
end

#commentary_names(clause) ⇒ Object



34
35
36
37
38
39
# File 'lib/isodoc/jis/xref.rb', line 34

def commentary_names(clause)
  preface_name_anchors(clause, 1, clause_title(clause))
  clause.xpath(ns(SUBCLAUSES)).each_with_object(Counter.new) do |c, i|
    commentary_names1(c, clause["id"], i.increment(c).print, 2)
  end
end

#commentary_names1(clause, root, num, level) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/isodoc/jis/xref.rb', line 41

def commentary_names1(clause, root, num, level)
  commentary_name_anchors(clause, num, root, level)
  clause.xpath(ns(SUBCLAUSES)).each_with_object(Counter.new) do |c, i|
    commentary_names1(c, root, "#{num}.#{i.increment(c).print}",
                      level + 1)
  end
end