metanorma-mpfd 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -84,6 +84,9 @@
84
84
  <zeroOrMore>
85
85
  <ref name="docidentifier"/>
86
86
  </zeroOrMore>
87
+ <optional>
88
+ <ref name="docnumber"/>
89
+ </optional>
87
90
  <zeroOrMore>
88
91
  <ref name="bdate"/>
89
92
  </zeroOrMore>
@@ -163,6 +166,9 @@
163
166
  <zeroOrMore>
164
167
  <ref name="docidentifier"/>
165
168
  </zeroOrMore>
169
+ <optional>
170
+ <ref name="docnumber"/>
171
+ </optional>
166
172
  <zeroOrMore>
167
173
  <ref name="bdate"/>
168
174
  </zeroOrMore>
@@ -16,6 +16,9 @@
16
16
  </define>
17
17
  <define name="docidentifier">
18
18
  <element name="docidentifier">
19
+ <optional>
20
+ <attribute name="type"/>
21
+ </optional>
19
22
  <text/>
20
23
  </element>
21
24
  </define>
@@ -29,30 +32,38 @@
29
32
  <attribute name="id">
30
33
  <data type="ID"/>
31
34
  </attribute>
32
- <optional>
33
- <ref name="source"/>
34
- </optional>
35
35
  <optional>
36
36
  <ref name="tname"/>
37
37
  </optional>
38
38
  <choice>
39
+ <ref name="image"/>
40
+ <ref name="pre"/>
39
41
  <oneOrMore>
40
- <ref name="figure"/>
42
+ <ref name="subfigure"/>
41
43
  </oneOrMore>
42
- <group>
43
- <choice>
44
- <zeroOrMore>
45
- <ref name="TextElement"/>
46
- </zeroOrMore>
47
- <ref name="pre"/>
48
- </choice>
49
- <zeroOrMore>
50
- <ref name="note"/>
51
- </zeroOrMore>
52
- <optional>
53
- <ref name="dl"/>
54
- </optional>
55
- </group>
44
+ </choice>
45
+ <zeroOrMore>
46
+ <ref name="fn"/>
47
+ </zeroOrMore>
48
+ <optional>
49
+ <ref name="dl"/>
50
+ </optional>
51
+ <zeroOrMore>
52
+ <ref name="note"/>
53
+ </zeroOrMore>
54
+ </element>
55
+ </define>
56
+ <define name="subfigure">
57
+ <element name="figure">
58
+ <attribute name="id">
59
+ <data type="ID"/>
60
+ </attribute>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <choice>
65
+ <ref name="image"/>
66
+ <ref name="pre"/>
56
67
  </choice>
57
68
  </element>
58
69
  </define>
@@ -96,7 +107,6 @@
96
107
  <choice>
97
108
  <value>policy-and-procedures</value>
98
109
  <value>best-practices</value>
99
- <value>circular</value>
100
110
  <value>supporting-document</value>
101
111
  <value>report</value>
102
112
  <value>legal</value>
@@ -107,7 +117,9 @@
107
117
  </define>
108
118
  <define name="editorialgroup">
109
119
  <element name="editorialgroup">
110
- <ref name="committee"/>
120
+ <oneOrMore>
121
+ <ref name="committee"/>
122
+ </oneOrMore>
111
123
  </element>
112
124
  </define>
113
125
  <define name="BibData">
@@ -128,6 +140,9 @@
128
140
  <zeroOrMore>
129
141
  <ref name="docidentifier"/>
130
142
  </zeroOrMore>
143
+ <optional>
144
+ <ref name="docnumber"/>
145
+ </optional>
131
146
  <zeroOrMore>
132
147
  <ref name="bdate"/>
133
148
  </zeroOrMore>
@@ -17,8 +17,7 @@ module Asciidoctor
17
17
  x.xpath("//*[@inline-header]").each do |h|
18
18
  h.delete("inline-header")
19
19
  end
20
- x.xpath("//[@guidance]").each do |h|
21
- require "byebug"; byebug
20
+ x.xpath("//*[@guidance]").each do |h|
22
21
  c = h.previous_element || next
23
22
  c.add_child h.remove
24
23
  end
@@ -28,11 +27,7 @@ module Asciidoctor
28
27
  a = { id: Asciidoctor::Standoc::Utils::anchor_or_uuid(node) }
29
28
  noko do |xml|
30
29
  case sectiontype(node)
