metanorma-iho 0.5.3 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,25 +6,27 @@ module IsoDoc
6
6
  end
7
7
 
8
8
  class Xref < IsoDoc::Generic::Xref
9
+ def annexlbl(cond)
10
+ cond ? @labels["appendix"] : @labels["annex"]
11
+ end
12
+
9
13
  def annex_name_lbl(clause, num)
10
- lbl = clause["obligation"] == "informative" ?
11
- @labels["appendix"] : @labels["annex"]
14
+ lbl = annexlbl(clause["obligation"] == "informative")
12
15
  l10n("<strong>#{lbl} #{num}</strong>")
13
16
  end
14
17
 
15
18
  def annex_names(clause, num)
16
19
  appendix_names(clause, num)
17
- lbl = clause["obligation"] == "informative" ?
18
- @labels["appendix"] : @labels["annex"]
20
+ lbl = annexlbl(clause["obligation"] == "informative")
19
21
  @anchors[clause["id"]] =
20
- { label: annex_name_lbl(clause, num), type: "clause",
21
- xref: l10n("#{lbl} #{num}"), level: 1, value: lbl }
22
+ { label: annex_name_lbl(clause, num), type: "clause", elem: lbl,
23
+ xref: l10n("#{lbl} #{num}"), level: 1, value: num }
22
24
  if a = single_annex_special_section(clause)
23
- annex_names1(a, "#{num}", 1)
25
+ annex_names1(a, num.to_s, 1)
24
26
  else
25
27
  i = Counter.new
26
- clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
27
- each do |c|
28
+ clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
29
+ .each do |c|
28
30
  i.increment(c)
29
31
  annex_names1(c, "#{num}.#{i.print}", 2)
30
32
  end
@@ -35,36 +37,36 @@ module IsoDoc
35
37
  def back_anchor_names(docxml)
36
38
  super
37
39
  i = Counter.new
38
- docxml.xpath(ns("//annex[@obligation = 'informative']")).
39
- each do |c|
40
+ docxml.xpath(ns("//annex[@obligation = 'informative']"))
41
+ .each do |c|
40
42
  i.increment(c)
41
43
  annex_names(c, i.print)
42
44
  end
43
45
  i = Counter.new("@", skip_i: true)
44
- docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).
45
- each do |c|
46
+ docxml.xpath(ns("//annex[not(@obligation = 'informative')]"))
47
+ .each do |c|
46
48
  i.increment(c)
47
49
  annex_names(c, i.print)
48
50
  end
49
51
  end
50
52
 
51
53
  def annex_names1(clause, num, level)
52
- lbl = clause.at("./ancestor::xmlns:annex/@obligation").
53
- text == "informative" ? @labels["appendix"] : @labels["annex"]
54
+ lbl = annexlbl(clause.at("./ancestor::xmlns:annex/@obligation")
55
+ .text == "informative")
54
56
  @anchors[clause["id"]] =
55
57
  { label: num, xref: l10n("#{lbl} #{num}"),
56
58
  level: level, type: "clause" }
57
- i = Counter.new
58
- clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
59
- each do |c|
59
+ i = Counter.new
60
+ clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
61
+ .each do |c|
60
62
  i.increment(c)
61
63
  annex_names1(c, "#{num}.#{i.print}", level + 1)
62
64
  end
63
65
  end
64
66
 
65
- def appendix_names(clause, num)
66
- i = Counter.new
67
- clause.xpath(ns("./appendix")).each_with_index do |c|
67
+ def appendix_names(clause, _num)
68
+ i = Counter.new
69
+ clause.xpath(ns("./appendix")).each do |c|
68
70
  i.increment(c)
69
71
  @anchors[c["id"]] =
70
72
  anchor_struct(i.print, nil, @labels["appendix"], "clause")
@@ -73,16 +75,17 @@ module IsoDoc
73
75
  end
74
76
  end
75
77
 
