metanorma-nist 0.2.3 → 0.2.4

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: d9b324dd09a8d49e7d0f962d8f526c39770127b56a4dc9b2eedd3e34f5003eec
4
- data.tar.gz: c41f9cf011e6042a7658a173340d0ec8b83375c3d924a6485c2e382f57e49efb
3
+ metadata.gz: 1ade7003156424dd8933b9db67420ee3d8d16c5abafb109750a8c48abd7ec87e
4
+ data.tar.gz: 958c85c11773fd4eb70d0b6604026067e8e48962cda5ed2bdeea73d35916d42e
5
5
  SHA512:
6
- metadata.gz: 8f87e8f12899a69732ed0830a76166ad2d1147717d5430949631f5c246cd14557ab5add686da89cea525abd7370b7ad0b32b3b955cc834f118c6b44c90dfe5ad
7
- data.tar.gz: 750b3102e74993362d5225d23bbf874c30ddf4941810ca4e0faf4dc67577975e721195c1a889b83ab849bc25e32fd4a5a75e7ba634f61e34115cab51ac6b3a49
6
+ metadata.gz: 46c6f1a1a443e805b5362cd1e16d47d74a05e5586410c08ae989bfd363c5187df4c8062dd317be1cacfee085c2d0fb432c9b2def06496a287e26d242e01e5a85
7
+ data.tar.gz: 6a960942edd97e79272ab858ae2f3483bb49e8bc64fecfe55e0b627f686aa5495b712cf83f9d6a5ef0f8ac9effedec06f683bbb4bad35c1acd1ea60c5f99c2d4
@@ -0,0 +1,34 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: macos
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-macos:
9
+ name: Test on Ruby ${{ matrix.ruby }} macOS
10
+ runs-on: macos-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ run: |
23
+ sudo gem install bundler -v "~> 2" --force
24
+ bundle install --jobs 4 --retry 3
25
+ - name: Use Node
26
+ uses: actions/setup-node@v1
27
+ with:
28
+ node-version: '8'
29
+ - name: Install Puppeteer
30
+ run: |
31
+ npm install -g puppeteer
32
+ - name: Run specs
33
+ run: |
34
+ bundle exec rake
@@ -0,0 +1,34 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: ubuntu
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-linux:
9
+ name: Test on Ruby ${{ matrix.ruby }} Ubuntu
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ run: |
23
+ gem install bundler -v "~> 2"
24
+ bundle install --jobs 4 --retry 3
25
+ - name: Use Node
26
+ uses: actions/setup-node@v1
27
+ with:
28
+ node-version: '8'
29
+ - name: Install Puppeteer
30
+ run: |
31
+ npm install -g puppeteer
32
+ - name: Run specs
33
+ run: |
34
+ bundle exec rake
@@ -0,0 +1,37 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
3
+ name: windows
4
+
5
+ on: [push]
6
+
7
+ jobs:
8
+ test-windows:
9
+ name: Test on Ruby ${{ matrix.ruby }} Windows
10
+ runs-on: windows-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [ '2.6', '2.5', '2.4' ]
14
+ steps:
15
+ - uses: actions/checkout@master
16
+ - name: Use Ruby
17
+ uses: actions/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ architecture: 'x64'
21
+ - name: Update gems
22
+ shell: pwsh
23
+ run: |
24
+ gem install bundler -v "~> 2"
25
+ bundle config --local path vendor/bundle
26
+ bundle update
27
+ bundle install --jobs 4 --retry 3
28
+ - name: Use Node
29
+ uses: actions/setup-node@v1
30
+ with:
31
+ node-version: '8'
32
+ - name: Install Puppeteer
33
+ run: |
34
+ npm install -g puppeteer
35
+ - name: Run specs
36
+ run: |
37
+ bundle exec rake
data/README.adoc CHANGED
@@ -148,8 +148,12 @@ docnumber-edition (if edition is present)
148
148
  `:docidentifier:`:: The document identifier for the document. Normally this should not be supplied,
149
149
  as the document identifier is composed from the document series, document number, document volume,
150
150
  and edition/revision (e.g. _NIST SP 800 Revision 1_).
151
+
151
152
  If the `:docidentifier:` value is provided, it will override this composed value.
152
153
 
154
+ CSWP publications do not have a distinct `:docidentifier:` or `:docnumber:`: they are identified
155
+ by their `:issued-date:`.
156
+
153
157
  `:status:`:: Document status/stage. The permitted types are:
154
158
  +
155
159
  --
