metanorma-iso 3.0.3 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,7 @@ module IsoDoc
51
51
  # Redo Amendment annex subclause titles as numbered
52
52
  def clause(docxml)
53
53
  super
54
- docxml.xpath(ns("//annex//appendix")).each { |f| clause1(f) }
54
+ # docxml.xpath(ns("//annex//appendix")).each { |f| clause1(f) }
55
55
  amd?(docxml) or return
56
56
  @suppressheadingnumbers = @oldsuppressheadingnumbers
57
57
  docxml.xpath(ns("//annex//clause | //annex//appendix")).each do |f|
@@ -12,8 +12,8 @@ module IsoDoc
12
12
  (docxml.xpath(ns("//concept")) - docxml.xpath(ns("//term//concept")))
13
13
  .each do |node|
14
14
  node.ancestors("definition, termsource, related").empty? and
15
- concept_render(node, ital: "false", ref: "false",
16
- linkref: "true", linkmention: "false")
15
+ concept_render(node, ital: "false", ref: "false",
16
+ linkref: "true", linkmention: "false")
17
17
  end
18
18
  end
19
19
 
@@ -23,7 +23,7 @@ module IsoDoc
23
23
  (f.xpath(ns(".//concept")) - f.xpath(ns(".//term//concept")))
24
24
  .each do |c|
25
25
  c.ancestors("definition, termsource, related").empty? and
26
- concept_term1(c, m)
26
+ concept_term1(c, m)
27
27
  end
28
28
  end
29
29
  end
@@ -95,19 +95,19 @@ module IsoDoc
95
95
 
96
96
  def ol_depth(node)
97
97
  depth = node.ancestors(@iso_class ? "ol" : "ul, ol").size + 1
98
- type = :alphabet
99
- type = :arabic if [2, 7].include? depth
100
- type = :roman if [3, 8].include? depth
101
- type = :alphabet_upper if [4, 9].include? depth
102
- type = :roman_upper if [5, 10].include? depth
103
- type
98
+ @counter.ol_type(node, depth)
104
99
  end
105
100
 
106
101
  def note1(elem)
107
102
  elem["type"] == "units" and return
103
+ elem["type"] == "requirement" and return requirement_note1(elem)
108
104
  super
109
105
  end
110
106
 
107
+ def requirement_note1(elem)
108
+ elem["unnumbered"] = "true"
109
+ end
110
+
111
111
  def formula_where(dlist)
112
112
  dlist.nil? and return
113
113
  dlist.xpath(ns("./dt")).size == 1 &&
@@ -162,7 +162,7 @@ module IsoDoc
162
162
 
163
163
  def twitter_cldr_localiser_symbols
164
164
  { group: " ", fraction_group: " ",
165
- fraction_group_digits: 3 }
165
+ fraction_group_digits: 3, decimal: "," }
166
166
  end
167
167
 
168
168
  def implicit_reference(bib)
@@ -184,6 +184,23 @@ module IsoDoc
184
184
  end
185
185
  end
186
186
 
187
+ def ul_label_list(_elem)
188
+ if @docscheme == "1951"
189
+ %w(–)
190
+ else
191
+ %w(—)
192
+ end
193
+ end
194
+
195
+ def ol_label_template(_elem)
196
+ ret = super
197
+ @docscheme == "1951" and
198
+ ret[:alphabet] = <<~SPAN.strip
199
+ <span class="fmt-label-delim">(</span>%<span class="fmt-label-delim">)</span>
200
+ SPAN
201
+ ret
202
+ end
203
+
187
204
  def fn_ref_label(fnote)
188
205
  if fnote.ancestors("table, figure").empty? ||
189
206
  !fnote.ancestors("name, fmt-name").empty?
@@ -117,8 +117,7 @@ module IsoDoc
117
117
 
118
118
  def authority_cleanup(docxml)
119
119
  super
120
- if @meta.get[:stage_int].to_s[0] == "9" ||
121
- @meta.get[:stage_int].to_s[0] == "6"
120
+ if ["9", "6"].include?(@meta.get[:stage_int].to_s[0])
122
121
  copyright_prf(docxml)
123
122
  else
124
123
  copyright_dis(docxml)
@@ -142,6 +141,14 @@ module IsoDoc
142
141
  end
143
142
  docxml.xpath("//p[@class = 'zzCopyrightHdr']")&.each(&:remove)
144
143
  end