31
- when "introduction" then
32
- if node.level == 1 then introduction_parse(a, xml, node)
33
- else
34
- clause_parse(a, xml, node)
35
- end
30
+ when "introduction" then introduction_parse(a, xml, node)
36
31
  when "terms and definitions",
37
32
  "terms, definitions, symbols and abbreviated terms",
38
33
  "terms, definitions, symbols and abbreviations",
@@ -54,8 +49,6 @@ module Asciidoctor
54
49
  bibliography_parse(a, xml, node)
55
50
  elsif node.attr("style") == "appendix" && node.level == 1
56
51
  annex_parse(a, xml, node)
57
- elsif node.option? "appendix"
58
- appendix_parse(a, xml, node)
59
52
  else
60
53
  clause_parse(a, xml, node)
61
54
  end
@@ -67,22 +60,26 @@ module Asciidoctor
67
60
  return node.title
68
61
  end
69
62
 
70
- def make_preface(x, s)
71
- if x.at("//foreword | //introduction | //terms")
72
- preface = s.add_previous_sibling("<preface/>").first
73
- foreword = x.at("//foreword")
74
- preface.add_child foreword.remove if foreword
75
- introduction = x.at("//introduction")
76
- preface.add_child introduction.remove if introduction
77
- terms = x.at("//terms")
78
- preface.add_child terms.remove if terms
79
- end
63
+ def move_sections_into_preface(x, preface)
64
+ foreword = x.at("//foreword")
65
+ preface.add_child foreword.remove if foreword
66
+ introduction = x.at("//introduction")
67
+ preface.add_child introduction.remove if introduction
68
+ terms = x.at("//sections/clause[descendant::terms]") || x.at("//terms")
69
+ preface.add_child terms.remove if terms
80
70
  x.xpath("//clause[@preface]").each do |c|
81
71
  c.delete("preface")
82
72
  preface.add_child c.remove
83
73
  end
84
74
  end
85
75
 
76
+ def make_preface(x, s)
77
+ if x.at("//foreword | //introduction | //terms | //clause[@preface]")
78
+ preface = s.add_previous_sibling("<preface/>").first
79
+ move_sections_into_preface(x, preface)
80
+ end
81
+ end
82
+
86
83
  def clause_parse(attrs, xml, node)
87
84
  attrs[:preface] = true if node.attr("style") == "preface"
88
85
  attrs[:guidance] = true if node.role == "guidance"
@@ -527,7 +527,7 @@ ul li {
527
527
  }
528
528
 
529
529
  ul li:before {
530
- content: "";
530
+ content: "\2014";
531
531
  display: inline-block; width: 1em;
532
532
  margin-left: -1.2em;
533
533
  }
@@ -1,6 +1,6 @@
1
1
  {% if docnumber %}
2
2
  <p class="MsoNormal" align="right" style='text-align:right'><b style='mso-bidi-font-weight:
3
- normal'><span lang="EN-GB" style='font-size:14.0pt;mso-no-proof:yes'>{{ docnumber }}:{{ docyear }} {{ draftinfo }}</span></b><b
3
+ normal'><span lang="EN-GB" style='font-size:14.0pt;mso-no-proof:yes'>{{ docnumber }} {{ draftinfo }}</span></b><b
4
4
  style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:14.0pt'><o:p></o:p></span></b></p>
5
5
  {% endif %}
6
6
 
@@ -84,14 +84,6 @@ module IsoDoc
84
84
  out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
85
85
  end
86
86
 
87
- def term_defs_boilerplate(div, source, term, preface)
88
- if source.empty? && term.nil?
89
- div << @no_terms_boilerplate
90
- else
91
- div << term_defs_boilerplate_cont(source, term)
92
- end
93
- end
94
-
95
87
  def error_parse(node, out)
96
88
  # catch elements not defined in ISO
97
89
  case node.name
@@ -108,11 +100,6 @@ module IsoDoc
108
100
  File.join(File.dirname(__FILE__), loc)
109
101
  end
110
102
 
111
- def info(isoxml, out)
112
- @meta.security isoxml, out
113
- super
114
- end
115
-
116
103
  def i18n_init(lang, script)
117
104
  super
118
105
  y = if lang == "en"
@@ -121,10 +108,10 @@ module IsoDoc
121
108
  YAML.load_file(File.join(File.dirname(__FILE__),
122
109
  "i18n-zh-Hans.yaml"))
123
110
  else
124
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
111
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
125
112
  end