@@ -259,13 +263,13 @@ e.g. "Computer Security" for SP 800.
259
263
  publishes the document under.)
260
264
 
261
265
  `:call-for-patent-claims:`:: Include the Call for Patent Claims in document drafts,
262
- and the Patent Disclosure Notice in finalised documents.
266
+ and the Patent Disclosure Notice in finalised documents. (Not applicable to CSWP.)
263
267
 
264
268
  `:commitment-to-licence:`:: Indicate in the Patent Disclosure Notice that
265
- notice and commitment to license have been received.
269
+ notice and commitment to license have been received. (Not applicable to CSWP.)
266
270
 
267
271
  `:patent-contact:`:: Contact for the Call for Patent Claims or Patent Disclosure Notice.
268
- If not supplied, `:doc-email:` is used.
272
+ If not supplied, `:doc-email:` is used. (Not applicable to CSWP.)
269
273
 
270
274
  `:iteration:`:: The iteration of a stage, in case there have been multiple drafts.
271
275
  Can be a number, or text (e.g. "initial", "final").
@@ -294,8 +298,13 @@ Can be a number, or text (e.g. "initial", "final").
294
298
  * csrc-book
295
299
  * csrc-use-case
296
300
  * csrc-building-block
301
+ * nist-cswp
297
302
  --
298
303
 
304
+ Documents belonging to different series are expected to be rendered differently. As of this
305
+ writing, styling has been provided for `nist-cswp` (Cybersecurity White Papers) and for
306
+ `nist-sp` (SP-800).
307
+
299
308
  `:comment-from:`:: The beginning of the period during which comments may be submitted to the NIST
300
309
  document draft. ISO-8601 date.
301
310
 
@@ -311,7 +320,8 @@ forward. If present, bibliographies are treated in the legacy manner: they are t
311
320
  and are given an appendix number according to where in the document they occur.
312
321
 
313
322
  `:boilerplate-authority:`:: Nominate a Metanorma XML file encoding the authority statement of the document,
314
- to overwrite the default authority statement included in the gem (link:lib/asciidoctor/nist/nist_intro.xml[]),
323
+ to overwrite the default authority statement included in the gem
324
+ (link:lib/asciidoctor/nist/nist_intro.xml[], link:lib/asciidoctor/nist/nist_intro_cswp.xml[]),
315
325
  in case the document is historical, and needs to be generated with a previous authority statement.
316
326
 
317
327
  `:obsoletes:`::
@@ -422,15 +432,15 @@ The authority statement in NIST consists of five sections. They are semantically
422
432
  XML under the `boilerplate` tag, as subclauses:
423
433
 
424
434
  `boilerplate/legal-statement/clause[@id = 'authority1']`:: The initial section of the authority section ("This publication has been developed
425
- by NIST...").
426
- `boilerplate/legal-statement/clause[@id = 'authority2']`:: The identifier, revision date, and URL of the document.
435
+ by NIST..."). (Not applicable to CSWP.)
436
+ `boilerplate/legal-statement/clause[@id = 'authority2']`:: The identifier, revision date, and URL of the document. (Not applicanble to CSWP.)
427
437
  `boilerplate/legal-statement/clasue[@id = 'authority3']`:: The boxed disclaimer statement ("Any mention of commercial products or reference to commercial organizations...")
428
438
  `boilerplate/feedback-statement/clause[@id = 'authority4']`:: The public comment period, for drafts
429
439
  `boilerplate/feedback-statement/clause[@id = 'authority5']`:: The contact details for comments
430
440
 
431
441
  The authority statement has been marked up in Metanorma XML rather than Asciidoctor because of its complexity.
432
442
  If you wish to supply a different authority statement, you will need to provide a piece of Metanorma XML corresponding
433
- to the existing default statement (available from link:lib/asciidoctor/nist/nist_intro.xml[]), and containing
443
+ to the existing default statement (available from link:lib/asciidoctor/nist/nist_intro.xml[] and link:lib/asciidoctor/nist/nist_intro_cswp.xml[]), and containing
434
444
  text corresponding to the sections given above. You can give the location of your own authority statement file
435
445
  relative to the current document through the document attribute `:boilerplate-authority:`.
436
446
 
@@ -443,6 +443,9 @@
443
443
  <optional>
444
444
  <attribute name="subsequence"/>
445
445
  </optional>
446
+ <optional>
447
+ <ref name="tname"/>
448
+ </optional>
446
449
  <oneOrMore>
447
450
  <choice>
448
451
  <ref name="formula"/>
@@ -23,6 +23,7 @@ module Asciidoctor
23
23
  "csrc-book": "CSRC Book",
24
24
  "csrc-use-case": "CSRC Use Case",
25
25
  "csrc-building-block": "CSRC Building Block",
26
+ "nist-cswp": "NIST Cybersecurity White Paper",
26
27
  }.freeze
27
28
 
28
29
  SERIES_ABBR = {
@@ -47,6 +48,7 @@ module Asciidoctor
47
48
  "csrc-book": "CSRC Book",
48
49
  "csrc-use-case": "CSRC Use Case",
49
50
  "csrc-building-block": "CSRC Building Block",
51
+ "nist-cswp": "NIST CSWP",
50
52
  }.freeze
51
53
 
52
54
  CALL_FOR_PATENT_CLAIMS = <<~END.freeze
@@ -100,7 +102,7 @@ module Asciidoctor
100
102
  conv.labels = {nist_division: @nistdivision,
101
103
  nist_division_address: @nistdivisionaddress}
102
104
  file = @boilerplateauthority ? "#{@localdir}/#{@boilerplateauthority}" :
103
- File.join(File.dirname(__FILE__),"nist_intro.xml")
105
+ File.join(File.dirname(__FILE__), @series == "nist-cswp" ? "nist_intro_cswp.xml" : "nist_intro.xml")
104
106
  conv.populate_template((File.read(file, encoding: "UTF-8")), nil)
105
107
  end
106
108
  end
@@ -75,6 +75,7 @@ module Asciidoctor
75
75
  end
76
76
 
77
77
  def callforpatentclaims(x, preface)
78
+ return if @series == "nist-cswp"
78
79
  if @callforpatentclaims
79
80
  docemail = x&.at("//uri[@type = 'email']")&.text || "???"
80
81
  docnumber = x&.at("//docnumber")&.text || "???"
@@ -128,6 +128,7 @@ module Asciidoctor
128
128
  "Computer Security Division, Information Technology Laboratory"
129
129
  @nistdivisionaddress = node.attr("nist-division-address") ||
130
130
  "100 Bureau Drive (Mail Stop 8930) Gaithersburg, MD 20899-8930"
131
+ @series = node.attr("series")
131
132
  super
132
133
  end
133
134
 
@@ -4,11 +4,13 @@ require "fileutils"
4
4
 
5
5
  module Asciidoctor
6
6
  module NIST
7
-
8
7
  # A {Converter} implementation that generates RSD output, and a document
9
8
  # schema encapsulation of the document for validation
10
- #
9
+
11
10
  class Converter < Standoc::Converter
11
+ def doctype(node)
12
+ node.attr("doctype") || "sp-800"
13
+ end
12
14
 
13
15
  def datetypes
14
16
  super + %w(abandoned superseded)
@@ -63,6 +65,7 @@ module Asciidoctor
63
65
  def metadata_id(node, xml)
64
66
  did = node.attr("docidentifier")
65
67
  dn = node.attr("docnumber")
68
+ dn = Iso690Render.MMMddyyyy(node.attr("issued-date")) if @series == "nist-cswp" and !dn
66
69
  if did
67
70
  xml.docidentifier did, **attr_code(type: "NIST")
68
71
  xml.docidentifier unabbreviate(did), **attr_code(type: "nist-long")
@@ -124,7 +127,7 @@ module Asciidoctor
124
127
 
125
128
  def add_id_parts_mr(args)
126
129
  args[:series] and
127
- name = SERIES_ABBR.dig(args[:series].to_sym).sub(/^NIST /, "")
130
+ name = SERIES_ABBR&.dig(args[:series].to_sym)&.sub(/^NIST /, "")
128
131
  "NIST.#{name}.#{args[:vol]}.#{args[:revision]}.#{args[:date]}"
129
132
  end
130
133
 
@@ -189,8 +192,7 @@ module Asciidoctor
189
192
  end
190
193
 
191
194
  def metadata_series(node, xml)
192
- series = node.attr("series")
193
- series || return
195
+ series = node.attr("series") || "nist-sp"
194
196
  series and xml.series **{ type: "main" } do |s|
195
197
  s.title (SERIES.dig(series.to_sym) || series)
196
198
  SERIES_ABBR.dig(series.to_sym) and
@@ -44,6 +44,27 @@
44
44
  </oneOrMore>
45
45
  </element>
46
46
  </define>