144
+
145
+ def list_title_parse(node, out)
146
+ name = node.at(ns("./fmt-name")) or return
147
+ klass = node["key"] == "true" ? "KeyTitle" : "ListTitle"
148
+ out.p class: klass do |p|
149
+ name.children&.each { |n| parse(n, p) }
150
+ end
151
+ end
145
152
  end
146
153
  end
147
154
  end
@@ -235,7 +235,8 @@ module IsoDoc
235
235
  end
236
236
 
237
237
  def uncountable_note?(note)
238
- @anchors[note["id"]] || blank?(note["id"]) || note["type"] == "units"
238
+ @anchors[note["id"]] || blank?(note["id"]) || note["type"] == "units" ||
239
+ note["type"] == "requirement"
239
240
  end
240
241
 
241
242
  def note_anchor_names1(notes, counter)
@@ -7,19 +7,20 @@ module IsoDoc
7
7
  clause.at(ns("./clause")) and
8
8
  @anchors[clause["id"]] = { label: nil, level: 1, type: "clause",
9
9
  xref: clause.at(ns("./title"))&.text }
10
- #i = Counter.new(0, prefix: "0")
11
10
  i = clause_counter(0)
12
11
  clause.xpath(ns("./clause")).each do |c|
13
12
  section_names1(c, semx(clause, "0"), i.increment(c).print, 2)
14
13
  end
15
14
  end
16
15
 
17
- def annex_names(clause, num)
16
+ # KILL
17
+ def annex_namesx(clause, num)
18
18
  appendix_names(clause, num)
19
19
  super
20
20
  end
21
21
 
22
- def appendix_names(clause, _num)
22
+ # KILL
23
+ def appendix_namesx(clause, _num)
23
24
  i = clause_counter(0)
24
25
  clause.xpath(ns("./appendix")).each do |c|
25
26
  i.increment(c)
@@ -65,8 +66,8 @@ module IsoDoc
65
66
  @anchors[clause["id"]] = ret.merge(ret2)
66
67
  end
67
68
 
68
- def appendix_names1(clause, parentnum, num, level, container)
69
- #num = labelled_autonum(@labels["appendix"], num)
69
+ # KILL
70
+ def appendix_names1x(clause, parentnum, num, level, container)
70
71
  num = clause_number_semx(parentnum, clause, num)
71
72
  @anchors[clause["id"]] = { label: num, xref: num, level: level,
72
73
  container: container }
@@ -1701,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
1701
1701
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
1702
1702
  The target of a footnote is the location it is embedded in within the text</a:documentation>
1703
1703
  <element name="fn">
1704
- <attribute name="reference">
1705
- <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1706
- </attribute>
1707
- <oneOrMore>
1708
- <ref name="paragraph">
1709
- <a:documentation>The content of the footnote</a:documentation>
1710
- </ref>
1711
- </oneOrMore>
1704
+ <ref name="FnAttributes"/>
1705
+ <ref name="FnBody"/>
1712
1706
  </element>
1713
1707
  </define>
1708
+ <define name="FnBody">
1709
+ <oneOrMore>
1710
+ <ref name="paragraph">
1711
+ <a:documentation>The content of the footnote</a:documentation>
1712
+ </ref>
1713
+ </oneOrMore>
1714
+ </define>
1715
+ <define name="FnAttributes">
1716
+ <attribute name="reference">
1717
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1718
+ </attribute>
1719
+ </define>
1714
1720
  <define name="callout">
1715
1721
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
1716
1722
  <element name="callout">