126
- @annex_lbl = "Appendix"
127
113
  @labels = @labels.merge(y)
114
+ @annex_lbl = y["annex"]
128
115
  @clause_lbl = y["clause"]
129
116
  end
130
117
 
@@ -135,6 +122,11 @@ module IsoDoc
135
122
  TERM_CLAUSE = "//preface/terms | "\
136
123
  "//preface/clause[descendant::terms]".freeze
137
124
 
125
+ SECTIONS_XPATH =
126
+ "//foreword | //introduction | //preface/terms | //preface/clause | //annex | "\
127
+ "//sections/clause | //bibliography/references | "\
128
+ "//bibliography/clause".freeze
129
+
138
130
  def terms_defs(isoxml, out, num)
139
131
  f = isoxml.at(ns(TERM_CLAUSE)) or return num
140
132
  out.div **attr_code(id: f["id"]) do |div|
@@ -150,7 +142,7 @@ module IsoDoc
150
142
 
151
143
  def preface(isoxml, out)
152
144
  isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
153
- if c.name == "terms" then terms_defs isoxml, out, 0
145
+ if c.name == "terms" || c.at(ns(".//terms")) then terms_defs isoxml, out, 0
154
146
  else
155
147
  out.div **attr_code(id: c["id"]) do |s|
156
148
  clause_name(get_anchors[c['id']][:label],
@@ -199,14 +191,6 @@ module IsoDoc
199
191
  l10n("<b>#{@annex_lbl} #{num}</b>")
200
192
  end
201
193
 
202
- def xclause_names(docxml, _sect_num)
203
- q = "//clause[parent::sections]"
204
- @topnum = nil
205
- docxml.xpath(ns(q)).each do |c|
206
- section_names(c, @topnum, 1)
207
- end
208
- end
209
-
210
194
  def clause_names(docxml, sect_num)
211
195
  q = "//clause[parent::sections]"
212
196
  @topnum = nil
@@ -231,9 +215,7 @@ module IsoDoc
231
215
  def sect_names(clause, num, i, lvl, prev_lvl)
232
216
  return i if clause.nil?
233
217
  curr = i
234
- if clause["container"]
235
- retlvl = lvl+1
236
- else
218
+ if !clause["container"]
237
219
  retlvl = lvl
238
220
  i+=1
239
221
  curr = i
@@ -258,7 +240,7 @@ module IsoDoc
258
240
  def annex_naming(c, num, lvl, i)
259
241
  if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
260
242
  else
261
- i+= 1
243
+ i+= 1 unless c["container"]
262
244
  annex_names1(c, "#{num}.#{i}", lvl + 1)
263
245
  end
264
246
  i
@@ -269,14 +251,15 @@ module IsoDoc
269
251
  xref: "#{@annex_lbl} #{num}", level: 1 }
270
252
  i = 0
271
253
  clause.xpath(ns("./clause")).each do |c|
254
+ container_names(c, 0)
272
255
  i = annex_naming(c, num, 1, i)
273
256
  end
274
257
  hierarchical_asset_names(clause, num)
275
258
  end
276
259
 
277
260
  def annex_names1(clause, num, level)
278
- @anchors[clause["id"]] = { label: num, xref: "#{@annex_lbl} #{num}",
279
- level: level }
261
+ clause["container"] or @anchors[clause["id"]] =
262
+ { label: num, xref: "#{@annex_lbl} #{num}", level: level }
280
263
  i = 0
281
264
  clause.xpath(ns("./clause")).each do |c|
282
265
  i = annex_naming(c, num, level, i)
@@ -1 +1,2 @@
1
1
  clause: Paragraph
2
+ annex: Appendix
@@ -0,0 +1,2 @@
1
+ clause: 段
2
+ annex: 附录
@@ -27,14 +27,7 @@ module IsoDoc
27
27
 
28
28
  def docid(isoxml, _out)
29
29
  docnumber = isoxml.at(ns("//bibdata/docidentifier"))
30
- docstatus = isoxml.at(ns("//bibdata/status"))
31
- dn = docnumber&.text
32
- if docstatus
33
- set(:status, status_print(docstatus.text))
34
- abbr = status_abbr(docstatus.text)
35
- dn = "#{dn}(#{abbr})" unless abbr.empty?
36
- end
37
- set(:docnumber, dn)
30
+ set(:docnumber, docnumber&.text)
38
31
  end
39
32
 
