metanorma-nist 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.hound.yml +3 -0
  3. data/.rubocop.yml +10 -0
  4. data/.travis.yml +16 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +25 -0
  8. data/README.adoc +358 -0
  9. data/bin/console +14 -0
  10. data/bin/rspec +18 -0
  11. data/bin/setup +8 -0
  12. data/lib/asciidoctor/nist.rb +7 -0
  13. data/lib/asciidoctor/nist/biblio.rng +921 -0
  14. data/lib/asciidoctor/nist/converter.rb +271 -0
  15. data/lib/asciidoctor/nist/front.rb +150 -0
  16. data/lib/asciidoctor/nist/isodoc.rng +1063 -0
  17. data/lib/asciidoctor/nist/isostandard.rng +1071 -0
  18. data/lib/asciidoctor/nist/nist.rng +196 -0
  19. data/lib/isodoc/nist/html/commerce-logo-color.png +0 -0
  20. data/lib/isodoc/nist/html/deptofcommerce.png +0 -0
  21. data/lib/isodoc/nist/html/header.html +163 -0
  22. data/lib/isodoc/nist/html/html_nist_intro.html +46 -0
  23. data/lib/isodoc/nist/html/html_nist_titlepage.html +140 -0
  24. data/lib/isodoc/nist/html/htmlstyle.scss +1160 -0
  25. data/lib/isodoc/nist/html/logo.png +0 -0
  26. data/lib/isodoc/nist/html/nist.scss +749 -0
  27. data/lib/isodoc/nist/html/scripts.html +82 -0
  28. data/lib/isodoc/nist/html/scripts.pdf.html +70 -0
  29. data/lib/isodoc/nist/html/word_nist_intro.html +142 -0
  30. data/lib/isodoc/nist/html/word_nist_titlepage.html +247 -0
  31. data/lib/isodoc/nist/html/wordstyle.scss +1134 -0
  32. data/lib/isodoc/nist/html_convert.rb +454 -0
  33. data/lib/isodoc/nist/i18n-en.yaml +3 -0
  34. data/lib/isodoc/nist/metadata.rb +116 -0
  35. data/lib/isodoc/nist/pdf_convert.rb +456 -0
  36. data/lib/isodoc/nist/word_convert.rb +472 -0
  37. data/lib/metanorma-nist.rb +11 -0
  38. data/lib/metanorma/nist.rb +7 -0
  39. data/lib/metanorma/nist/processor.rb +43 -0
  40. data/lib/metanorma/nist/version.rb +5 -0
  41. data/metanorma-nist.gemspec +44 -0
  42. metadata +310 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5d4336b5e5cd72fefe2e42d96ffdc559a438aad39e71e3f8dca8bed5c6a926c9
