metanorma-nist 1.2.0 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0def1e8573338383bf4e456fc4fc092a232c08ef46b676facc570908ad9fd9aa
4
- data.tar.gz: 820cf042c13235a0519ee6818573d9fb445bb6e0d368265a7e72753ea7e40c94
3
+ metadata.gz: 6a69082cb58bde5a1305caea0316414723f519a71c550efe43ac3e894f028436
4
+ data.tar.gz: 73b99485a31a90a15e6936d688fc4c677a2d948e95bc1896d822d7b02cda37f6
5
5
  SHA512:
6
- metadata.gz: 0c5a2abc6a91c220a19917f5b314a18fa06067263c391fbe4d97897d16461b11af49c61feaf8a737264c355627aa42a202981a1b8c40ed7fb37bb8c39791b2e0
7
- data.tar.gz: 0fc41aabba065a26cef8e432bf32b2c5c2927e9a3826cf89c578905e9154b51085ca447463e8feddff9ed7f21ae32ed5f79b65981dee54921f86d976c0b4b40d
6
+ metadata.gz: 59de2efb8bb15621e6479ba749b94228d0c61b0b244da02a6c95dc63668797c890090c49abe386a913ef096664b771a42e99b53d39ed698d4d30e45b2e324393
7
+ data.tar.gz: 108786af3a06da4539acb195f2d42c21b66fb0d7b05543ed800202c117a98531c1cd83ec1f31f3a8249ef7429458407c7d7991fc41052cb3c522ed47762d9afd
@@ -659,6 +659,20 @@ Errata tables must have a header row containing the headings _Date, Type, Change
659
659
  |===
660
660
  ----
661
661
 
662
+ === Lists
663
+
664
+ If an ordered list is intended to describe “steps” within a process, it should start with Arabic numbers and should be encoded with the class `steps`:
665
+
666
+ Encoding an ordered list as steps:
667
+
668
+ [source, asciidoctor]
669
+ ----
670
+ [class=steps]
671
+ . First Step
672
+ . Second Step
673
+ . Third Step
674
+ ----
675
+
662
676
  === Glosaries
663
677
 
664
678
  Glossaries are given as definition lists with role attribute `[.glossary]`:
@@ -402,6 +402,16 @@
402
402
  </choice>
403
403
  </attribute>
404
404
  </optional>
405
+ <optional>
406
+ <attribute name="valign">
407
+ <choice>
408
+ <value>top</value>
409
+ <value>middle</value>
410
+ <value>bottom</value>
411
+ <value>baseline</value>
412
+ </choice>
413
+ </attribute>
414
+ </optional>
405
415
  <choice>
406
416
  <zeroOrMore>
407
417
  <ref name="TextElement"/>
@@ -429,6 +439,16 @@
429
439
  </choice>
430
440
  </attribute>
431
441
  </optional>
442
+ <optional>
443
+ <attribute name="valign">
444
+ <choice>
445
+ <value>top</value>
446
+ <value>middle</value>
447
+ <value>bottom</value>
448
+ <value>baseline</value>
449
+ </choice>
450
+ </attribute>
451
+ </optional>
432
452
  <choice>
433
453
  <zeroOrMore>
434
454
  <ref name="TextElement"/>
@@ -998,6 +1018,9 @@
998
1018
  <value>alphabet_upper</value>
999
1019
  </choice>
1000
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1001
1024
  <oneOrMore>
1002
1025
  <ref name="li"/>
1003
1026
  </oneOrMore>
@@ -61,6 +61,15 @@ module Asciidoctor
61
61
  super
62
62
  end
63
63
 
64
+ def olist(node)
65
+ id = Asciidoctor::Standoc::Utils::anchor_or_uuid(node)
66
+ noko do |xml|
67
+ xml.ol **attr_code(id: id, class: node.attr("class")) do |xml_ol|
68
+ node.items.each { |item| li(xml_ol, item) }
69
+ end
70
+ end.join("\n")
71
+ end
72
+
64
73
  def glossary(node)
65
74
  noko do |xml|