40
33
  def doctype(isoxml, _out)
@@ -45,10 +38,6 @@ module IsoDoc
45
38
  set(:doctype, t)
46
39
  end
47
40
 
48
- def status_print(status)
49
- status.split(/-/).map{ |w| w.capitalize }.join(" ")
50
- end
51
-
52
41
  def status_abbr(status)
53
42
  case status
54
43
  when "working-draft" then "wd"
@@ -61,10 +50,8 @@ module IsoDoc
61
50
 
62
51
  def version(isoxml, _out)
63
52
  super
64
-
65
53
  revdate = get[:revdate]
66
54
  set(:revdate_monthyear, monthyr(revdate))
67
-
68
55
  edition = isoxml.at(ns("//version/edition"))
69
56
  if edition
70
57
  set(
@@ -74,12 +61,6 @@ module IsoDoc
74
61
  split(/(\W)/).map(&:capitalize).join
75
62
  )
76
63
  end
77
-
78
- puts "get get[:docstage] #{get[:docstage]}"
79
- puts get[:docstage]
80
- if get[:docstage] == "95" and get[:docsubstage] == "99"
81
- set(:draftinfo, "(Repealed)")
82
- end
83
64
  end
84
65
 
85
66
  def monthyr(isodate)
@@ -89,11 +70,6 @@ module IsoDoc
89
70
  # invalid dates get thrown
90
71
  isodate
91
72
  end
92
-
93
- def security(isoxml, _out)
94
- security = isoxml.at(ns("//bibdata/security")) || return
95
- set(:security, security.text)
96
- end
97
73
  end
98
74
  end
99
75
  end
@@ -82,14 +82,6 @@ module IsoDoc
82
82
  out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
83
83
  end
84
84
 
85
- def term_defs_boilerplate(div, source, term, preface)
86
- if source.empty? && term.nil?
87
- div << @no_terms_boilerplate
88
- else
89
- div << term_defs_boilerplate_cont(source, term)
90
- end
91
- end
92
-
93
85
  def error_parse(node, out)
94
86
  # catch elements not defined in ISO
95
87
  case node.name
@@ -106,11 +98,6 @@ module IsoDoc
106
98
  File.join(File.dirname(__FILE__), loc)
107
99
  end
108
100
 
109
- def info(isoxml, out)
110
- @meta.security isoxml, out
111
- super
112
- end
113
-
114
101
  def i18n_init(lang, script)
115
102
  super
116
103
  y = if lang == "en"
@@ -119,10 +106,10 @@ module IsoDoc
119
106
  YAML.load_file(File.join(File.dirname(__FILE__),
120
107
  "i18n-zh-Hans.yaml"))
121
108
  else
122
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
109
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
123
110
  end
124
- @annex_lbl = "Appendix"
125
111
  @labels = @labels.merge(y)
112
+ @annex_lbl = y["annex"]
126
113
  @clause_lbl = y["clause"]
127
114
  end
128
115
 
@@ -133,6 +120,10 @@ module IsoDoc
133
120
  TERM_CLAUSE = "//preface/terms | "\
134
121
  "//preface/clause[descendant::terms]".freeze
135
122
 
123
+ SECTIONS_XPATH =
124
+ "//foreword | //introduction | //preface/terms | //preface/clause | //annex | "\
125
+ "//sections/clause | //bibliography/references | "\
126
+ "//bibliography/clause".freeze
136
127
 
137
128
  def terms_defs(isoxml, out, num)
138
129
  f = isoxml.at(ns(TERM_CLAUSE)) or return num
@@ -150,7 +141,7 @@ module IsoDoc
150
141
 
151
142
  def preface(isoxml, out)
152
143
  isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
153
- if c.name == "terms" then terms_defs isoxml, out, 0
144
+ if c.name == "terms" || c.at(ns(".//terms")) then terms_defs isoxml, out, 0
154
145
  else
155
146
  out.div **attr_code(id: c["id"]) do |s|
156
147
  clause_name(get_anchors[c['id']][:label],
@@ -227,9 +218,7 @@ module IsoDoc
227
218
  def sect_names(clause, num, i, lvl, prev_lvl)
228
219
  return i if clause.nil?
229
220
  curr = i
230
- if clause["container"]
231
- retlvl = lvl+1
232
- else
221
+ if !clause["container"]
233
222
  retlvl = lvl
234
223
  i+=1
235
224
  curr = i
@@ -254,7 +243,7 @@ module IsoDoc
254
243
  def annex_naming(c, num, lvl, i)
255
244
  if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
256
245
  else
257
- i+= 1
246
+ i+= 1 unless c["container"]
258
247
  annex_names1(c, "#{num}.#{i}", lvl + 1)
259
248
  end
260
249
  i
@@ -265,14 +254,15 @@ module IsoDoc
265
254
  xref: "#{@annex_lbl} #{num}", level: 1 }