47
+ <define name="references">
48
+ <element name="references">
49
+ <optional>
50
+ <attribute name="id">
51
+ <data type="ID"/>
52
+ </attribute>
53
+ </optional>
54
+ <optional>
55
+ <ref name="section-title"/>
56
+ </optional>
57
+ <zeroOrMore>
58
+ <ref name="BasicBlock"/>
59
+ </zeroOrMore>
60
+ <zeroOrMore>
61
+ <ref name="bibitem"/>
62
+ <zeroOrMore>
63
+ <ref name="note"/>
64
+ </zeroOrMore>
65
+ </zeroOrMore>
66
+ </element>
67
+ </define>
47
68
  </include>
48
69
  <define name="standard-document">
49
70
  <element name="standard-document">
@@ -0,0 +1,45 @@
1
+ <boilerplate>
2
+ <legal-statement>
3
+
4
+ <clause id="authority3">
5
+ <title>Disclaimer</title>
6
+ <p>Any mention of commercial products or reference to commercial organizations is for information only; it does not imply recommendation or endorsement by NIST, nor does it imply that the products mentioned are necessarily the best available for the purpose.</p>
7
+ </clause>
8
+
9
+ <clause id="authority3a">
10
+ <title>Additional Information</title>
11
+ <p>For additional information on NIST's Cybersecurity programs, projects and publications, visit the <link target="https://csrc.nist.gov">Computer Security Resource Center</link>. Information on other efforts at <link target="https://www.nist.gov">NIST</link> and in the <link target="https://www.nist.gov/itl">Information Technology Laboratory</link> (ITL) is also available.</p>
12
+ </clause>
13
+ </legal-statement>
14
+
15
+ <feedback-statement>
16
+ {% if unpublished %}
17
+ <clause id="authority4">
18
+ {% if comment_extended %}
19
+ <p align="center">[{{ comment_extended}}: Comment period extended]</p>
20
+ {% endif %}
21
+
22
+ {% if comment_from and comment_to %}
23
+ <p align="center"><strong>Public comment period: <em>{{ comment_from }}</em> through <em>{{comment_to}}</em></strong></p>
24
+ {% else %}
25
+ {% if comment_from %}
26
+ <p align="center"><strong>Public comment period: from <em>{{ comment_from }}</em></strong></p>
27
+ {% endif %}
28
+ {% endif %}
29
+ </clause>
30
+ {% endif %}
31
+
32
+ <clause id="authority5">
33
+ <p align="center"><strong>Comments on this publication may be submitted to:</strong></p>
34
+
35
+ <p align="center">National Institute of Standards and Technology <br/>
36
+ Attn: {{ nist_division }} <br/>
37
+ {{ nist_division_address }} <br/>
38
+ {% if email %}
39
+ Email: <link target="mailto:{{ email }}"/>
40
+ {% endif %}</p>
41
+
42
+ <p align="center">All comments are subject to release under the Freedom of Information Act (FOIA).</p>
43
+ </clause>
44
+ </feedback-statement>
45
+ </boilerplate>
@@ -189,8 +189,13 @@ module IsoDoc
189
189
  super
190
190
  end
191
191
 
192
+ def wrap_brackets(txt)
193
+ return txt if /^\[.*\]$/.match txt
194
+ "[#{txt}]"
195
+ end
196
+
192
197
  def get_linkend(node)
193
- link = anchor_linkend(node, docid_l10n(node["target"] || "[#{node['citeas']}]"))
198
+ link = anchor_linkend(node, docid_l10n(node["target"] || wrap_brackets(node['citeas'])))
194
199
  link += eref_localities(node.xpath(ns("./locality")), link)
195
200
  contents = node.children.select { |c| c.name != "locality" }
196
201
  return link if contents.nil? || contents.empty?
@@ -222,10 +227,13 @@ module IsoDoc
222
227
  def bibliography_parse(node, out)
223
228
  title = node&.at(ns("./title"))&.text || ""
224
229
  out.div do |div|
225
- node.parent.name == "annex" or
230
+ unless node.parent.name == "annex"
231
+ anchor(node['id'], :label, false) and
232
+ clause_parse_title(node, div, node.at(ns("./title")), out) or
226
233
  div.h2 title, **{ class: "Section3" }
234
+ end
227
235
  node.elements.reject do |e|
228
- ["reference", "title", "bibitem"].include? e.name
236
+ %w(reference title bibitem note).include? e.name
229
237
  end.each { |e| parse(e, div) }
230
238
  biblio_list(node, div, true)
231
239
  end