4
+ data.tar.gz: 4a926e7415482403215b1bc1f6d1b80b642cfc484b0484bea918bbe670fb0716
5
+ SHA512:
6
+ metadata.gz: 80c9d531f6c049b6a786127c3e1ed4826a1fe65a67a2d15464abe957827b270e01a1723792f5f279021853a8d17234b737b0e9a21d9ff70a61028ab88ddf1622
7
+ data.tar.gz: 49393e419f14a068b5cb92aec30ad00422195da412ffd6bdab43e4eead7e3ea726efd18d91e1c61d186614a0f351963db545e3751efff958a420ffb4647a9b18
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ Enabled: true
3
+ config_file: .rubocop.yml
@@ -0,0 +1,10 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
+ AllCops:
8
+ TargetRubyVersion: 2.3
9
+ Rails:
10
+ Enabled: true
@@ -0,0 +1,16 @@
1
+ dist: trusty
2
+ sudo: false
3
+ language: ruby
4
+ rvm:
5
+ - 2.5
6
+ - 2.4
7
+ - 2.3
8
+ - ruby-head
9
+ before_install:
10
+ - gem install bundler -v 2.0.1
11
+ - npm install -g puppeteer
12
+ - npm install
13
+ - unset _JAVA_OPTIONS
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ronald.tse@ribose.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) {|repo| "https://github.com/#{repo}" }
3
+
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,358 @@
1
+ = metanorma-nist: Metanorma processor for the NIST SP 800 document classes
2
+
3
+ image:https://img.shields.io/gem/v/metanorma-nist.svg["Gem Version", link="https://rubygems.org/gems/metanorma-nist"]
4
+ image:https://img.shields.io/travis/riboseinc/metanorma-nist/master.svg["Build Status", link="https://travis-ci.org/riboseinc/metanorma-nist"]
5
+ image:https://codeclimate.com/github/riboseinc/metanorma-nist/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/metanorma-nist"]
6
+
7
+ WARNING: This gem is still under development.
8
+
9
+ == Functionality
10
+
11
+ This gem processes Metanorma documents into the NIST document class.
12
+
13
+ It provides the following functions:
14
+
15
+ . Compiles Metanorma input into the Metanorma-NIST XML format
16
+ . Validates XML output against the Metanorma-NIST document model
17
+ ** Errors are reported to console against the XML, and are intended for users to
18
+ check that they have provided all necessary components of the
19
+ document.
20
+ . Metanorma-NIST XML is then converted into desired output formats.
21
+
22
+ The following outputs are supported:
23
+
24
+ * Primary: the canonical Metanorma-NIST XML representation (`.xml`).
25
+ * Secondary: the Metanorma-NIST XML representation is processed to generate the following outputs
26
+ as end deliverable NIST documents.
27
+ ** HTML (`.html`)
28
+ ** PDF (`.pdf`)
29
+ ** Word (`.doc`)
30
+
31
+ == Structure
32
+
33
+ This gem inherits from the https://github.com/riboseinc/metanorma-standoc
34
+ gem, and aligns closely to it.
35
+
36
+
37
+ === Quickstart
38
+
39
+ Please see https://www.metanorma.com for instructions to get started.
40
+
41
+ If you are using a Mac, the https://github.com/riboseinc/metanorma-macos-setup
42
+ repository has instructions on setting up your machine to run Metanorma
43
+ scripts such as this one. You need only run the following in a Terminal console:
44
+
45
+ [source,console]
46
+ ----
47
+ $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
48
+ $ gem install metanorma-cli
49
+ $ gem install metanorma-nist
50
+ ----
51
+
52
+
53
+ == Usage
54
+
55
+ Using the `metanorma` CLI:
56
+
57
+ [source,console]
58
+ ----
59
+ $ metanorma --type nist a.adoc # output HTML
60
+ $ metanorma --type nist --extensions html a.adoc # output just HTML
61
+ $ metanorma --type nist --extensions xml a.adoc # output Metanorma XML
62
+ ----
63
+
64
+
65
+ == Authoring
66
+
67
+ Please refer to the Metanorma-ISO documentation for general documentation.
68
+
69
+ * Metanorma-ISO general documentation: https://www.metanorma.com/software/metanorma-iso/
70
+
71
+ * Metanorma-ISO guidance: https://www.metanorma.com/software/metanorma-iso/docs/guidance/
72
+
73
+
74
+ ////
75
+ ** http://asciimath.org[AsciiMathML] is used for mathematical formatting.
76
+ The gem uses the https://github.com/asciidoctor/asciimath[Ruby AsciiMath parser],
77
+ which is syntactically stricter than the common MathJax processor;
78
+ if you do not get expected results, try bracketing terms your in AsciiMathML
79
+ expressions.
80
+ ////
81
+
82
+
83
+ == Approach
84
+
85
+ === Document model
86
+
87
+ The NIST SP 800 document model is detailed here:
88
+
89
+ * https://github.com/riboseinc/metanorma-model-nist[NIST SP 800 document model]
90
+
91
+ It is an instance of the
92
+ https://github.com/riboseinc/metanorma-model-standoc[StandardDocument model].
93
+
94
+
95
+ === Document input
96
+
97
+ Document input to Metanorma is for the compilation of content into the
98
+ Metanorma XML document.
99
+
100
+ The Metanorma-NIST processor supports AsciiDoc input.
101
+
102
+ Similar to Markdown, AsciiDoc is a lightweight markup format, but
103
+ combines the rigor and expressivity of DocBook.
104
+ A number of editors (through plugins) support preview of AsciiDoc files,
105
+ so textual content can be previewed without running the Metanorma toolchain.
106
+
107
+ The Metanorma processor automates numbering of headings, figures,
108
+ tables etc, automatically generates references and citations,
109
+ and the resulting output presentations.
110
+
111
+ NOTE: The Asciidoctor gem is used for AsciiDoc input parsing.
112
+
113
+
114
+ == Document attributes
115
+
116
+ === Common attributes
117
+
118
+ Metadata of the document is provided through AsciiDoc document attributes.
119
+
120
+ https://github.com/riboseinc/metanorma-standoc[Metanorma-Standoc]
121
+ documents all common Metanorma document attributes.
122
+
123
+ Where these preexisting metanorma attributes correspond to attributes already used
124
+ by NIST in their Asciidoctor template, they are treated as synonyms of the Metanorma
125
+ attributes.
126
+
127
+ The attributes relevant to OGC documents include:
128
+
129
+ `:edition:`:: The document version; e.g. `2.0`.
130
+
131
+ `:revdate:`:: The date the document was last updated.
132
+
133
+ `:copyright-year:`: The year which will be claimed as when the copyright for
134
+ the document was issued.
135
+
136
+ `:title:`:: The main component of the English title of the document
137
+ (mandatory). (The first line of the AsciiDoc document, which contains the title
138
+ introduced with `=`, is ignored)
139
+
140
+ `:technical-committee:`:: The name of the relevant committee producing the document (mandatory).
141
+
142
+ `:published-date:`:: The publication date for the document.
143
+
144
+ `:uri:`:: The URI to which this standard is published.
145
+
146
+ `:docnumber:`:: The internal identifier referring to this document.
147
+
148
+ `:draft:`:: If present, review notes are included in the
149
+ Metanorma XML output; otherwise they are suppressed. The value of
150
+ this attribute will be displayed as part of the heading, prefixed with "Revision".
151
+
152
+ ////
153
+
154
+ `:doctype:`:: The document type (mandatory). The permitted types are:
155
+ +
156
+ --
157
+ * Standards
158
+ `standard`::: Implementation Standard
159
+ `standard-with-suite`::: Implementation Standard with Compliance Suite
160
+ `abstract-specification`::: Abstract Specification
161
+ `community-standard`::: Community Standard
162
+ `profile`::: Profile / Application Profile
163
+ `best-practice`::: Best Practices Document
164
+
165
+ * Other
166
+ `engineering-report`::: Engineering Report
167
+ `discussion-paper`::: Discussion Paper
168
+ `reference-model`::: OGC Reference Model
169
+ `user-guide`::: User Guide
170
+ `policy`::: OGC Policy Document
171
+ `guide`::: Guide
172
+ `amendment`::: Technical Amendment
173
+ `technical-corrigendum`::: Corrigendum (errata) Changes to OGC Standards
174
+ `administrative`::: Internal administrative documents
175
+ --
176
+
177
+ `:status:`:: Document status/stage. The permitted types are:
178
+ +
179
+ `rfc`::: OGC RFC (proposal)
180
+ `candidate`::: Candidate Standard
181
+ `published`::: Published
182
+ `deprecated`::: Deprecated
183
+ `retired`::: Retired
184
+
185
+ `:committee:`:: The name of the relevant committee producing the document (mandatory). The legal values are:
186
+ `technical`, `planning`, `strategic-member-advisory`
187
+ `:subcommittee:`:: The name of the relevant subcommittee producing the document
188
+ `:workgroup:` (OGC: `:workingGroup:`):: The name of the relevant working group producing the document (mandatory)
189
+
190
+ `:published-date:` (OGC: `:publicationDate:`):: The publication date for the document.
191
+ `:issued-date:` (OGC: `:approvalDate:`):: The approval date for the document.
192
+ `:created-date:`:: The creation date for the document.
193
+ `:received-date:` (OGC: `:submissionDate:`):: The date at which the document was submitted to the standards body.
194
+
195
+ ////
196
+
197
+ === NIST-specific attributes
198
+
199
+ The following document attributes are specific to this document class:
200
+
201
+ `:subtitle:`:: Document subtitle.
202
+
203
+ `:keywords:`:: Comma-delimited list of the keywords associated with the document.
204
+
205
+ `:fullname{_i}:`:: The full name of a person who is a contributor to the document.
206
+ A second person is indicated by using a numeric suffix: `:fullname:`, `:fullname_2:`, `fullname_3:`, &c.
207
+
208
+ `:surname{_i}:`:: The surname of a person who is a contributor to the document.
209
+ `:givenname{_i}:`:: The given name(s) of a person who is a contributor to the document.
210
+ `:role{_i}:`:: The role of a a person who is a contributor to the document. By default,
211
+ they are coded as an `editor`; they can also be represented as an `author`.
212
+
213
+ `:email:`:: Email contact for document
214
+
215
+ == Asciidoctor features specific to NIST
216
+
217
+ The https://github.com/riboseinc/metanorma-standoc[metanorma-standoc]
218
+ gem documents the customisations of Asciidoctor markup common to all metanorma gems.
219
+ The following markup is specific to this gem:
220
+
221
+ === Preface
222
+
223
+ The following sections are automatically moved to the document preface.
224
+
225
+ * Abstract
226
+ * Keywords (drawn from document attribute, see above)
227
+
228
+ In addition, any clause that has the `preface` style attribute is also moved to the document preface,
229
+ regardless of where it appears in the source Asciidoctor document. These clauses
230
+ appear in the document preface in the order they are given in the source document.
231
+ Examples of preface clauses include:
232
+
233
+ * Supplemental Content
234
+ * Acknowledgements
235
+ * Audience
236
+ * Document Conventions
237
+ * Compliance with NIST Standards and Guidelines
238
+ * Conformance Testing
239
+ * Note to Reviewers
240
+ * Note to Readers
241
+ * Trademark Information
242
+
243
+ [source,asciidoctor]
244
+ --
245
+ [preface]
246
+ == Acknowledgemnts
247
+ This section will be moved to the document preface, after the abstract and keywords.
248
+ --
249
+
250
+
251
+ Note that any clause titled "Note to Reviewers" will be removed from rendering unless
252
+ the document is in draft (has a `:draft:` attribute).
253
+
254
+ ==== Abstract
255
+
256
+ As with all metanorma gems, Abstracts are recognised as any clause with the style attribute
257
+ `[abstract]`. They are rendered in the document preface, under the Metanorma XML tag `abstract`.
258
+
259
+ === Executive Summary
260
+
261
+ This is any section that appears in the preface with the title Executive Summary.
262
+ It is rendered after all other preface sections.
263
+
264
+ === Terms and definitions
265
+
266
+ NIST documents do not provide for an extensive Terms & Definitions structure, as seen
267
+ in ISO and ISO-derived standards. Instead, they use acronyms and glossary appendixes.
268
+ These should be given as simple definition lists, without extensive embedded notes, examples,
269
+ or sources.
270
+
271
+ === Pseudocode
272
+
273
+ Pseudocode shall be marked up as an example, with style attribute "pseudocode":
274
+
275
+ [source,asciidoctor]
276
+ ----
277
+ [pseudocode]
278
+ ====
279
+ _Input: S=(s1,...,sL)_
280
+
281
+ _Output:_ Shuffled _S=(s1,...,sL)_
282
+
283
+ . *for* _i_ *from* _L_ *downto* 1 *do*
284
+ .. Generate a random integer _j_ such that 1<=_j_<=_i_
285
+ .. Swap _s~j~_ and _s~i~_
286
+ ====
287
+ ----
288
+
289
+ They will be rendered as figures, and included in the count of figures of the document.
290
+
291
+ === Recommendations, requirements, and permissions
292
+
293
+ Recommendations, requirements, and permissions shall be marked up as examples,
294
+ with style attribute "recommendation", "requirement", "permission":
295
+
296
+ [source,asciidoctor]
297
+ ----
298
+ [[recommend63]]
299
+ [recommendation]
300
+ ====
301
+ Because having on-card role and permission information would raise difficult challenges concerning update and revocation, PACS permissions should generally be stored in a PACS facilities-based component, such as a panel or controller database.
302
+ ====
303
+ ----
304
+
305
+ Recommendations, requirements, and permissions are treated like other assets in
306
+ text, and automatically numbered and labelled: do not include a "Recommendation" etc.
307
+ label with them.
308
+
309
+ === Variables within sourcecode
310
+
311
+ Variables within sourcecode are rendered as non-monospace italicised text. To indicate
312
+ such variables, `{{{ ... }}}` shall be used as markup within the sourcecode block,
313
+ which will be converted to the tag `nistvariable` in Metanorma XML:
314
+
315
+ [source,asciidoctor]
316
+ ---
317
+ [source]
318
+ ----
319
+ <xccdf:check system="{{{http://oval.mitre.org/XMLSchema/oval-definitions-5}}}">
320
+ ----
321
+ ---
322
+
323
+ === Errata
324
+
325
+ Errata are marked up as an Asciidoctor table with style attribute `[errata]`.
326
+ Errata tables must have a header row containing the headings _Date, Type, Change, Pages_:
327
+
328
+ [source, asciidoctor]
329
+ ----
330
+ [errata]
331
+ |===
332
+ |Date |Type |Change |Page
333
+
334
+ |2019-01-01 |Minor |Repaginated |1-12
335
+ |===
336
+ ----
337
+
338
+ === Glosaries
339
+
340
+ Glossaries are given as definition lists with style attribute `glossary`:
341
+
342
+ [source,asciidoctor]
343
+ ----
344
+ [glossary]
345
+ stem:[A= {x_1, x_2, ..., x_k}]:: The alphabet, i.e., the set of all possible symbols that a (digitized) noise source produces.
346
+ ----
347
+
348
+ ////
349
+
350
+ == Examples
351
+
352
+ ////
353
+ * link:spec/examples/rfc6350.adoc[] is an Metanorma AsciiDoc version of https://tools.ietf.org/html/rfc6350[RFC 6350].
354
+ * link:spec/examples/rfc6350.html[] is an HTML file generated from the Asciidoctor.
355
+ * link:spec/examples/rfc6350.doc[] is a Word document generated from the Asciidoctor.
356
+
357
+ ////
358
+