@@ -1,13 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
3
- <!--
4
- Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
5
- of relaton
6
-
7
- Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
8
- (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
9
- -->
10
3
  <include href="biblio.rng">
4
+ <!-- ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix -->
5
+ <!--
6
+ Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
7
+ of relaton
8
+
9
+ Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
10
+ (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
11
+ -->
11
12
  <define name="BibData">
12
13
  <a:documentation>The bibliographic description of a standardisation document</a:documentation>
13
14
  <ref name="StandardBibliographicItem"/>
@@ -91,6 +92,9 @@ a standards definition organization</a:documentation>
91
92
  <a:documentation>Representation of the identifier for the standardisation document, giving its individual semantic components</a:documentation>
92
93
  </ref>
93
94
  </zeroOrMore>
95
+ <ref name="DocumentImages">
96
+ <a:documentation>Coverpage and other images to be rendered with document</a:documentation>
97
+ </ref>
94
98
  </define>
95
99
  <define name="doctype">
96
100
  <a:documentation>Classification of the standardisation document</a:documentation>
@@ -268,6 +272,32 @@ and not those document components</a:documentation>
268
272
  </optional>
269
273
  </element>
270
274
  </define>
275
+ <define name="DocumentImages">
276
+ <zeroOrMore>
277
+ <element name="coverpage-image">
278
+ <a:documentation>Images to be displayed on the coverpage of the document</a:documentation>
279
+ <ref name="image-no-id"/>
280
+ </element>
281
+ </zeroOrMore>
282
+ <zeroOrMore>
283
+ <element name="innercoverpage-image">
284
+ <a:documentation>Images to be displayed on the inner coverpage of the document</a:documentation>
285
+ <ref name="image-no-id"/>
286
+ </element>
287
+ </zeroOrMore>
288
+ <zeroOrMore>
289
+ <element name="tocside-image">
290
+ <a:documentation>Images to be displayed on the Table of Contents page of the document</a:documentation>
291
+ <ref name="image-no-id"/>
292
+ </element>
293
+ </zeroOrMore>
294
+ <zeroOrMore>
295
+ <element name="backpage-image">
296
+ <a:documentation>Images to be displayed on the backpage of the document</a:documentation>
297
+ <ref name="image-no-id"/>
298
+ </element>
299
+ </zeroOrMore>
300
+ </define>
271
301
  <define name="StandardBibliographicItem">
272
302
  <ref name="BibliographicItem"/>
273
303
  <zeroOrMore>
@@ -1,23 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- instantiations of this grammar may replace leaf strings
4
- with more elaborated types; e.g. title (text) replaced with
5
- title-main, title-intro, title-part; type replaced with
6
- enum.
7
-
8
- some renaming at leaf nodes is permissible
9
-
10
- obligations can change both from optional to mandatory,
11
- and from mandatory to optional; optional elements may
12
- be omitted; freely positioned alternatives may be replaced
13
- with strict ordering
14
-
15
- DO NOT introduce a namespace here. We do not want a distinct namespace
16
- for these elements, and a distinct namespace for any grammar inheriting
17
- these elements; we just want one namespace for any child grammars
18
- of this.
19
- -->
20
2
  <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">
3
+ <!--
4
+ ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
5
+
6
+ Instantiations of this grammar may replace leaf strings
7
+ with more elaborated types; e.g. title (text) replaced with
8
+ title-main, title-intro, title-part; type replaced with
9
+ enum.
10
+
11
+ Some renaming at leaf nodes is permissible
12
+
13
+ Obligations can change both from optional to mandatory,
14
+ and from mandatory to optional; optional elements may
15
+ be omitted; freely positioned alternatives may be replaced
16
+ with strict ordering
17
+
18
+ DO NOT introduce a namespace here. We do not want a distinct namespace
19
+ for these elements, and a distinct namespace for any grammar inheriting
20
+ these elements; we just want one namespace for any child grammars
21
+ of this.
22
+ -->
21
23
  <!--
22
24
  https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
23
25
  iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
@@ -1241,6 +1243,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1241
1243
  </define>
1242
1244
  <define name="formattedref">
1243
1245
  <element name="formattedref">
1246
+ <optional>
1247
+ <attribute name="format">
1248
+ <a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
1249
+ </attribute>
1250
+ </optional>
1244
1251
  <oneOrMore>
1245
1252
  <ref name="TextElement"/>
1246
1253
  </oneOrMore>
@@ -1812,6 +1819,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
1812
1819
  <a:documentation>Abstract of bibliographic item</a:documentation>
1813
1820
  <element name="abstract">
1814
1821
  <ref name="LocalizedStringAttributes"/>
1822
+ <optional>
1823
+ <attribute name="format">
1824
+ <a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
1825
+ </attribute>
1826
+ </optional>
1815
1827
  <choice>
1816
1828
  <oneOrMore>
1817
1829
  <ref name="BasicBlockNoId">
@@ -16,7 +16,7 @@ module Metanorma
16
16
  end
17
17
 
18
18
  def metadata_ext_iso(node, xml)
19
- structured_id(node, xml)
19
+ a = node.attr("horizontal") and xml.horizontal a
20
20
  metadata_stage(node, xml)
21
21
  @amd && a = node.attr("updates-document-type") and
22
22
  xml.updates_document_type a
@@ -53,11 +53,6 @@ module Metanorma
53
53
  end
54
54
  end
55
55
 
56
- def metadata_flavor(node, xml)
57
- super
58
- a = node.attr("horizontal") and xml.horizontal a
59
- end
60
-
61
56
  def metadata_status(node, xml)
62
57
  stage = get_stage(node)
63
58
  substage = get_substage(node)