Class: IsoDoc::Ribose::Xref

Inherits:
Generic::Xref
  • Object
show all
Defined in:
lib/isodoc/ribose/xref.rb

Instance Method Summary collapse

Instance Method Details

#annex_name_lblx(clause, num) ⇒ Object

KILL



10
11
12
13
14
15
# File 'lib/isodoc/ribose/xref.rb', line 10

def annex_name_lblx(clause, num)
  obl = l10n("(#{@labels['inform_annex']})")
  clause["obligation"] == "normative" and
    obl = l10n("(#{@labels['norm_annex']})")
  l10n("#{@labels['annex']} #{num}<br/>#{obl}")
end

#initial_anchor_names(doc) ⇒ Object



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

def initial_anchor_names(doc)
  super
  if blank?(@parse_settings) || @parse_settings[:clauses]
    introduction_names(doc.at(ns("//introduction")))
  end
  if blank?(@parse_settings)
    sequential_asset_names(
      doc.xpath(
        ns("//preface/abstract | //foreword | //introduction | " \
           "//preface/clause | //acknowledgements | //executivesummary"),
      ),
    )
  end
end

#introduction_names(clause) ⇒ Object

we can reference 0-number clauses in introduction



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/isodoc/ribose/xref.rb', line 73

def introduction_names(clause)
  clause.nil? and return
  clause.at(ns("./clause")) and
    @anchors[clause["id"]] = { label: nil, level: 1, type: "clause",
                               xref: clause.at(ns("./title"))&.text }
  #i = Counter.new(0, prefix: "0")
  i = Counter.new(0)
  clause.xpath(ns("./clause")).each do |c|
    section_names1(c, semx(clause, "0"), i.increment(c).print, 2)
  end
end

#introduction_namesx(clause) ⇒ Object

we can reference 0-number clauses in introduction # KILL



62
63
64
65
66
67
68
69
70
71
# File 'lib/isodoc/ribose/xref.rb', line 62

def introduction_namesx(clause)
  clause.nil? and return
  clause.at(ns("./clause")) and
    @anchors[clause["id"]] = { label: "0", level: 1, type: "clause",
                               xref: clause.at(ns("./title"))&.text }
  i = Counter.new(0, prefix: "0")
  clause.xpath(ns("./clause")).each do |c|
    section_names1(c, i.increment(c).print, 2)
  end
end

#section_name_anchors(clause, num, level) ⇒ Object

subclauses are not prefixed with “Clause” retaining subtype for the semantics



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/isodoc/ribose/xref.rb', line 46

def section_name_anchors(clause, num, level)
  if clause["type"] == "section"
    xref = labelled_autonum(@labels["section"], num)
    label = labelled_autonum(@labels["section"], num)
    @anchors[clause["id"]] =
      { label:, xref:, elem: @labels["section"],
        title: clause_title(clause), level: level, type: "clause" }
  elsif level > 1
    #num = semx(clause, num)
    @anchors[clause["id"]] =
      { label: num, level: level, xref: num, subtype: "clause" }
  else super end
end

#section_names1x(clause, num, level) ⇒ Object

KILL



33
34
35
36
37
38
39
40
41
42
# File 'lib/isodoc/ribose/xref.rb', line 33

def section_names1x(clause, num, level)
  @anchors[clause["id"]] =
    { label: num, level: level, xref: num }
  # subclauses are not prefixed with "Clause"
  i = Counter.new(0, prefix: num)
  clause.xpath(ns("./clause | ./terms | ./term | ./definitions | " \
                  "./references")).each do |c|
    section_names1(c, i.increment(c).print, level + 1)
  end
end