metanorma-iho 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,8 +23,8 @@ module IsoDoc
23
23
  end
24
24
 
25
25
  def bibrenderer(options = {})
26
- ::Relaton::Render::Iho::General.new(options.merge(language: @lang,
27
- i18nhash: @i18n.get))
26
+ ::Relaton::Render::Iho::General.new(options
27
+ .merge(language: @lang, i18nhash: @i18n.get))
28
28
  end
29
29
 
30
30
  def info(isoxml, out)
@@ -18,15 +18,15 @@ _bib)
18
18
  def middle_title(docxml); end
19
19
 
20
20
  def preface_rearrange(doc)
21
- preface_move(doc.at(ns("//preface/abstract")),
21
+ preface_move(doc.xpath(ns("//preface/abstract")),
22
22
  %w(foreword executivesummary introduction clause acknowledgements), doc)
23
- preface_move(doc.at(ns("//preface/foreword")),
23
+ preface_move(doc.xpath(ns("//preface/foreword")),
24
24
  %w(executivesummary introduction clause acknowledgements), doc)
25
- preface_move(doc.at(ns("//preface/executivesummary")),
25
+ preface_move(doc.xpath(ns("//preface/executivesummary")),
26
26
  %w(introduction clause acknowledgements), doc)
27
- preface_move(doc.at(ns("//preface/introduction")),
27
+ preface_move(doc.xpath(ns("//preface/introduction")),
28
28
  %w(clause acknowledgements), doc)
29
- preface_move(doc.at(ns("//preface/acknowledgements")),
29
+ preface_move(doc.xpath(ns("//preface/acknowledgements")),
30
30
  %w(), doc)
31
31
  end
32
32
 
@@ -117,10 +117,6 @@ _bib)
117
117
  end
118
118
  end
119
119
 
120
- def clausedelim
121
- ""
122
- end
123
-
124
120
  def omit_docid_prefix(prefix)
125
121
  prefix == "IHO" and return true
126
122
  super
@@ -139,6 +135,15 @@ _bib)
139
135
  defn.elements.last << s
140
136
  end
141
137
 
138
+ def clausedelim
139
+ ""
140
+ end
141
+
142
+ def clause(docxml)
143
+ super
144
+ docxml.xpath(ns("//executivesummary | //appendix")).each { |x| clause1(x) }
145
+ end
146
+
142
147
  include Init
143
148
  end
144
149
  end
@@ -16,17 +16,19 @@ module IsoDoc
16
16
 
17
17
  def annex_name_lbl(clause, num)
18
18
  lbl = annexlbl(clause["obligation"] == "informative")
19
- l10n("<strong>#{lbl} #{num}</strong>")
19
+ s = labelled_autonum(lbl, num)
20
+ l10n("<strong>#{s}</strong>")
20
21
  end
21
22
 
22
23
  def annex_names(clause, num)
23
- appendix_names(clause, num)
24
- lbl = annexlbl(clause["obligation"] == "informative")
24
+ lbl = semx(clause, num)
25
+ appendix_names(clause, lbl)
26
+ elem = annexlbl(clause["obligation"] == "informative")
25
27
  @anchors[clause["id"]] =
26
- { label: annex_name_lbl(clause, num), type: "clause", elem: lbl,
27
- xref: l10n("#{lbl} #{num}"), level: 1, value: num }
28
+ { label: annex_name_lbl(clause, lbl), type: "clause", elem: elem,
29
+ xref: labelled_autonum(elem, lbl), level: 1, value: num }
28
30
  annex_names_recurse(clause, num)
29
- annex_asset_names(clause, num, lbl)
31
+ annex_asset_names(clause, num, elem)
30
32
  end
31
33
 
32
34
  def annex_names_recurse(clause, num)
@@ -37,20 +39,25 @@ module IsoDoc
37
39
  clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
38
40
  .each do |c|
39
41
  i.increment(c)
40
- annex_names1(c, "#{num}.#{i.print}", 2)
42
+ annex_names1(c, semx(clause, num), i.print, 2)
41
43
  end
42
44
  end
43
45
 
46
+ # avoid ambiguity of Table 1-1 being in Appendix 1 or Clause 1
44
47
  def annex_asset_names(clause, num, lbl)
45
- @annex_prefix = lbl
46
- hierarchical_asset_names(clause, num)
47
- @annex_prefix = nil
48
+ #@annex_prefix = lbl
49
+ #require "debug"; binding.b
50
+ #hierarchical_asset_names(clause, num)
51
+ n = num
52
+ clause["obligation"] == "informative" and n = labelled_autonum(lbl, num)
53
+ hierarchical_asset_names(clause, n)
54
+ #@annex_prefix = nil
48
55
  end
49
56
 
50
- def anchor_struct_value(lbl, elem)
51
- @annex_prefix and lbl = l10n("#{@annex_prefix} #{lbl}")
52
- super
53
- end
57
+ #def anchor_struct_value(lbl, elem)
58
+ #@annex_prefix and lbl = l10n("<span class='fmt-element-name'>#{@annex_prefix}</span> #{lbl}")
59
+ #super
60
+ #end
54
61
 
55
62
  def clause_order_main(docxml)
56
63
  if docxml.at(ns("//bibliography//references[@normative = 'true']")) ||
@@ -79,7 +86,7 @@ module IsoDoc
79
86
 
80
87
  def annex_anchor_names(docxml)
81
88
  clause_order_annex(docxml).each_with_index do |a, i|
82
- n = i.zero? ? Counter.new("@", skip_i: true) : Counter.new
89
+ n = i.zero? ? Counter.new("@") : Counter.new
83
90
  docxml.xpath(ns(a[:path]))
84
91
  .each do |c|
85
92
  annex_names(c, n.increment(c).print)
@@ -88,16 +95,17 @@ module IsoDoc
88
95
  end
89
96
  end
90
97
 
91
- def annex_names1(clause, num, level)
92
- lbl = annexlbl(clause.at("./ancestor::xmlns:annex/@obligation")
98
+ def annex_names1(clause, parentnum, num, level)
99
+ elem = annexlbl(clause.at("./ancestor::xmlns:annex/@obligation")
93
100
  .text == "informative")
101
+ lbl = clause_number_semx(parentnum, clause, num)
94
102
  @anchors[clause["id"]] =
95
- { label: num, xref: l10n("#{lbl} #{num}"),
103
+ { label: lbl, xref: labelled_autonum(elem, lbl),
96
104
  level: level, type: "clause" }
97
- i = Counter.new(0, prefix: num)
105
+ i = Counter.new(0)
98
106
  clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
99
107
  .each do |c|
100
- annex_names1(c, i.increment(c).print, level + 1)
108
+ annex_names1(c, lbl, i.increment(c).print, level + 1)
101
109
  end
102
110
  end
103
111
 
@@ -106,20 +114,22 @@ module IsoDoc
106
114
  clause.xpath(ns("./appendix")).each do |c|
107
115
  i.increment(c)
108
116
  @anchors[c["id"]] =
109
- anchor_struct(i.print, nil, @labels["appendix"], "clause")
117
+ anchor_struct(i.print, c, @labels["appendix"], "clause", { container: true })
110
118
  @anchors[c["id"]][:level] = 2
111
119
  @anchors[c["id"]][:container] = clause["id"]
112
120
  end
113
121
  end
114
122
 
115
- def section_names1(clause, num, level)
123
+ def section_names1(clause, parentnum, num, level)
124
+ lbl = clause_number_semx(parentnum, clause, num)
116
125
  @anchors[clause["id"]] =
117
- { label: num, level: level,
118
- xref: l10n("#{@labels['subclause']} #{num}"),
126
+ { label: lbl, level: level,
127
+ #xref: l10n("#{@labels['subclause']} #{num}"),
128
+ xref: labelled_autonum(@labels['subclause'], lbl),
119
129
  type: "clause", elem: @labels["subclause"] }
120
- i = Counter.new(0, prefix: num)
130
+ i = Counter.new(0)
121
131
  clause.xpath(ns(SUBCLAUSES)).each do |c|
122
- section_names1(c, i.increment(c).print, level + 1)
132
+ section_names1(c, lbl, i.increment(c).print, level + 1)
123
133
  end
124
134
  end
125
135
 
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.4.0 -->
20
+ <!-- VERSION v1.4.1 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iho
3
- VERSION = "1.0.8".freeze
3
+ VERSION = "1.0.9".freeze
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
29
29
 
30
- spec.add_dependency "metanorma-generic", "~> 2.7.2"
30
+ spec.add_dependency "metanorma-generic", "~> 2.7.3"
31
31
 
32
32
  spec.add_development_dependency "debug"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.2
19
+ version: 2.7.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.7.2
26
+ version: 2.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement