metanorma-nist 0.0.5 → 0.0.6

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: ed6d6518c86f59d927b205f623877b3e860e6874d561e1748b53142ee6d26d25
4
- data.tar.gz: 881aa89fd9aeceea3216f116fb5465fd2082bd636f77d6f4dbf6b15ef08a7ba6
3
+ metadata.gz: a296f752c16a5279fad1ac980465232967eee37122eb4f746109b4b6d27ff3e6
4
+ data.tar.gz: a9171483b061e88d6113149a523e04d6d18a8da3aa2edeeb5dfd999cad68bde9
5
5
  SHA512:
6
- metadata.gz: b468ba8980ad51e00d0ffddc0d09b3440fe6d1d2d381df330f2807cfdb476d460469a62fb36be75e0b031950a99394f0458236d442030540c5787bfcb51cde4d
7
- data.tar.gz: '0012912ef3a4dc926c45432ab69c30af5dd771b3042ca86e30615d892ca1eb1281d06dff0dc8372697e3a9b8e2f164ec3b2cbcf7447a1b8191e36a30632bfa23'
6
+ metadata.gz: 70afce02c91127a9e83bf4e38f34d7562dd48eb844efac9e13995717022b927f9d4431bb2fde216f9ac3cb2c18a6dffaf330cd74a84f138bfd7daa8071d13702
7
+ data.tar.gz: c82dcd587d815256fd895edb0fa4ff73502e6d6a15507bfa22fb5ce0a40efcde5381b0dbe9ccb253c02fbe5de078c95cd3e0899e857314d6d59f48e89a494de3
data/README.adoc CHANGED
@@ -128,9 +128,7 @@ the document was issued.
128
128
  (mandatory). If absent, the first line of the AsciiDoc document, which contains the title
129
129
  introduced with `=`, is used.
130
130
 
131
- `:title-sub:`:: The subtitle of the document.
132
-
133
- `:technical-committee:`:: The name of the relevant committee producing the document (mandatory).
131
+ `:technical-committee:`:: The name of the relevant committee producing the document.
134
132
 
135
133
  `:published-date:`:: The publication date for the document.
136
134
 
@@ -142,8 +140,8 @@ docnumber-edition (if edition is present)
142
140
 
143
141
  `:docidentifier:`:: The document identifier for the document. Normally this should not be supplied,
144
142
  as the document identifier is composed from the document series, document number,
145
- and edition/revision. If the `:docidentifier:` value is provided, it will override this composed
146
- value.
143
+ and edition/revision (e.g. _NIST SP 800 Revision 1_).
144
+ If the `:docidentifier:` value is provided, it will override this composed value.
147
145
 
148
146
  `:edition:`:: Edition (revision) of the document. The value of
149
147
  this attribute will be displayed as part of the heading, prefixed with "Revision".
@@ -158,48 +156,44 @@ this attribute will be displayed as part of the heading, prefixed with "Revision
158
156
  * `withdrawn`
159
157
  --
160
158
 
161
- ////
159
+ `:fullname{_i}:`, `:affiliation{_i}:`, `:address{_i}`::
160
+ The full name of a person who is a contributor to the document,
161
+ their organization, and the address of that person or organization.
162
+ In NIST, only the city is given as the address.
163
+ A second person is indicated by using a numeric suffix: `:fullname:`, `:fullname_2:`, `fullname_3:`, &c.
164
+ The same convention applies to all the following attributes.
162
165
 
163
- `:doctype:`:: The document type (mandatory). The permitted types are:
164
- +
165
- --
166
- * Standards
167
- `standard`::: Implementation Standard
168
- `standard-with-suite`::: Implementation Standard with Compliance Suite
169
- `abstract-specification`::: Abstract Specification
170
- `community-standard`::: Community Standard
171
- `profile`::: Profile / Application Profile
172
- `best-practice`::: Best Practices Document
173
-
174
- * Other
175
- `engineering-report`::: Engineering Report
176
- `discussion-paper`::: Discussion Paper
177
- `reference-model`::: OGC Reference Model
178
- `user-guide`::: User Guide
179
- `policy`::: OGC Policy Document
180
- `guide`::: Guide
181
- `amendment`::: Technical Amendment
182
- `technical-corrigendum`::: Corrigendum (errata) Changes to OGC Standards
183
- `administrative`::: Internal administrative documents
184
- --
166
+ [[surname]] `:surname{_i}:`::
167
+ The surname of a person who is a contributor to the document.
185
168
 
186
- `:committee:`:: The name of the relevant committee producing the document (mandatory). The legal values are:
187
- `technical`, `planning`, `strategic-member-advisory`
188
- `:subcommittee:`:: The name of the relevant subcommittee producing the document
189
- `:workgroup:` (OGC: `:workingGroup:`):: The name of the relevant working group producing the document (mandatory)
169
+ [[givenname]] `:givenname{_i}:`::
170
+ The given name(s) of a person who is a contributor to the document.
190
171
 
191
- `:published-date:` (OGC: `:publicationDate:`):: The publication date for the document.
192
- `:issued-date:` (OGC: `:approvalDate:`):: The approval date for the document.
193
- `:created-date:`:: The creation date for the document.
194
- `:received-date:` (OGC: `:submissionDate:`):: The date at which the document was submitted to the standards body.
172
+ `:initials{_i}:`::
173
+ The initials(s) of a person who is a contributor to the document.
195
174
 
196
- ////
175
+ [[role]] `:role{_i}:`::
176
+ The role of a a person who is a contributor to the document.
177
+ By default, they are coded as an `editor`; they can also be represented as an `author`.
178
+
179
+ `:affiliation{_i}:`::
180
+ The organizational affiliation of a person who is a contributor to the document.
181
+
182
+ `:address{_i}:`::
183
+ The organizational address of a person who is a contributor to the document.
184
+
185
+ `:obsoleted-date:`::
186
+ The date at which a document is considered no longer valid (withdrawn). If a document
187
+ is not currently withdrawn (as indicated through `:status: withdrawn`),
188
+ but will be in the future, that is still indicated in the rendering of the document.
197
189
 
198
190
  === NIST-specific attributes
199
191
 
200
192
  The following document attributes are specific to this document class:
201
193
 
202
- `:subtitle:`:: Document subtitle.
194
+ `:title-sub:`:: The subtitle of the document.
195
+ `:title-document-class:`:: The title of the document class that the document belongs to;
196
+ e.g. "Computer Security" for SP 800.
203
197
 
204
198
  `:keywords:`:: Comma-delimited list of the keywords associated with the document.
205
199
 
@@ -267,12 +261,85 @@ they are published in front of any appendixes. This is the prescribed behaviour
267
261
  forward. If present, bibliographies are treated in the legacy manner: they are treated like appendixes,
268
262
  and are given an appendix number according to where in the document they occur.
269
263
 
264
+ `:boilerplate-authority:`:: Nominate a Metanorma XML file encoding the authority statement of the document,
265
+ to overwrite the default authority statement included in the gem (link:lib/asciidoctor/nist/nist_intro.xml[]),
266
+ in case the document is historical, and needs to be generated with a previous authority statement.
267
+
268
+ `:obsoletes:`::
269
+ One or more NIST document that this NIST document standard renders obsolete; implies that the obsoleted
270
+ document is withdrawn, and no longer in effect. Comma delimited.
271
+ Format is document identifier, e.g. _SP 800-53A Rev. 1_
272
+
273
+ `:obsoleted-by:`::
274
+ One or more corresponding NIST document that this NIST document standard is obsoleted by; requires that
275
+ this document is withdrawn, and no longer in effect. Comma delimited.
276
+ Format is document identifier, e.g. _SP 800-53A Rev. 1_
277
+
278
+ `:supersedes:`::
279
+ One or more NIST document that this NIST document standard supersedes; the superseded
280
+ document may still remain in effect. Comma delimited.
281
+ Format is document identifier, e.g. _SP 800-53A Rev. 1_
282
+
283
+ `:superseded-by`::
284
+ One or more corresponding NIST document that this NIST document standard is superseded by;
285
+ this document may still remain in effect. Comma delimited.
286
+ Format is document identifier, e.g. _SP 800-53A Rev. 1_
287
+
288
+
270
289
  == Asciidoctor features specific to NIST