266
255
  i = 0
267
256
  clause.xpath(ns("./clause")).each do |c|
257
+ container_names(c, 0)
268
258
  i = annex_naming(c, num, 1, i)
269
259
  end
270
260
  hierarchical_asset_names(clause, num)
271
261
  end
272
262
 
273
263
  def annex_names1(clause, num, level)
274
- @anchors[clause["id"]] = { label: num, xref: "#{@annex_lbl} #{num}",
275
- level: level }
264
+ clause["container"] or @anchors[clause["id"]] =
265
+ { label: num, xref: "#{@annex_lbl} #{num}", level: level }
276
266
  i = 0
277
267
  clause.xpath(ns("./clause")).each do |c|
278
268
  i = annex_naming(c, num, level, i)
@@ -7,10 +7,6 @@ module IsoDoc
7
7
  # A {Converter} implementation that generates Word output, and a document
8
8
  # schema encapsulation of the document for validation
9
9
  class WordConvert < IsoDoc::WordConvert
10
- def rsd_html_path(file)
11
- File.join(File.dirname(__FILE__), File.join("html", file))
12
- end
13
-
14
10
  def initialize(options)
15
11
  @libdir = File.dirname(__FILE__)
16
12
  super
@@ -57,49 +53,6 @@ module IsoDoc
57
53
  end
58
54
  end
59
55
 
60
- def make_body2(body, docxml)
61
- body.div **{ class: "WordSection2" } do |div2|
62
- info docxml, div2
63
- div2.p { |p| p << "&nbsp;" } # placeholder
64
- end
65
- #body.br **{ clear: "all", style: "page-break-before:auto;mso-break-type:section-break;" }
66
- section_break(body)
67
- end
68
-
69
- def title(isoxml, _out)
70
- main = isoxml&.at(ns("//title[@language='en']"))&.text
71
- set_metadata(:doctitle, main)
72
- end
73
-
74
- def generate_header(filename, dir)
75
- return unless @header
76
- template = Liquid::Template.parse(File.read(@header, encoding: "UTF-8"))
77
- meta = @meta.get
78
- meta[:filename] = filename
79
- params = meta.map { |k, v| [k.to_s, v] }.to_h
80
- File.open("header.html", "w") { |f| f.write(template.render(params)) }
81
- @files_to_delete << "header.html"
82
- "header.html"
83
- end
84
-
85
- def header_strip(h)
86
- h = h.to_s.gsub(%r{<br/>}, " ").sub(/<\/?h[12][^>]*>/, "")
87
- h1 = to_xhtml_fragment(h.dup)
88
- h1.traverse do |x|
89
- x.replace(" ") if x.name == "span" &&
90
- /mso-tab-count/.match(x["style"])
91
- x.remove if x.name == "span" && x["class"] == "MsoCommentReference"
92
- x.remove if x.name == "a" && x["epub:type"] == "footnote"
93
- x.replace(x.children) if x.name == "a"
94
- end
95
- from_xhtml(h1)
96
- end
97
-
98
- def info(isoxml, out)
99
- @meta.security isoxml, out
100
- super
101
- end
102
-
103
56
  def annex_name(annex, name, div)
104
57
  div.h1 **{ class: "Annex" } do |t|
105
58
  t << "#{get_anchors[annex['id']][:label]} "
@@ -113,19 +66,6 @@ module IsoDoc
113
66
  out.pre node.text # content.gsub(/</, "&lt;").gsub(/>/, "&gt;")
114
67
  end
115
68
 
116
- def term_defs_boilerplate(div, source, term, preface)
117
- if source.empty? && term.nil?
118
- div << @no_terms_boilerplate
119
- else
120
- div << term_defs_boilerplate_cont(source, term)
121
- end
122
- end
123
-
124
- def i18n_init(lang, script)
125
- super
126
- @annex_lbl = "Appendix"
127
- end
128
-
129
69
  def error_parse(node, out)
130
70
  # catch elements not defined in ISO