66
75
  xml.dl **{id: Asciidoctor::Standoc::Utils::anchor_or_uuid(node),
@@ -79,8 +88,8 @@ module Asciidoctor
79
88
  end
80
89
 
81
90
  def doctype(node)
82
- d = node.attr("doctype")
83
- d = "standard" if d == "article" # article is Asciidoctor default
91
+ d = super || "standard"
92
+ d = "standard" if d == "article" # article is Asciidoctor default
84
93
  d
85
94
  end
86
95
 
@@ -140,6 +149,8 @@ module Asciidoctor
140
149
  case ret
141
150
  when "glossary", "terminology"
142
151
  "terms and definitions"
152
+ when "introduction"
153
+ "donotrecognise_introduction"
143
154
  else
144
155
  super
145
156
  end
@@ -5,14 +5,7 @@ require_relative "./front_id.rb"
5
5
 
6
6
  module Asciidoctor
7
7
  module NIST
8
- # A {Converter} implementation that generates RSD output, and a document
9
- # schema encapsulation of the document for validation
10
-
11
8
  class Converter < Standoc::Converter
12
- def doctype(node)
13
- node.attr("doctype") || "sp-800"
14
- end
15
-
16
9
  def datetypes
17
10
  super + %w(abandoned superseded)
18
11
  end
@@ -72,13 +65,21 @@ module Asciidoctor
72
65
  personal_author(node, xml)
73
66
  end
74
67
 
68
+ def default_publisher
69
+ "National Institute of Standards and Technology"
70
+ end
71
+
75
72
  def metadata_publisher(node, xml)
76
- xml.contributor do |c|
77
- c.role **{ type: "publisher" }
78
- c.organization do |a|
79
- a.name "National Institute of Standards and Technology"
80
- a.abbreviation "NIST"
81
- d = node.attr("nist-division") and a.subdivision d
73
+ publishers = node.attr("publisher") || default_publisher
74
+ csv_split(publishers)&.each do |p|
75
+ xml.contributor do |c|
76
+ c.role **{ type: "publisher" }
77
+ c.organization do |a|
78
+ a.name p
79
+ if p == default_publisher
80
+ d = node.attr("nist-division") and a.subdivision d
81
+ end
82
+ end
82
83
  end
83
84
  end
84
85
  end
@@ -111,20 +112,6 @@ module Asciidoctor
111
112
  end
112
113
  end
113
114
 
114
- def metadata_copyright(node, xml)
115
- from = node.attr("copyright-year") || node.attr("copyrightyear") ||
116
- Date.today.year
117
- xml.copyright do |c|
118
- c.from from
119
- c.owner do |owner|
120
- owner.organization do |o|
121
- o.name "National Institute of Standards and Technology"
122
- o.abbreviation "NIST"
123
- end
124
- end
125
- end
126
- end
127
-
128
115
  def metadata_source(node, xml)
129
116
  super
130
117
  node.attr("doc-email") && xml.uri(node.attr("doc-email"), type: "email")
@@ -157,7 +144,7 @@ module Asciidoctor
157
144
 
158
145
  def relaton_relation_descriptions
159
146
  super.merge({ "supersedes" => "obsoletes",
160
- "superseded-by" => "obsoleted-by", })
147
+ "superseded-by" => "obsoleted-by", })
161
148
  end
162
149
 
163
150
  def metadata_getrelation(node, xml, type, desc = nil)
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,6 +63,11 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -1049,14 +1085,17 @@
1049
1085
  <ref name="section-title"/>
1050
1086
  </optional>
1051
1087
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
1060
1099
  <zeroOrMore>
1061
1100
  <choice>
1062
1101
  <ref name="clause-subsection"/>
@@ -1453,11 +1492,6 @@
1453
1492
  </optional>
1454
1493
  </element>
1455
1494
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1495
  <define name="term-clause">
1462
1496
  <element name="clause">
1463
1497
  <optional>
@@ -1507,4 +1541,79 @@
1507
1541
  <ref name="CitationType"/>
1508
1542
  </element>
1509
1543
  </define>
1544
+ <define name="amend">
1545
+ <element name="amend">
1546
+ <optional>
1547
+ <attribute name="id">
1548
+ <data type="ID"/>
1549
+ </attribute>
1550
+ </optional>
1551
+ <attribute name="change">
1552
+ <choice>
1553
+ <value>add</value>
1554
+ <value>modify</value>
1555
+ <value>delete</value>
1556
+ </choice>
1557
+ </attribute>
1558
+ <optional>
1559
+ <attribute name="path"/>
1560
+ </optional>
1561
+ <optional>
1562
+ <attribute name="path_end"/>
1563
+ </optional>
1564
+ <optional>
1565
+ <attribute name="title"/>
1566
+ </optional>
1567
+ <optional>
1568
+ <element name="location">
1569
+ <zeroOrMore>
1570
+ <ref name="locality"/>
1571
+ </zeroOrMore>
1572
+ </element>
1573
+ </optional>
1574
+ <zeroOrMore>
1575
+ <ref name="autonumber"/>
1576
+ </zeroOrMore>
1577
+ <optional>
1578
+ <element name="description">
1579
+ <zeroOrMore>
1580
+ <ref name="BasicBlock"/>
1581
+ </zeroOrMore>
1582
+ </element>
1583
+ </optional>
1584
+ <optional>
1585
+ <element name="newcontent">
1586
+ <zeroOrMore>
1587
+ <ref name="BasicBlock"/>
1588
+ </zeroOrMore>
1589
+ </element>
1590
+ </optional>
1591
+ <optional>
1592
+ <element name="description">
1593
+ <zeroOrMore>
1594
+ <ref name="BasicBlock"/>
1595
+ </zeroOrMore>
1596
+ </element>
1597
+ </optional>
1598
+ </element>
1599
+ </define>
1600
+ <define name="autonumber">
1601
+ <element name="autonumber">
1602
+ <attribute name="type">
1603
+ <choice>
1604
+ <value>requirement</value>
1605
+ <value>recommendation</value>
1606
+ <value>permission</value>
1607
+ <value>table</value>
1608
+ <value>figure</value>
1609
+ <value>admonition</value>
1610
+ <value>formula</value>
1611
+ <value>sourcecode</value>
1612
+ <value>example</value>
1613
+ <value>note</value>
1614
+ </choice>
1615
+ </attribute>
1616
+ <text/>
1617
+ </element>
1618
+ </define>
1510
1619
  </grammar>
