metanorma-ieee 1.4.2 → 1.4.4

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.
@@ -1,6 +1,7 @@
1
1
  require_relative "init"
2
2
  require_relative "presentation_bibdata"
3
3
  require_relative "presentation_terms"
4
+ require_relative "presentation_concepts"
4
5
  require_relative "presentation_ref"
5
6
  require "isodoc"
6
7
 
@@ -35,7 +36,7 @@ module IsoDoc
35
36
  end
36
37
 
37
38
  def subclause?(target, type, from)
38
- (from&.match?(/\./) && type == "clause") ||
39
+ (from&.include?(".") && type == "clause") ||
39
40
  target&.gsub(/<[^<>]+>/, "")&.match?(/^IEV$|^IEC 60050-/)
40
41
  end
41
42
 
@@ -104,16 +105,7 @@ module IsoDoc
104
105
  end
105
106
 
106
107
  def annex_delim(_elem)
107
- "<br/>"
108
- end
109
-
110
- # KILL
111
- def annex1_default(elem)
112
- lbl = @xrefs.anchor(elem["id"], :label)
113
- if t = elem.at(ns("./title"))
114
- t.children = "<strong>#{to_xml(t.children)}</strong>"
115
- end
116
- prefix_name(elem, { caption: "<br/>" }, lbl, "title")
108
+ "<br/>"
117
109
  end
118
110
 
119
111
  def amend1(elem)
@@ -184,6 +176,8 @@ module IsoDoc
184
176
  end
185
177
  end
186
178
 
179
+ # overrides IsoDoc:: XrefGen::OlTypeProvider: we trigger
180
+ # @xrefs.list_anchor_names after this is called, with elem["type"] set
187
181
  def ol_depth_rotate(node, idx)
188
182
  depth = node.ancestors("ol").size + idx
189
183
  type = :alphabet
@@ -192,6 +186,15 @@ module IsoDoc
192
186
  type
193
187
  end
194
188
 