131
71
  case node.name
@@ -150,9 +90,10 @@ module IsoDoc
150
90
  YAML.load_file(File.join(File.dirname(__FILE__),
151
91
  "i18n-zh-Hans.yaml"))
152
92
  else
153
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
93
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
154
94
  end
155
95
  @labels = @labels.merge(y)
96
+ @annex_lbl = y["annex"]
156
97
  @clause_lbl = y["clause"]
157
98
  end
158
99
 
@@ -163,6 +104,10 @@ module IsoDoc
163
104
  TERM_CLAUSE = "//preface/terms | "\
164
105
  "//preface/clause[descendant::terms]".freeze
165
106
 
107
+ SECTIONS_XPATH =
108
+ "//foreword | //introduction | //preface/terms | //preface/clause | //annex | "\
109
+ "//sections/clause | //bibliography/references | "\
110
+ "//bibliography/clause".freeze
166
111
 
167
112
  def terms_defs(isoxml, out, num)
168
113
  f = isoxml.at(ns(TERM_CLAUSE)) or return num
@@ -176,22 +121,6 @@ module IsoDoc
176
121
  end
177
122
 
178
123
  FRONT_CLAUSE = "//*[parent::preface]".freeze
179
- #FRONT_CLAUSE = "//clause[parent::preface] | //terms[parent::preface]".freeze
180
-
181
- def preface(isoxml, out)
182
- isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
183
- if c.name == "terms" then terms_defs isoxml, out, 0
184
- else
185
- out.div **attr_code(id: c["id"]) do |s|
186
- clause_name(get_anchors[c['id']][:label],
187
- c&.at(ns("./title"))&.content, s, nil)
188
- c.elements.reject { |c1| c1.name == "title" }.each do |c1|
189
- parse(c1, s)
190
- end
191
- end
192
- end
193
- end
194
- end
195
124
 
196
125
  def initial_anchor_names(d)
197
126
  d.xpath(ns(FRONT_CLAUSE)).each do |c|
@@ -204,14 +133,6 @@ module IsoDoc
204
133
  termexample_anchor_names(d)
205
134
  end
206
135
 
207
-
208
- def middle(isoxml, out)
209
- middle_title(out)
210
- clause isoxml, out
211
- annex isoxml, out
212
- bibliography isoxml, out
213
- end
214
-
215
136
  def make_body2(body, docxml)
216
137
  body.div **{ class: "WordSection2" } do |div2|
217
138
  info docxml, div2
@@ -223,7 +144,6 @@ module IsoDoc
223
144
  section_break(body)
224
145
  end
225
146
 
226
-
227
147
  def middle(isoxml, out)
228
148
  middle_title(out)
229
149
  clause isoxml, out
@@ -264,9 +184,7 @@ module IsoDoc
264
184
  def sect_names(clause, num, i, lvl, prev_lvl)
265
185
  return i if clause.nil?
266
186
  curr = i
267
- if clause["container"]
268
- retlvl = lvl+1
269
- else
187
+ if !clause["container"]
270
188
  retlvl = lvl
271
189
  i+=1
272
190
  curr = i
@@ -291,7 +209,7 @@ module IsoDoc
291
209
  def annex_naming(c, num, lvl, i)
292
210
  if c["guidance"] then annex_names1(c, "#{num}E", lvl + 1)
293
211
  else
294
- i+= 1
212
+ i+= 1 unless c["container"]
295
213
  annex_names1(c, "#{num}.#{i}", lvl + 1)
296
214
  end
297
215
  i
@@ -302,14 +220,15 @@ module IsoDoc
302
220
  xref: "#{@annex_lbl} #{num}", level: 1 }
303
221
  i = 0
304
222
  clause.xpath(ns("./clause")).each do |c|
223
+ container_names(c, 0)
305
224
  i = annex_naming(c, num, 1, i)
306
225
  end
307
226
  hierarchical_asset_names(clause, num)
308
227
  end
309
228
 
310
229
  def annex_names1(clause, num, level)
311
- @anchors[clause["id"]] = { label: num, xref: "#{@annex_lbl} #{num}",
312
- level: level }
230
+ clause["container"] or @anchors[clause["id"]] =
231
+ { label: num, xref: "#{@annex_lbl} #{num}", level: level }
313
232
  i = 0
314
233
  clause.xpath(ns("./clause")).each do |c|
315
234
  i = annex_naming(c, num, level, i)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Mpfd
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end