@@ -9,6 +9,24 @@
9
9
  <start>
10
10
  <ref name="nist-standard"/>
11
11
  </start>
12
+ <define name="ol">
13
+ <element name="ol">
14
+ <attribute name="id">
15
+ <data type="ID"/>
16
+ </attribute>
17
+ <optional>
18
+ <attribute name="class">
19
+ <value>steps</value>
20
+ </attribute>
21
+ </optional>
22
+ <oneOrMore>
23
+ <ref name="li"/>
24
+ </oneOrMore>
25
+ <zeroOrMore>
26
+ <ref name="note"/>
27
+ </zeroOrMore>
28
+ </element>
29
+ </define>
12
30
  <define name="DocumentType">
13
31
  <value>standard</value>
14
32
  </define>
@@ -16,7 +34,7 @@
16
34
  <define name="preface">
17
35
  <element name="preface">
18
36
  <optional>
19
- <ref name="preface_abstract"/>
37
+ <ref name="abstract"/>
20
38
  </optional>
21
39
  <optional>
22
40
  <ref name="foreword"/>
@@ -164,6 +182,13 @@
164
182
  </define>
165
183
  <define name="nist-standard">
166
184
  <element name="nist-standard">
185
+ <attribute name="version"/>
186
+ <attribute name="type">
187
+ <choice>
188
+ <value>semantic</value>
189
+ <value>presentation</value>
190
+ </choice>
191
+ </attribute>
167
192
  <ref name="bibdata"/>
168
193
  <zeroOrMore>
169
194
  <ref name="termdocsource"/>
@@ -6,18 +6,6 @@ require "fileutils"
6
6
  module IsoDoc
7
7
  module NIST
8
8
  module BaseConvert
9
- def keywords(docxml, out)
10
- f = docxml.at(ns("//preface/clause[@type = 'keywords']")) || return
11
- intro_clause(f, out)
12
- end
13
-
14
- def skip_render(c, isoxml)
15
- return false unless c.name == "reviewernote"
16
- status = isoxml&.at(ns("//bibdata/status/stage"))&.text
17
- return true if status.nil?
18
- /^final/.match status
19
- end
20
-
21
9
  def requirement_cleanup(docxml)
22
10
  docxml.xpath("//div[@class = 'recommend' or @class = 'require' "\
23
11
  "or @class = 'permission']").each do |d|
@@ -33,6 +21,7 @@ module IsoDoc
33
21
 
34
22
  def dl_parse(node, out)
35
23
  return glossary_parse(node, out) if node["type"] == "glossary"
24
+ return glossary_parse(node, out) if node.parent.name == "definitions"
36
25
  super
37
26
  end
38
27
 
@@ -63,9 +52,20 @@ module IsoDoc
63
52
  end
64
53
 
65
54
  def boilerplate(node, out)
66
- super
67
- page_break(out)
55
+ boilerplate = node.at(ns("//boilerplate")) or return
56
+ out.div **{class: "authority"} do |s|
57
+ boilerplate.children.each do |n|
58
+ if n.name == "title"
59
+ s.h1 do |h|
60
+ n.children.each { |nn| parse(nn, h) }
61
+ end
62
+ else
63
+ parse(n, s)
64
+ end
65
+ end
66
+ page_break(s)
68
67
  end
68
+ end
69
69
 
70
70
  def children_parse(node, out)
71
71
  node.children.each do |n|
@@ -127,7 +127,6 @@ module IsoDoc
127
127
  def info(isoxml, out)
128
128
  @meta.series isoxml, out
129
129
  @meta.commentperiod isoxml, out
130
- @meta.note isoxml, out
131
130
  super
132
131
  end
133
132
 
@@ -180,6 +179,18 @@ module IsoDoc
180
179
  out << " &mdash; "
181
180
  node.at(ns("./p")).children.each { |n| parse(n, out) }
182
181
  end
182
+
183
+ def ol_depth(node)
184
+ return super unless node["class"] == "steps" or
185
+ node.at(".//ancestor::xmlns:ol[@class = 'steps']")
186
+ depth = node.ancestors("ul, ol").size + 1
187
+ type = :arabic
188
+ type = :alphabet if [2, 7].include? depth
189
+ type = :roman if [3, 8].include? depth
190
+ type = :alphabet_upper if [4, 9].include? depth
191
+ type = :roman_upper if [5, 10].include? depth
192
+ ol_style(type)
193
+ end
183
194
  end
184
195
  end
185
196
  end