271
290
 
272
291
  The https://github.com/metanorma/metanorma-standoc[metanorma-standoc]
273
292
  gem documents the customisations of Asciidoctor markup common to all metanorma gems.
274
293
  The following markup is specific to this gem:
275
294
 
295
+ === Authority statement
296
+
297
+ The authority statement in NIST consists of five sections, and these are marked up in
298
+ Metanorma XML with the tags `<authority1>, <authority2>, <authority3>, <authority4>, <authority5>`:
299
+
300
+ `authority1`:: The initial section of the authority section ("This publication has been developed
301
+ by NIST...").
302
+ `authority2`:: The identifier, revision date, and URL of the document.
303
+ `authority3`:: The boxed disclaimer statement ("Any mention of commercial products or reference to commercial organizations...")
304
+ `authority4`:: The public comment period, for drafts
305
+ `authority5`:: The contact details for comments
306
+
307
+ The authority statement has been marked up in Metanorma XML rather than Asciidoctor because of its complexity.
308
+ If you wish to supply a different authority statement, you will need to provide a piece of Metanorma XML corresponding
309
+ to the existing default statement (available from link:lib/asciidoctor/nist/nist_intro.xml[]), and containing
310
+ text corresponding to the sections given above. You can give the location of your own authority statement file
311
+ relative to the current document through the document attribute `:boilerplate-authority:`.
312
+
313
+ === Author affiliations
314
+
315
+ Each author of a NIST document may have their own organizational affiliation, and optionally
316
+ a city for that organization. This information is given using the `:fullname:`, `:affiliation:`,
317
+ and `:address:` document attributes, with separate organization and address listings for each
318
+ author. Metanorma will take care of grouping authors together by organization.
319
+
320
+ [source,asciidoctor]
321
+ --
322
+ :fullname: Hildegard Ferraiolo
323
+ :affiliation: Computer Security Division, Information Technology Laboratory
324
+ :fullname_2: Ketan Mehta
325
+ :affiliation_2: Computer Security Division, Information Technology Laboratory
326
+ :fullname_3: Nabil Ghadiali
327
+ :affiliation_3: National Gallery of Art
328
+ :address_3: Washington, DC
329
+ :fullname_4: Jason Mohler
330
+ :affiliation_4: Electrosoft Services, Inc.
331
+ :address_4: Reston, Virginia
332
+ :fullname_5: Vincent Johnson
333
+ :affiliation_5: Electrosoft Services, Inc.
334
+ :address_5: Reston, Virginia
335
+ :fullname_6: Steven Brady
336
+ :affiliation_6: Electrosoft Services, Inc.
337
+ :address_6: Reston, Virginia
338
+ --
339
+
340
+ Note that the organization location must be given for every author it applies to; rendering will differentiate
341
+ between different locations of the same organization.
342
+
276
343
  === Preface
277
344
 
278
345
  The following sections are automatically moved to the document preface.
@@ -837,26 +837,29 @@
837
837
  <ref name="ContributorInfo"/>
838
838
  </element>
839
839
  </define>
840
+ <define name="DocRelationType">
841
+ <choice>
842
+ <value>obsoletes</value>
843
+ <value>updates</value>
844
+ <value>updatedBy</value>
845
+ <value>complements</value>
846
+ <value>derivedFrom</value>
847
+ <value>translatedFrom</value>
848
+ <value>adoptedFrom</value>
849
+ <value>equivalent</value>
850
+ <value>identical</value>
851
+ <value>nonequivalent</value>
852
+ <value>includedIn</value>
853
+ <value>includes</value>
854
+ <value>instance</value>
855
+ <value>partOf</value>
856
+ <value>hasDraft</value>
857
+ </choice>
858
+ </define>
840
859
  <define name="docrelation">
841
860
  <element name="relation">
842
861
  <attribute name="type">
843
- <choice>
844
- <value>obsoletes</value>
845
- <value>updates</value>
846
- <value>updatedBy</value>
847
- <value>complements</value>
848
- <value>derivedFrom</value>
849
- <value>translatedFrom</value>
850
- <value>adoptedFrom</value>
851
- <value>equivalent</value>
852
- <value>identical</value>
853
- <value>nonequivalent</value>
854
- <value>includedIn</value>
855
- <value>includes</value>
856
- <value>instance</value>
857
- <value>partOf</value>
858
- <value>hasDraft</value>
859
- </choice>
862
+ <ref name="DocRelationType"/>
860
863
  </attribute>
861
864
  <element name="bibitem">
862
865
  <ref name="BibliographicItem"/>
@@ -0,0 +1,58 @@
1
+ module Asciidoctor
2
+ module NIST
3
+ class Converter < Standoc::Converter
4
+ CALL_FOR_PATENT_CLAIMS = <<~END.freeze
5
+ <clause><title>Call for Patent Claims</title>
6
+ <p>This public review includes a call for information on essential patent claims (claims whose use would be required for compliance with the guidance or requirements in this Information Technology Laboratory (ITL) draft publication). Such guidance and/or requirements may be directly stated in this ITL Publication or by reference to another publication. This call also includes disclosure, where known, of the existence of pending U.S. or foreign patent applications relating to this ITL draft publication and of any relevant unexpired U.S. or foreign patents.</p>
7
+
8
+ <p>ITL may require from the patent holder, or a party authorized to make assurances on its behalf, in written or electronic form, either:</p>
9
+
10
+ <ol><li><p>assurance in the form of a general disclaimer to the effect that such party does not hold and does not currently intend holding any essential patent claim(s); or</p></li>
11
+
12
+ <li><p>assurance that a license to such essential patent claim(s) will be made available to applicants desiring to utilize the license for the purpose of complying with the guidance or requirements in this ITL draft publication either:</p>
13
+
14
+ <ol><li><p>under reasonable terms and conditions that are demonstrably free of any unfair discrimination; or</p></li>
15
+
16
+ <li><p>without compensation and under reasonable terms and conditions that are demonstrably free of any unfair discrimination.</p></li></ol>
17
+ </li></ol>
18
+
19
+ <p>Such assurance shall indicate that the patent holder (or third party authorized to make assurances on its behalf) will include in any documents transferring ownership of patents subject to the assurance, provisions sufficient to ensure that the commitments in the assurance are binding on the transferee, and that the transferee will similarly include appropriate provisions in the event of future transfers with the goal of binding each successor-in-interest.</p>
20
+
21
+ <p>The assurance shall also indicate that it is intended to be binding on successors-in-interest regardless of whether such provisions are included in the relevant transfer documents.</p>
22
+
23
+ <p>Such statements should be addressed to: ITL-POINT-OF_CONTACT.</p>
24
+ </clause>
25
+ END
26
+
27
+ PATENT_DISCLOSURE_NOTICE1 = <<~END.freeze
28
+ <clause><title>Patent Disclosure Notice</title>
29
+ <p>NOTICE: The Information Technology Laboratory (ITL) has requested that holders of patent claims whose use may be required for compliance with the guidance or requirements of this publication disclose such patent claims to ITL. However, holders of patents are not obligated to respond to ITL calls for patents and ITL has not undertaken a patent search in order to identify which, if any, patents may apply to this publication. </p>
30
+ <p>Following the ITL call for the identification of patent claims whose use may be required for compliance with the guidance or requirements of this publication, notice of one or more such claims has been received. </p>
31
+ <p>By publication, no position is taken by ITL with respect to the validity or scope of any patent claim or of any rights in connection therewith. The known patent holder(s) has (have), however, provided to NIST a letter of assurance stating either (1) a general disclaimer to the effect that it does (they do) not hold and does (do) not currently intend holding any essential patent claim(s), or (2) that it (they) will negotiate royalty-free or royalty-bearing licenses with other parties on a demonstrably nondiscriminatory basis with reasonable terms and conditions. </p>
32
+ <p>Details may be obtained from ITL-POINT-OF_CONTACT. </p>
33
+ <p>No representation is made or implied that this is the only license that may be required to avoid patent infringement in the use of this publication. </p>
34
+ </clause>
35
+ END
36
+
37
+ PATENT_DISCLOSURE_NOTICE2 = <<~END.freeze
38
+ <clause><title>Patent Disclosure Notice</title>
39
+ <p>NOTICE: ITL has requested that holders of patent claims whose use may be required for compliance with the guidance or requirements of this publication disclose such patent claims to ITL. However, holders of patents are not obligated to respond to ITL calls for patents and ITL has not undertaken a patent search in order to identify which, if any, patents may apply to this publication.</p>
40
+ <p>As of the date of publication and following call(s) for the identification of patent claims whose use may be required for compliance with the guidance or requirements of this publication, no such patent claims have been identified to ITL.</p>
41
+ <p>No representation is made or implied by ITL that licenses are not required to avoid patent infringement in the use of this publication.</p>
42
+ </clause>
43
+ END
44
+
45
+ def boilerplate(x_orig)
46
+ x = x_orig.dup
47
+ x.root.add_namespace(nil, EXAMPLE_NAMESPACE)
48
+ x = Nokogiri::XML(x.to_xml)
49
+ conv = IsoDoc::NIST::HtmlConvert.new({})
50
+ conv.metadata_init("en", "Latn", {})
51
+ conv.info(x, nil)
52
+ file = @boilerplateauthority ? "#{@localdir}/#{@boilerplateauthority}" :
53
+ File.join(File.dirname(__FILE__),"nist_intro.xml")
54
+ conv.populate_template((File.read(file, encoding: "UTF-8")), nil)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,89 @@
1
+ module Asciidoctor
2
+ module NIST
3
+ class Converter < Standoc::Converter
4
+ def cleanup(xmldoc)
5
+ sourcecode_cleanup(xmldoc)
6
+ super
7
+ end
8
+
9
+ def sourcecode_cleanup(xmldoc)
10
+ xmldoc.xpath("//sourcecode").each do |x|
11
+ x.traverse do |n|
12
+ next unless n.text?
13
+ n.replace(Nokogiri::XML::NodeSet.new(n.document,
14
+ nistvariable_insert(n)))
15
+ end
16
+ end
17
+ end
18
+
19
+ # skip annex/terms/terms, which is empty node
20
+ def termdef_subclause_cleanup(xmldoc)
21
+ xmldoc.xpath("//terms[terms]").each do |t|
22
+ next if t.parent.name == "terms"
23
+ t.children.each { |n| n.parent = t.parent }
24
+ t.remove
25
+ end
26
+ end
27
+
28
+ def sections_cleanup(x)
29
+ super
30
+ x.xpath("//*[@inline-header]").each do |h|
31
+ h.delete("inline-header")
32
+ end
33
+ end
34
+
35
+ def move_sections_into_preface(x, preface)
36
+ abstract = x.at("//abstract")
37
+ preface.add_child abstract.remove if abstract
38
+ if x.at("//authority")
39
+ boilerplate = x.at("//authority")
40
+ preface.add_child boilerplate.remove
41
+ else
42
+ preface.add_child boilerplate(x)
43
+ end
44
+ foreword = x.at("//foreword")
45
+ preface.add_child foreword.remove if foreword
46
+ introduction = x.at("//introduction")
47
+ preface.add_child introduction.remove if introduction
48
+ x.xpath("//clause[@preface]").each do |c|
49
+ c.delete("preface")
50
+ title = c&.at("./title")&.text.downcase
51
+ c.name = "reviewernote" if title == "note to reviewers"
52
+ c.name = "executivesummary" if title == "executive summary"
53
+ preface.add_child c.remove
54
+ end
55
+ callforpatentclaims(x, preface)
56
+ end
57
+
58
+ def callforpatentclaims(x, preface)
59
+ if @callforpatentclaims
60
+ docemail = x&.at("//uri[@type = 'email']")&.text || "???"
61
+ docnumber = x&.at("//docnumber")&.text || "???"
62
+ status = x&.at("//bibdata/status/stage")&.text
63
+ published = status.nil? || status == "final"
64
+ preface.add_child patent_text(published, docemail, docnumber)
65
+ end
66
+ end
67
+
68
+ def patent_text(published, docemail, docnumber)
69
+ patent = (!published ? CALL_FOR_PATENT_CLAIMS :
70
+ (@commitmenttolicence ? PATENT_DISCLOSURE_NOTICE1 :
71
+ PATENT_DISCLOSURE_NOTICE2)).clone
72
+ patent.gsub(/ITL-POINT-OF_CONTACT/, published ?
73
+ (@patentcontact || docemail) :
74
+ (@patentcontact ||
75
+ "#{docemail}, with the Subject: #{docnumber} "\
76
+ "Call for Patent Claims"))
77
+ end
78
+
79
+ def make_preface(x, s)
80
+ #if x.at("//foreword | //introduction | //abstract | //preface") ||
81
+ # @callforpatentclaims
82
+ preface = s.add_previous_sibling("<preface/>").first
83
+ move_sections_into_preface(x, preface)
84
+ summ = x.at("//executivesummary") and preface.add_child summ.remove
85
+ #end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -4,6 +4,9 @@ require "asciidoctor/standoc/converter"
4
4
  require "isodoc/nist/html_convert"
5
5
  require "isodoc/nist/word_convert"
6
6
  require_relative "front"
7
+ require_relative "boilerplate"
8
+ require_relative "validate"
9
+ require_relative "cleanup"
7
10
  require "fileutils"
8
11
 
9
12
  module Asciidoctor
@@ -12,10 +15,6 @@ module Asciidoctor
12
15
 
13
16
  register_for "nist"
14
17
 
15
- def title_validate(root)
16
- nil
17
- end
18
-
19
18
  def example(node)
20
19
  return pseudocode_example(node) if node.attr("style") == "pseudocode"
21
20
  super
@@ -78,11 +77,6 @@ module Asciidoctor
78
77
  end.join("\n")
79
78
  end
80
79
 
81
- def cleanup(xmldoc)
82
- sourcecode_cleanup(xmldoc)
83
- super
84
- end
85
-
86
80
  def nistvariable_insert(n)
87
81
  acc = []
88
82
  n.text.split(/((?<!\{)\{{3}(?!\{)|(?<!\})\}{3}(?!\}))/).each_slice(4).
@@ -95,25 +89,6 @@ module Asciidoctor
95
89
  acc
96
90
  end
97
91
 
98
- def sourcecode_cleanup(xmldoc)
99
- xmldoc.xpath("//sourcecode").each do |x|
100
- x.traverse do |n|
101
- next unless n.text?
102
- n.replace(Nokogiri::XML::NodeSet.new(n.document,
103
- nistvariable_insert(n)))
104
- end
105
- end
106
- end
107
-
108
- # skip annex/terms/terms, which is empty node
109
- def termdef_subclause_cleanup(xmldoc)
110
- xmldoc.xpath("//terms[terms]").each do |t|
111
- next if t.parent.name == "terms"
112
- t.children.each { |n| n.parent = t.parent }
113
- t.remove
114
- end
115
- end
116
-
117
92
  def makexml(node)
118
93
  result = ["<?xml version='1.0' encoding='UTF-8'?>\n<nist-standard>"]
119
94
  @draft = node.attributes.has_key?("draft")
@@ -129,12 +104,7 @@ module Asciidoctor
129
104
 
130
105
  def doctype(node)
131
106
  d = node.attr("doctype")
132
- unless %w{policy-and-procedures best-practices
133
- supporting-document report legal directives proposal
134
- standard}.include? d
135
- warn "#{d} is not a legal document type: reverting to 'standard'"
136
- d = "standard"
137
- end
107
+ d = "standard" if d == "article" # article is Asciidoctor default
138
108
  d
139
109
  end
140
110
 
@@ -143,6 +113,7 @@ module Asciidoctor
143
113
  @commitmenttolicence = node.attr("commitment-to-licence")
144
114
  @patentcontact = node.attr("patent-contact")
145
115
  @biblioasappendix = node.attr("biblio-as-appendix")
116
+ @boilerplateauthority = node.attr("boilerplate-authority")
146
117
  super
147
118
  end
148
119
 
@@ -162,107 +133,6 @@ module Asciidoctor
162
133
  ret
163
134
  end
164
135
 
165
- def validate(doc)
166
- content_validate(doc)
167
- schema_validate(formattedstr_strip(doc.dup),
168
- File.join(File.dirname(__FILE__), "nist.rng"))
169
- end
170
-
171
- def sections_cleanup(x)
172
- super
173
- x.xpath("//*[@inline-header]").each do |h|
174
- h.delete("inline-header")
175
- end
176
- end
177
-
178
- def move_sections_into_preface(x, preface)
179
- abstract = x.at("//abstract")
180
- preface.add_child abstract.remove if abstract
181
- foreword = x.at("//foreword")
182
- preface.add_child foreword.remove if foreword
183
- introduction = x.at("//introduction")
184
- preface.add_child introduction.remove if introduction
185
- x.xpath("//clause[@preface]").each do |c|
186
- c.delete("preface")
187
- title = c&.at("./title")&.text.downcase
188
- c.name = "reviewernote" if title == "note to reviewers"
189
- c.name = "executivesummary" if title == "executive summary"
190
- preface.add_child c.remove
191
- end
192
- callforpatentclaims(x, preface)
193
- end
194
-
195
- CALL_FOR_PATENT_CLAIMS = <<~END.freeze
196
- <clause><title>Call for Patent Claims</title>
197
- <p>This public review includes a call for information on essential patent claims (claims whose use would be required for compliance with the guidance or requirements in this Information Technology Laboratory (ITL) draft publication). Such guidance and/or requirements may be directly stated in this ITL Publication or by reference to another publication. This call also includes disclosure, where known, of the existence of pending U.S. or foreign patent applications relating to this ITL draft publication and of any relevant unexpired U.S. or foreign patents.</p>
198
-
199
- <p>ITL may require from the patent holder, or a party authorized to make assurances on its behalf, in written or electronic form, either:</p>
200
-
201
- <ol><li><p>assurance in the form of a general disclaimer to the effect that such party does not hold and does not currently intend holding any essential patent claim(s); or</p></li>
202
-
203
- <li><p>assurance that a license to such essential patent claim(s) will be made available to applicants desiring to utilize the license for the purpose of complying with the guidance or requirements in this ITL draft publication either:</p>
204
-
205
- <ol><li><p>under reasonable terms and conditions that are demonstrably free of any unfair discrimination; or</p></li>
206
-
207
- <li><p>without compensation and under reasonable terms and conditions that are demonstrably free of any unfair discrimination.</p></li></ol>
208
- </li></ol>
209
-
210
- <p>Such assurance shall indicate that the patent holder (or third party authorized to make assurances on its behalf) will include in any documents transferring ownership of patents subject to the assurance, provisions sufficient to ensure that the commitments in the assurance are binding on the transferee, and that the transferee will similarly include appropriate provisions in the event of future transfers with the goal of binding each successor-in-interest.</p>
211
-
212
- <p>The assurance shall also indicate that it is intended to be binding on successors-in-interest regardless of whether such provisions are included in the relevant transfer documents.</p>
213
-
214
- <p>Such statements should be addressed to: ITL-POINT-OF_CONTACT.</p>
215
- </clause>
216
- END
217
-
218
- PATENT_DISCLOSURE_NOTICE1 = <<~END.freeze
219
- <clause><title>Patent Disclosure Notice</title>
220
- <p>NOTICE: The Information Technology Laboratory (ITL) has requested that holders of patent claims whose use may be required for compliance with the guidance or requirements of this publication disclose such patent claims to ITL. However, holders of patents are not obligated to respond to ITL calls for patents and ITL has not undertaken a patent search in order to identify which, if any, patents may apply to this publication. </p>
221
- <p>Following the ITL call for the identification of patent claims whose use may be required for compliance with the guidance or requirements of this publication, notice of one or more such claims has been received. </p>
222
- <p>By publication, no position is taken by ITL with respect to the validity or scope of any patent claim or of any rights in connection therewith. The known patent holder(s) has (have), however, provided to NIST a letter of assurance stating either (1) a general disclaimer to the effect that it does (they do) not hold and does (do) not currently intend holding any essential patent claim(s), or (2) that it (they) will negotiate royalty-free or royalty-bearing licenses with other parties on a demonstrably nondiscriminatory basis with reasonable terms and conditions. </p>
223
- <p>Details may be obtained from ITL-POINT-OF_CONTACT. </p>
224
- <p>No representation is made or implied that this is the only license that may be required to avoid patent infringement in the use of this publication. </p>
225
- </clause>
226
- END
227
-
228
- PATENT_DISCLOSURE_NOTICE2 = <<~END.freeze
229
- <clause><title>Patent Disclosure Notice</title>
230
- <p>NOTICE: ITL has requested that holders of patent claims whose use may be required for compliance with the guidance or requirements of this publication disclose such patent claims to ITL. However, holders of patents are not obligated to respond to ITL calls for patents and ITL has not undertaken a patent search in order to identify which, if any, patents may apply to this publication.</p>
231
- <p>As of the date of publication and following call(s) for the identification of patent claims whose use may be required for compliance with the guidance or requirements of this publication, no such patent claims have been identified to ITL.</p>
232
- <p>No representation is made or implied by ITL that licenses are not required to avoid patent infringement in the use of this publication.</p>
233
- </clause>
234
- END
235
-
236
- def callforpatentclaims(x, preface)
237
- if @callforpatentclaims
238
- docemail = x&.at("//uri[@type = 'email']")&.text || "???"
239
- docnumber = x&.at("//docnumber")&.text || "???"
240
- status = x&.at("//bibdata/status/stage")&.text
241
- published = status.nil? || status == "final"
242
- preface.add_child patent_text(published, docemail, docnumber)
243
- end
244
- end
245
-
246
- def patent_text(published, docemail, docnumber)
247
- patent = (!published ? CALL_FOR_PATENT_CLAIMS :
248
- (@commitmenttolicence ? PATENT_DISCLOSURE_NOTICE1 :
249
- PATENT_DISCLOSURE_NOTICE2)).clone
250
- patent.gsub(/ITL-POINT-OF_CONTACT/, published ?
251
- (@patentcontact || docemail) :
252
- (@patentcontact ||
253
- "#{docemail}, with the Subject: #{docnumber} "\
254
- "Call for Patent Claims"))
255
- end
256
-
257
- def make_preface(x, s)
258
- if x.at("//foreword | //introduction | //abstract | //preface") ||
259
- @callforpatentclaims
260
- preface = s.add_previous_sibling("<preface/>").first
261
- move_sections_into_preface(x, preface)
262
- summ = x.at("//executivesummary") and preface.add_child summ.remove
263
- end
264
- end
265
-
266
136
  def clause_parse(attrs, xml, node)
267
137
  attrs[:preface] = true if node.attr("style") == "preface"
268
138
  super
@@ -351,21 +221,6 @@ module Asciidoctor
351
221
  end
352
222
  end
353
223
 
354
- SECTIONS_TO_VALIDATE = "//references[not(parent::clause)]/title | "\
355
- "//clause[descendant::references][not(parent::clause)]/title".freeze
356
-
357
- def section_validate(doc)
358
- super
359
- f = doc.xpath(SECTIONS_TO_VALIDATE)
360
- names = f.map { |s| s&.text }
361
- return if names.empty?
362
- return if names == ["References"]
363
- return if names == ["Bibliography"]
364
- return if names == ["References", "Bibliography"]
365
- warn "Reference clauses #{names.join(', ')} do not follow expected "\
366
- "pattern in NIST"
367
- end
368
-
369
224
  def sections_order_cleanup(x)
370
225
  s = x.at("//sections")
371
226
  make_preface(x, s)