189
+ def ul_label_list(_elem)
190
+ if @doctype == "whitepaper" ||
191
+ %w(icap industry-connection-report).include?(@subdoctype)
192
+ %w(&#x25aa; &#x2014;)
193
+ else
194
+ %w(&#x2013;)
195
+ end
196
+ end
197
+
195
198
  def middle_title(docxml)
196
199
  s = middle_title_insert(docxml) or return
197
200
  s.previous = middle_title_body
@@ -87,7 +87,7 @@ module IsoDoc
87
87
  body.div class: "WordSectionMain" do |div3|
88
88
  content(div3, docxml, ns(self.class::MAIN_ELEMENTS))
89
89
  footnotes docxml, div3
90
- comments div3
90
+ comments docxml, div3
91
91
  end
92
92
  end
93
93
 
@@ -46,7 +46,7 @@ module IsoDoc
46
46
  body.div class: "WordSection4" do |div3|
47
47
  backcover div3
48
48
  footnotes docxml, div3
49
- comments div3
49
+ comments docxml, div3
50
50
  end
51
51
  end
52
52
 
@@ -50,13 +50,14 @@ module IsoDoc
50
50
  "#{@klass.norm_ref_xpath} | //sections/terms | " \
51
51
  "//sections/definitions | //clause[parent::sections]"
52
52
  if @hierarchical_assets
53
- hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"), "Preface")
53
+ hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
54
+ "Preface")
54
55
  doc.xpath(ns(middle_sections)).each do |c|
55
56
  hierarchical_asset_names(c, @anchors[c["id"]][:label])
56
57
  end
57
58
  else
58
- sequential_asset_names(doc.xpath(ns("//preface/* | " + middle_sections)))
59
- #sequential_asset_names(doc.xpath(ns(middle_sections)))
59
+ sequential_asset_names(doc.xpath(ns("//preface/* | #{middle_sections}")))
60
+ # sequential_asset_names(doc.xpath(ns(middle_sections)))
60
61
  end
61
62
  end
62
63
 
@@ -77,20 +78,12 @@ module IsoDoc
77
78
  sequence = UUIDTools::UUID.random_create.to_s
78
79
  notes = t.xpath(ns("./termnote"))
79
80
  notes.noblank.each do |n|
80
- @anchors[n["id"]] =
81
- { label: termnote_label(n, increment_label(notes, n, c)), type: "termnote",
81
+ @anchors[n["id"]] =
82
+ { label: termnote_label(n, increment_label(notes, n, c)),
82
83
  value: c.print, elem: @labels["termnote"],
83
- container: t["id"],
84
+ container: t["id"], type: "termnote",
84
85
  xref: anchor_struct_xref(c.print, n, @labels["note_xref"]) }
85
- .merge(sequence: sequence)
86
- =begin
87
- anchor_struct(
88
- termnote_label(n, increment_label(notes, n, c)),
89
- #labelled_autonum(@labels["termnote"], increment_label(notes, n, c)),
90
- #"#{@labels['termnote']} #{increment_label(notes, n, c)}",
91
- n, @labels["note_xref"], "termnote", { container: true })
92
86
  .merge(sequence: sequence)
93
- =end
94
87
  end
95
88
  end
96
89
  end
@@ -111,7 +104,7 @@ module IsoDoc
111
104
  if @doctype == "whitepaper"
112
105
  title = Common::case_with_markup(@labels["annex"], "capital",
113
106
  @script)
114
- l10n(labelled_autonum(title, num))
107
+ l10n(labelled_autonum(title, num))
115
108
  else super
116
109
  end
117
110
  end
@@ -382,33 +382,7 @@ in a document (e.g. sourcecode annotations)</a:documentation>
382
382
  <a:documentation>Block intended to capture reviewer comments about some text in the document</a:documentation>
383
383
  <element name="review">
384
384
  <ref name="RequiredId"/>
385
- <attribute name="reviewer">
386
- <a:documentation>The party who has offered the comment</a:documentation>
387
- </attribute>
388
- <optional>
389
- <attribute name="type">
390
- <a:documentation>The type of reviewer comment</a:documentation>
391
- </attribute>
392
- </optional>
393
- <optional>
394
- <attribute name="date">
395
- <a:documentation>The date when the comment was made</a:documentation>
396
- <data type="dateTime"/>
397
- </attribute>
398
- </optional>
399
- <optional>
400
- <attribute name="from">
401
- <a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
402
- If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
403
- <data type="IDREF"/>
404
- </attribute>
405
- </optional>
406
- <optional>
407
- <attribute name="to">
408
- <a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
409
- <data type="IDREF"/>
410
- </attribute>
411
- </optional>
385
+ <ref name="ReviewAttributes"/>
412
386
  <oneOrMore>
413
387
  <ref name="paragraph">
414
388
  <a:documentation>Reviewer comments content</a:documentation>
@@ -416,6 +390,35 @@ If not provided, the comment applies in the vicinity of the place it has been in
416
390
  </oneOrMore>
417
391
  </element>
418
392
  </define>
393
+ <define name="ReviewAttributes">
394
+ <attribute name="reviewer">
395
+ <a:documentation>The party who has offered the comment</a:documentation>
396
+ </attribute>
397
+ <optional>
398
+ <attribute name="type">
399
+ <a:documentation>The type of reviewer comment</a:documentation>
400
+ </attribute>
401
+ </optional>
402
+ <optional>
403
+ <attribute name="date">
404
+ <a:documentation>The date when the comment was made</a:documentation>
405
+ <data type="dateTime"/>
406
+ </attribute>
407
+ </optional>
408
+ <optional>
409
+ <attribute name="from">
410
+ <a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
411
+ If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
412
+ <data type="IDREF"/>
413
+ </attribute>
414
+ </optional>
415
+ <optional>
416
+ <attribute name="to">
417
+ <a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
418
+ <data type="IDREF"/>
419
+ </attribute>
420
+ </optional>
421
+ </define>
419
422
  <define name="NumberingAttributes">
420
423
  <optional>
421
424
  <attribute name="unnumbered">
@@ -857,6 +860,7 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
857
860
  <define name="tr">
858
861
  <a:documentation>Sequence of cells to be displayed as a row in a table</a:documentation>
859
862
  <element name="tr">
863
+ <ref name="TrAttributes"/>
860
864
  <oneOrMore>
861
865
  <choice>
862
866
  <ref name="td">
@@ -869,6 +873,9 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
869
873
  </oneOrMore>
870
874
  </element>
871
875
  </define>
876
+ <define name="TrAttributes">
877
+ <empty/>
878
+ </define>
872
879
  <define name="tr-no-id">
873
880
  <a:documentation>Sequence of cells to be displayed as a row in a table: optional ID attributes recursively (for use in Relaton, metadata)</a:documentation>
874
881
  <element name="tr">
@@ -1694,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
1694
1701
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
1695
1702
  The target of a footnote is the location it is embedded in within the text</a:documentation>
1696
1703
  <element name="fn">
1697
- <attribute name="reference">
1698
- <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1699
- </attribute>
1700
- <oneOrMore>
1701
- <ref name="paragraph">
1702
- <a:documentation>The content of the footnote</a:documentation>
1703
- </ref>
1704
- </oneOrMore>
1704
+ <ref name="FnAttributes"/>
1705
+ <ref name="FnBody"/>
1705
1706
  </element>
1706
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>
1707
1720
  <define name="callout">
1708
1721
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
1709
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">
@@ -20,8 +20,9 @@ module Metanorma
20
20
  @hierarchical_assets = node.attr("hierarchical-object-numbering")
21
21
  end
22
22
 
23
- PREFACE_CLAUSE_NAMES = %w(abstract foreword introduction
24
- acknowledgements participants).freeze
23
+ PREFACE_CLAUSE_NAMES =
24
+ %w(abstract foreword introduction acknowledgements participants
25
+ metanorma-extension misc-container).freeze
25
26
 
26
27
  def sectiontype_streamline(ret)
27
28
  case ret
@@ -126,7 +126,6 @@ module Metanorma
126
126
 
127
127
  def metadata_subdoctype(node, xml)
128
128
  xml.subdoctype (node.attr("docsubtype") || "document")
129
- s = node.attr("trial-use") and xml.trial_use s
130
129
  end
131
130
 
132
131
  def org_abbrev
@@ -141,7 +140,7 @@ module Metanorma
141
140
 
142
141
  def metadata_ext(node, xml)
143
142
  super
144
- structured_id(node, xml)
143
+ s = node.attr("trial-use") and xml.trial_use s
145
144
  program(node, xml)
146
145
  end
147
146
 
@@ -1,11 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar ns='https://www.metanorma.org/ns/standoc' xmlns="http://relaxng.org/ns/structure/1.0">
3
- <!--
4
- VERSION v1.2.1
5
- Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
6
- we cannot have a new default namespace: we will end up with a grammar with two different
7
- namespaces, one for isostandard and one for csand additions. And we do not want that.
8
- -->
9
3
  <include href="relaton-ieee.rng"/>
10
4
  <include href="isodoc.rng">
11
5
  <define name="sections">
@@ -24,31 +18,5 @@
24
18
  </oneOrMore>
25
19
  </element>
26
20
  </define>
27
- <define name="standard-document">
28
- <element name="metanorma">
29
- <ref name="Root-Attributes"/>
30
- <ref name="bibdata"/>
31
- <zeroOrMore>
32
- <ref name="termdocsource"/>
33
- </zeroOrMore>
34
- <optional>
35
- <ref name="misccontainer"/>
36
- </optional>
37
- <optional>
38
- <ref name="boilerplate"/>
39
- </optional>
40
- <ref name="preface"/>
41
- <oneOrMore>
42
- <ref name="sections"/>
43
- </oneOrMore>
44
- <zeroOrMore>
45
- <ref name="annex"/>
46
- </zeroOrMore>
47
- <ref name="bibliography"/>
48
- <zeroOrMore>
49
- <ref name="indexsect"/>
50
- </zeroOrMore>
51
- </element>
52
- </define>
53
21
  </include>
54
22
  </grammar>