76
- def section_names1(clause, num, level)
77
- @anchors[clause["id"]] =
78
- { label: num, level: level, xref: l10n("#{@labels["subclause"]} #{num}"),
79
- type: "clause" }
80
- i = Counter.new
81
- clause.xpath(ns(SUBCLAUSES)).each_with_index do |c|
82
- i.increment(c)
83
- section_names1(c, "#{num}.#{i.print}", level + 1)
78
+ def section_names1(clause, num, level)
79
+ @anchors[clause["id"]] =
80
+ { label: num, level: level,
81
+ xref: l10n("#{@labels['subclause']} #{num}"),
82
+ type: "clause", elem: @labels["subclause"] }
83
+ i = Counter.new
84
+ clause.xpath(ns(SUBCLAUSES)).each do |c|
85
+ i.increment(c)
86
+ section_names1(c, "#{num}.#{i.print}", level + 1)
87
+ end
84
88
  end
85
89
  end
86
- end
87
90
  end
88
91
  end
@@ -152,9 +152,7 @@
152
152
  <data type="boolean"/>
153
153
  </attribute>
154
154
  </optional>
155
- <oneOrMore>
156
- <ref name="PureTextElement"/>
157
- </oneOrMore>
155
+ <ref name="XrefBody"/>
158
156
  </element>
159
157
  </define>
160
158
  <define name="erefType">
@@ -188,6 +186,42 @@
188
186
  <ref name="PureTextElement"/>
189
187
  </oneOrMore>
190
188
  </define>
189
+ <define name="localityStack">
190
+ <element name="localityStack">
191
+ <optional>
192
+ <attribute name="connective">
193
+ <choice>
194
+ <value>and</value>
195
+ <value>or</value>
196
+ <value>from</value>
197
+ <value>to</value>
198
+ <value/>
199
+ </choice>
200
+ </attribute>
201
+ </optional>
202
+ <zeroOrMore>
203
+ <ref name="locality"/>
204
+ </zeroOrMore>
205
+ </element>
206
+ </define>
207
+ <define name="sourceLocalityStack">
208
+ <element name="sourceLocalityStack">
209
+ <optional>
210
+ <attribute name="connective">
211
+ <choice>
212
+ <value>and</value>
213
+ <value>or</value>
214
+ <value>from</value>
215
+ <value>to</value>
216
+ <value/>
217
+ </choice>
218
+ </attribute>
219
+ </optional>
220
+ <zeroOrMore>
221
+ <ref name="sourceLocality"/>
222
+ </zeroOrMore>
223
+ </element>
224
+ </define>
191
225
  <define name="ul">
192
226
  <element name="ul">
193
227
  <attribute name="id">
@@ -1098,6 +1132,16 @@
1098
1132
  </define>
1099
1133
  </include>
1100
1134
  <!-- end overrides -->
1135
+ <define name="image" combine="choice">
1136
+ <element name="svg">
1137
+ <oneOrMore>
1138
+ <choice>
1139
+ <text/>
1140
+ <ref name="AnyElement"/>
1141
+ </choice>
1142
+ </oneOrMore>
1143
+ </element>
1144
+ </define>
1101
1145
  <define name="MultilingualRenderingType">
1102
1146
  <choice>
1103
1147
  <value>common</value>
@@ -2631,4 +2675,30 @@
2631
2675
  </zeroOrMore>
2632
2676
  </element>
2633
2677
  </define>
2678
+ <define name="XrefBody">
2679
+ <zeroOrMore>
2680
+ <ref name="XrefTarget"/>
2681
+ </zeroOrMore>
2682
+ <oneOrMore>
2683
+ <ref name="PureTextElement"/>
2684
+ </oneOrMore>
2685
+ </define>
2686
+ <define name="XrefTarget">
2687
+ <element name="location">
2688
+ <attribute name="target">
2689
+ <data type="string">
2690
+ <param name="pattern">\i\c*|\c+#\c+</param>
2691
+ </data>
2692
+ </attribute>
2693
+ <attribute name="connective">
2694
+ <choice>
2695
+ <value>and</value>
2696
+ <value>or</value>
2697
+ <value>from</value>
2698
+ <value>to</value>
2699
+ <value/>
2700
+ </choice>
2701
+ </attribute>
2702
+ </element>
2703
+ </define>
2634
2704
  </grammar>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.5.3".freeze
3
+ VERSION = "0.5.6".freeze
4
4
  end
5
5
  end
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: 0.5.3
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-02-07 00:00:00.000000000 Z
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubygems_version: 3.2.32
263
+ rubygems_version: 3.3.9
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: metanorma-iho lets you write IHO in AsciiDoc.