metanorma-nist 0.0.5 → 0.0.6
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.
- checksums.yaml +4 -4
- data/README.adoc +105 -38
- data/lib/asciidoctor/nist/biblio.rng +20 -17
- data/lib/asciidoctor/nist/boilerplate.rb +58 -0
- data/lib/asciidoctor/nist/cleanup.rb +89 -0
- data/lib/asciidoctor/nist/converter.rb +5 -150
- data/lib/asciidoctor/nist/front.rb +30 -13
- data/lib/asciidoctor/nist/nist.rng +58 -21
- data/lib/asciidoctor/nist/nist_intro.xml +53 -0
- data/lib/asciidoctor/nist/validate.rb +42 -0
- data/lib/isodoc/nist/html/html_nist_intro.html +11 -50
- data/lib/isodoc/nist/html/html_nist_titlepage.html +11 -34
- data/lib/isodoc/nist/html/htmlstyle.scss +25 -4
- data/lib/isodoc/nist/html/nist.scss +45 -1
- data/lib/isodoc/nist/html/scripts.html +2 -2
- data/lib/isodoc/nist/html/scripts.pdf.html +2 -2
- data/lib/isodoc/nist/html/word_nist_intro.html +0 -155
- data/lib/isodoc/nist/html/word_nist_titlepage.html +6 -6
- data/lib/isodoc/nist/html/wordstyle.scss +1 -1
- data/lib/isodoc/nist/html_convert.rb +49 -13
- data/lib/isodoc/nist/metadata.rb +32 -9
- data/lib/isodoc/nist/pdf_convert.rb +51 -0
- data/lib/isodoc/nist/word_convert.rb +56 -35
- data/lib/metanorma/nist/version.rb +1 -1
- metadata +6 -2
@@ -1,155 +0,0 @@
|
|
1
|
-
<h1 class="AbstractTitle">Authority</h1>
|
2
|
-
|
3
|
-
<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
|
4
|
-
mso-pagination:widow-orphan;mso-hyphenate:auto;mso-layout-grid-align:auto;
|
5
|
-
mso-vertical-align-alt:auto'><span lang=EN-US style='mso-bidi-font-size:11.0pt;
|
6
|
-
mso-bidi-font-family:Arial'>This publication has been developed by NIST in
|
7
|
-
accordance with its statutory responsibilities under the Federal Information
|
8
|
-
Security Modernization Act (FISMA) of 2014, 44 <span class=SpellE>U.S.C</span>.
|
9
|
-
§ 3551 <i style='mso-bidi-font-style:normal'>et seq.</i>, Public Law (<span
|
10
|
-
class=SpellE>P.L</span>.) 113-283. NIST is responsible for developing
|
11
|
-
information security standards and guidelines, including minimum requirements
|
12
|
-
for federal information systems, but such standards and guidelines shall not
|
13
|
-
apply to national security systems without the express approval of appropriate federal
|
14
|
-
officials exercising policy authority over such systems. This guideline is
|
15
|
-
consistent with the requirements of the Office of Management and Budget (OMB)
|
16
|
-
Circular A-130.<o:p></o:p></span></p>
|
17
|
-
|
18
|
-
<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
|
19
|
-
mso-pagination:widow-orphan;mso-hyphenate:auto;mso-layout-grid-align:auto;
|
20
|
-
mso-vertical-align-alt:auto'><span lang=EN-US style='mso-bidi-font-size:11.0pt;
|
21
|
-
mso-bidi-font-family:Arial'>Nothing in this publication should be taken to
|
22
|
-
contradict the standards and guidelines made mandatory and binding on federal
|
23
|
-
agencies by the Secretary of Commerce under statutory authority. Nor should
|
24
|
-
these guidelines be interpreted as altering or superseding the existing
|
25
|
-
authorities of the Secretary of Commerce, Director of the OMB, or any other federal
|
26
|
-
official.<span style='mso-spacerun:yes'> </span>This publication may be used
|
27
|
-
by nongovernmental organizations on a voluntary basis and is not subject to
|
28
|
-
copyright in the United States. Attribution would, however, be appreciated by
|
29
|
-
NIST.</span><span lang=EN-US style='mso-bidi-font-size:11.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p>
|
30
|
-
|
31
|
-
<p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center;
|
32
|
-
line-height:90%'><span lang=EN-US style='font-size:11.0pt;line-height:
|
33
|
-
90%;font-family:"Arial",sans-serif'>National Institute of Standards and
|
34
|
-
Technology {{ docnumber }}<br></span>
|
35
|
-
<span lang=EN-US style='font-size:10.0pt;line-height:90%;font-family:
|
36
|
-
"Arial",sans-serif;mso-bidi-font-weight:bold'>Natl. Inst. Stand. Technol.
|
37
|
-
{{ docnumber }}, <!--[if supportFields]><span
|
38
|
-
lang=EN-AU style='font-size:10.0pt;mso-ansi-language:EN-AU'><span
|
39
|
-
style='mso-element:field-begin'></span><span style='mso-spacerun:yes'> </span>NUMPAGES<span
|
40
|
-
style='mso-spacerun:yes'> </span>\* MERGEFORMAT <span style='mso-element:field-separator'></span></span><![endif]--><span
|
41
|
-
style='mso-no-proof:yes'>26</span><!--[if supportFields]><span
|
42
|
-
lang=EN-AU style='font-size:10.0pt;mso-ansi-language:EN-AU'><span
|
43
|
-
style='mso-element:field-end'></span></span><![endif]--> pages ({{ revdate_monthyear }})<br>
|
44
|
-
<span class=SpellE><span style='color:black'>CODEN</span></span><span
|
45
|
-
style='color:black'>: NSPUE2<o:p></o:p></span></span></p>
|
46
|
-
|
47
|
-
{% if url %}
|
48
|
-
<p class=MsoHeader align=center style='text-align:center;line-height:90%;
|
49
|
-
tab-stops:36.0pt'><span lang=EN-US style='font-size:10.0pt;line-height:90%;
|
50
|
-
font-family:"Arial",sans-serif;color:black;mso-themecolor:text1'>This
|
51
|
-
publication is available free of charge from:<br>
|
52
|
-
</span><span lang=EN-US style='font-size:10.0pt;line-height:90%;font-family:
|
53
|
-
"Arial",sans-serif'>{{ url }}</span><b><span lang=EN-US
|
54
|
-
style='mso-bidi-font-size:11.0pt;line-height:90%;font-family:"Arial",sans-serif;
|
55
|
-
color:black;mso-themecolor:text1'><o:p></o:p></span></b></p>
|
56
|
-
{% endif %}
|
57
|
-
<p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center;
|
58
|
-
line-height:90%'><span lang=EN-US style='font-size:10.0pt;line-height:90%;
|
59
|
-
font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p>
|
60
|
-
|
61
|
-
<div style='mso-element:para-border-div;border:solid black 1.0pt;padding:8.0pt 8.0pt 8.0pt 8.0pt;
|
62
|
-
background:#D9D9D9'>
|
63
|
-
|
64
|
-
<p class=MsoNormal align=left style='margin-top:6.0pt;margin-right:0cm;
|
65
|
-
margin-bottom:6.0pt;margin-left:0cm;text-align:left;mso-pagination:widow-orphan;
|
66
|
-
mso-hyphenate:auto;background:#D9D9D9;mso-layout-grid-align:auto;mso-vertical-align-alt:
|
67
|
-
auto;border:none;mso-border-alt:solid black 1.0pt;padding:0cm;mso-padding-alt:
|
68
|
-
8.0pt 8.0pt 8.0pt 8.0pt'><span lang=EN-US style='font-size:10.0pt;mso-bidi-font-size:
|
69
|
-
12.0pt;mso-bidi-font-family:Arial'>Certain commercial entities, equipment, or
|
70
|
-
materials may be identified in this document in order to describe an
|
71
|
-
experimental procedure or concept adequately. Such identification is not
|
72
|
-
intended to imply recommendation or endorsement by NIST, nor is it intended to
|
73
|
-
imply that the entities, materials, or equipment are necessarily the best
|
74
|
-
available for the purpose. <o:p></o:p></span></p>
|
75
|
-
|
76
|
-
<p class=MsoNormal align=left style='margin-top:6.0pt;margin-right:0cm;
|
77
|
-
margin-bottom:6.0pt;margin-left:0cm;text-align:left;mso-pagination:widow-orphan;
|
78
|
-
mso-hyphenate:auto;background:#D9D9D9;mso-layout-grid-align:auto;mso-vertical-align-alt:
|
79
|
-
auto;border:none;mso-border-alt:solid black 1.0pt;padding:0cm;mso-padding-alt:
|
80
|
-
8.0pt 8.0pt 8.0pt 8.0pt'><span lang=EN-US style='font-size:10.0pt;mso-bidi-font-size:
|
81
|
-
12.0pt;mso-bidi-font-family:Arial'>There may be references in this publication
|
82
|
-
to other publications currently under development by NIST in accordance with
|
83
|
-
its assigned statutory responsibilities. The information in this publication,
|
84
|
-
including concepts and methodologies, may be used by federal agencies even
|
85
|
-
before the completion of such companion publications. Thus, until each
|
86
|
-
publication is completed, current requirements, guideline<span
|
87
|
-
style='color:black'>s, a</span>nd procedures, where they exist, remain
|
88
|
-
operative. For planning and transition purposes, federal agencies may wish to
|
89
|
-
closely follow the development of these new publications by NIST.<span
|
90
|
-
style='mso-spacerun:yes'> </span><o:p></o:p></span></p>
|
91
|
-
|
92
|
-
<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left;
|
93
|
-
line-height:90%;background:#D9D9D9;border:none;mso-border-alt:solid black 1.0pt;
|
94
|
-
padding:0cm;mso-padding-alt:8.0pt 8.0pt 8.0pt 8.0pt'><span lang=EN-US
|
95
|
-
style='font-size:10.0pt;mso-bidi-font-size:12.0pt;line-height:90%'>Organizations
|
96
|
-
are encouraged to review all draft publications during public comment periods
|
97
|
-
and provide feedback to NIST. Many NIST cybersecurity publications<span
|
98
|
-
style='color:black'>, ot</span>her than the ones noted above, are available at <u><span
|
99
|
-
style='color:blue'><a href="https://csrc.nist.gov/publications"
|
100
|
-
title="NIST Computer Security Division publications">https://csrc.nist.gov/publications</a></span></u>.</span><b><span
|
101
|
-
lang=EN-US style='font-size:12.0pt;mso-bidi-font-size:11.0pt;line-height:90%;
|
102
|
-
font-family:"Arial",sans-serif;color:black'><o:p></o:p></span></b></p>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
{% if comment_extended %}
|
107
|
-
<p class=MsoNormal align="center">[{{ comment_extended}}: Comment period extended]</p>
|
108
|
-
{% endif %}
|
109
|
-
|
110
|
-
{% if comment_from and comment_to %}
|
111
|
-
<p class=MsoNormal align="center"><b>Public comment period: <i>{{ comment_from }}</i> through <i>{{comment_to}}</i></b></p>
|
112
|
-
{% else %}
|
113
|
-
{% if comment_from %}
|
114
|
-
<p class=MsoNormal align="center"><b>Public comment period: from <i>{{ comment_from }}</i></b></p>
|
115
|
-
{% endif %}
|
116
|
-
{% endif %}
|
117
|
-
|
118
|
-
|
119
|
-
<p class=MsoNormal align=center style='margin-bottom:6.0pt;text-align:center'><b><span
|
120
|
-
lang=EN-US style='font-size:11.0pt;font-family:"Arial",sans-serif'>Comments
|
121
|
-
on this publication may be submitted to:</span></b><b style='mso-bidi-font-weight:
|
122
|
-
normal'><span lang=EN-US style='mso-bidi-font-size:11.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></b></p>
|
123
|
-
|
124
|
-
<p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center'><span
|
125
|
-
lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>National
|
126
|
-
Institute of Standards and Technology<br>
|
127
|
-
Attn: Computer Security Division, Information Technology Laboratory<br>
|
128
|
-
100 Bureau Drive (Mail Stop 8930) Gaithersburg, MD 20899-8930<br>
|
129
|
-
Email: <span class=MsoHyperlink><a href="mailto:{{ email }}">{{ email }}</a></span><o:p></o:p></span></p>
|
130
|
-
|
131
|
-
<p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center'><span
|
132
|
-
lang=EN-US style='font-size:11.0pt;font-family:"Arial",sans-serif'>All
|
133
|
-
comments are subject to release under the Freedom of Information Act (FOIA).<o:p></o:p></span></p>
|
134
|
-
|
135
|
-
<p><span lang=EN-US style='font-size:11.0pt;mso-bidi-font-size:11.0pt;font-family:
|
136
|
-
"Times New Roman",serif;mso-fareast-font-family:"Times New Roman";mso-ansi-language:
|
137
|
-
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA'><br clear=all style='page-break-before:always;'></span></p>
|
138
|
-
|
139
|
-
<h1 class="IntroTitle">Reports on Computer Systems Technology</h1>
|
140
|
-
|
141
|
-
<p class=MsoNormal align=left style='margin-bottom:12.0pt;text-align:left'><span
|
142
|
-
lang=EN-US style='font-size:12.0pt'>The Information Technology Laboratory (<span
|
143
|
-
class=SpellE>ITL</span>) at the National Institute of Standards and Technology
|
144
|
-
(NIST) promotes the U.S. economy and public welfare by providing technical
|
145
|
-
leadership for the Nation’s measurement and standards infrastructure. <span
|
146
|
-
class=SpellE>ITL</span> develops tests, test methods, reference data, proof of
|
147
|
-
concept implementations, and technical analyses to advance the development and
|
148
|
-
productive use of information technology. <span class=SpellE>ITL’s</span>
|
149
|
-
responsibilities include the development of management, administrative,
|
150
|
-
technical, and physical standards and guidelines for the cost-effective
|
151
|
-
security and privacy of other than national security-related information in federal
|
152
|
-
information systems. The Special Publication 800-series reports on <span
|
153
|
-
class=SpellE>ITL’s</span> research, guidelines, and outreach efforts in
|
154
|
-
information system security, and its collaborative activities with industry,
|
155
|
-
government, and academic organizations.<o:p></o:p></span></p>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<p class="ReportNumber"><span lang="EN-US">{{
|
1
|
+
<p class="ReportNumber"><span lang="EN-US">{{ draft_prefix }} {{ docidentifier_long }}
|
2
2
|
{% if edition %} <br/> Revision {{ edition }} {% endif %}
|
3
3
|
{% if draftinfo %}
|
4
4
|
<br/>{{ draftinfo }}
|
@@ -39,15 +39,14 @@ mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom
|
|
39
39
|
lang="EN-US" style='font-size:14.0pt;color:black'> <o:p></o:p></span></p>
|
40
40
|
|
41
41
|
|
42
|
-
{% if
|
42
|
+
{% if doi %}
|
43
43
|
<p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;
|
44
44
|
mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
|
45
45
|
lang="EN-US" style='font-size:14.0pt;color:black'>This publication is available
|
46
46
|
free of charge from:<o:p></o:p></span></p>
|
47
47
|
<p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;
|
48
48
|
mso-hyphenate:auto;text-autospace:none;mso-vertical-align-alt:auto;margin-bottom:0.0pt'><span
|
49
|
-
lang="EN-US" style='font-size:14.0pt;color:black'>{{
|
50
|
-
|
49
|
+
lang="EN-US" style='font-size:14.0pt;color:black'>{{ doi }}<o:p></o:p></span></p>
|
51
50
|
{% endif %}
|
52
51
|
|
53
52
|
<p class="MsoNormal" align="right" style='text-align:right;mso-pagination:widow-orphan;
|
@@ -68,7 +67,8 @@ padding:1.0pt 0cm 1.0pt 0cm'>
|
|
68
67
|
<p class="MsoNormal" align="center" style='text-align:center;border:none;
|
69
68
|
mso-border-top-alt:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;
|
70
69
|
padding:0cm;mso-padding-alt:1.0pt 0cm 1.0pt 0cm'><span lang="EN-US"
|
71
|
-
style='font-size:16.0pt;font-family:"Arial",sans-serif;mso-ansi-language:EN-US;letter-spacing:10.0pt'>{{
|
70
|
+
style='font-size:16.0pt;font-family:"Arial",sans-serif;mso-ansi-language:EN-US;letter-spacing:10.0pt'>{{ docclasstitle }}<o:p></o:p></span></p>
|
71
|
+
|
72
72
|
|
73
73
|
</div>
|
74
74
|
|
@@ -126,7 +126,7 @@ EN-US;mso-bidi-language:AR-SA'><br clear="all" style='page-break-before:always;'
|
|
126
126
|
mso-pagination:widow-orphan;mso-hyphenate:auto;mso-layout-grid-align:auto;
|
127
127
|
mso-vertical-align-alt:auto'><b style='mso-bidi-font-weight:normal'><span
|
128
128
|
lang="EN-US" style='font-size:20.0pt;mso-bidi-font-size:12.0pt;line-height:90%'>
|
129
|
-
{{
|
129
|
+
{{ draft_prefix }} {{ docidentifier_long }}
|
130
130
|
{% if draftinfo %}
|
131
131
|
<br/>{{ draftinfo }}
|
132
132
|
{% endif %}
|
@@ -42,23 +42,11 @@ module IsoDoc
|
|
42
42
|
@meta = Metadata.new(lang, script, labels)
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
45
|
+
def googlefonts
|
46
46
|
<<~HEAD.freeze
|
47
|
-
<title>{{ doctitle }}</title>
|
48
|
-
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
49
|
-
|
50
|
-
<!--TOC script import-->
|
51
|
-
<script type="text/javascript" src="https://cdn.rawgit.com/jgallen23/toc/0.3.2/dist/toc.min.js"></script>
|
52
|
-
|
53
|
-
<!--Google fonts-->
|
54
47
|
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,600,600i" rel="stylesheet">
|
55
48
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet" />
|
56
49
|
<link href="https://fonts.googleapis.com/css?family=Libre+Baskerville:400,400i,700,700i" rel="stylesheet">
|
57
|
-
|
58
|
-
<!--Font awesome import for the link icon-->
|
59
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous">
|
60
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous">
|
61
|
-
<style class="anchorjs"></style>
|
62
50
|
HEAD
|
63
51
|
end
|
64
52
|
|
@@ -75,12 +63,24 @@ module IsoDoc
|
|
75
63
|
docxml
|
76
64
|
end
|
77
65
|
|
66
|
+
def authority_cleanup(docxml)
|
67
|
+
dest = docxml.at("//div[@id = 'authority']") || return
|
68
|
+
auth = docxml.at("//div[@class = 'authority']") || return
|
69
|
+
dest.replace(auth.remove)
|
70
|
+
end
|
71
|
+
|
78
72
|
def cleanup(docxml)
|
79
73
|
super
|
80
74
|
term_cleanup(docxml)
|
81
75
|
requirement_cleanup(docxml)
|
82
76
|
end
|
83
77
|
|
78
|
+
def html_preface(docxml)
|
79
|
+
super
|
80
|
+
authority_cleanup(docxml)
|
81
|
+
docxml
|
82
|
+
end
|
83
|
+
|
84
84
|
def make_body3(body, docxml)
|
85
85
|
body.div **{ class: "main-section" } do |div3|
|
86
86
|
abstract docxml, div3
|
@@ -137,6 +137,7 @@ module IsoDoc
|
|
137
137
|
def preface(isoxml, out)
|
138
138
|
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
139
139
|
foreword(isoxml, out) and next if c.name == "foreword"
|
140
|
+
authority_parse(c, out) and next if c.name == "authority"
|
140
141
|
next if skip_render(c, isoxml)
|
141
142
|
out.div **attr_code(id: c["id"]) do |s|
|
142
143
|
clause_name(get_anchors[c['id']][:label],
|
@@ -226,11 +227,45 @@ module IsoDoc
|
|
226
227
|
when "requirement" then requirement_parse(node, out)
|
227
228
|
when "permission" then permission_parse(node, out)
|
228
229
|
when "errata" then errata_parse(node, out)
|
230
|
+
when "authority" then authority_parse(node, out)
|
231
|
+
when "authority1" then authority1_parse(node, out, "authority1")
|
232
|
+
when "authority2" then authority1_parse(node, out, "authority2")
|
233
|
+
when "authority3" then authority1_parse(node, out, "authority3")
|
234
|
+
when "authority4" then authority1_parse(node, out, "authority4")
|
235
|
+
when "authority5" then authority1_parse(node, out, "authority5")
|
229
236
|
else
|
230
237
|
super
|
231
238
|
end
|
232
239
|
end
|
233
240
|
|
241
|
+
def authority_parse(node, out)
|
242
|
+
out.div **{class: "authority"} do |s|
|
243
|
+
node.children.each do |n|
|
244
|
+
if n.name == "title"
|
245
|
+
s.h1 do |h|
|
246
|
+
n.children.each { |nn| parse(nn, h) }
|
247
|
+
end
|
248
|
+
else
|
249
|
+
parse(n, s)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def authority1_parse(node, out, classname)
|
256
|
+
out.div **{class: classname} do |s|
|
257
|
+
node.children.each do |n|
|
258
|
+
if n.name == "title"
|
259
|
+
s.h2 do |h|
|
260
|
+
n.children.each { |nn| parse(nn, h) }
|
261
|
+
end
|
262
|
+
else
|
263
|
+
parse(n, s)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
234
269
|
def nistvariable_parse(node, out)
|
235
270
|
out.span **{class: "nistvariable"} do |s|
|
236
271
|
node.children.each { |n| parse(n, s) }
|
@@ -318,6 +353,7 @@ module IsoDoc
|
|
318
353
|
@meta.keywords isoxml, out
|
319
354
|
@meta.series isoxml, out
|
320
355
|
@meta.commentperiod isoxml, out
|
356
|
+
@meta.commentperiod isoxml, out
|
321
357
|
super
|
322
358
|
end
|
323
359
|
|
data/lib/isodoc/nist/metadata.rb
CHANGED
@@ -11,13 +11,15 @@ module IsoDoc
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def title(isoxml, out)
|
14
|
-
main = isoxml&.at(ns("//bibdata/title
|
14
|
+
main = isoxml&.at(ns("//bibdata/title[@type = 'main']"))&.text
|
15
15
|
set(:doctitle, main)
|
16
16
|
end
|
17
17
|
|
18
18
|
def subtitle(isoxml, _out)
|
19
|
-
main = isoxml&.at(ns("//bibdata/title
|
20
|
-
set(:docsubtitle, main)
|
19
|
+
main = isoxml&.at(ns("//bibdata/title[@type = 'subtitle']"))&.text
|
20
|
+
set(:docsubtitle, main) if main
|
21
|
+
main = isoxml&.at(ns("//bibdata/title[@type = 'document-class']"))&.text
|
22
|
+
set(:docclasstitle, main) if main
|
21
23
|
end
|
22
24
|
|
23
25
|
def author(isoxml, _out)
|
@@ -32,20 +34,21 @@ module IsoDoc
|
|
32
34
|
"[@type = 'nist-long']"))&.text
|
33
35
|
docnumber = isoxml.at(ns("//bibdata/docnumber"))&.text
|
34
36
|
set(:docidentifier, docid)
|
35
|
-
set(:docidentifier_long,
|
37
|
+
set(:docidentifier_long, docid_long)
|
38
|
+
d = draft_prefix(isoxml) and set(:draft_prefix, d)
|
36
39
|
set(:docnumber, docnumber)
|
37
40
|
end
|
38
41
|
|
39
|
-
def draft_prefix(
|
40
|
-
return nil if docidentifier_long.nil?
|
42
|
+
def draft_prefix(isoxml)
|
41
43
|
docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
|
42
|
-
return
|
44
|
+
return nil unless docstatus &&
|
45
|
+
!%w(final withdrawn).include?(docstatus)
|
43
46
|
iter = isoxml.at(ns("//bibdata/status/iteration"))&.text
|
44
47
|
prefix = "DRAFT "
|
45
48
|
/^\d+$/.match iter and
|
46
49
|
iter = iter.to_i.localize.to_rbnf_s("OrdinalRules", "digits-ordinal")
|
47
50
|
prefix += "(#{iter}) " if iter
|
48
|
-
prefix
|
51
|
+
prefix
|
49
52
|
end
|
50
53
|
|
51
54
|
def draftinfo(draft, revdate)
|
@@ -67,7 +70,7 @@ module IsoDoc
|
|
67
70
|
end
|
68
71
|
|
69
72
|
def adjust_docstatus(status, iter)
|
70
|
-
return unless iter and status
|
73
|
+
return status unless iter and status
|
71
74
|
status = "initial-public-draft" if status == "public-draft" &&
|
72
75
|
(iter == "1" || iter == "initial")
|
73
76
|
status = "final-public-draft" if status == "public-draft" &&
|
@@ -76,6 +79,7 @@ module IsoDoc
|
|
76
79
|
end
|
77
80
|
|
78
81
|
def version(isoxml, _out)
|
82
|
+
#require "byebug"; byebug
|
79
83
|
super
|
80
84
|
revdate = get[:revdate]
|
81
85
|
set(:revdate_monthyear, monthyr(revdate))
|
@@ -134,6 +138,25 @@ module IsoDoc
|
|
134
138
|
a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and
|
135
139
|
set(:url, a.text)
|
136
140
|
end
|
141
|
+
|
142
|
+
def relations1(isoxml, type)
|
143
|
+
ret = []
|
144
|
+
isoxml.xpath(ns("//bibdata/relation[@type = '#{type}']")).each do |x|
|
145
|
+
ret << x.at(ns(".//docidentifier")).text if x.at(ns(".//docidentifier"))
|
146
|
+
end
|
147
|
+
ret
|
148
|
+
end
|
149
|
+
|
150
|
+
def relations(isoxml, _out)
|
151
|
+
ret = relations1(isoxml, "obsoletes")
|
152
|
+
set(:obsoletes, ret) unless ret.empty?
|
153
|
+
ret = relations1(isoxml, "obsoletedBy")
|
154
|
+
set(:obsoletedby, ret) unless ret.empty?
|
155
|
+
ret = relations1(isoxml, "supersedes")
|
156
|
+
set(:supersedes, ret) unless ret.empty?
|
157
|
+
ret = relations1(isoxml, "supersededBy")
|
158
|
+
set(:supersededby, ret) unless ret.empty?
|
159
|
+
end
|
137
160
|
end
|
138
161
|
end
|
139
162
|
end
|
@@ -49,6 +49,11 @@ module IsoDoc
|
|
49
49
|
|
50
50
|
<!--TOC script import-->
|
51
51
|
<script type="text/javascript" src="https://cdn.rawgit.com/jgallen23/toc/0.3.2/dist/toc.min.js"></script>
|
52
|
+
<script type="text/javascript">
|
53
|
+
function toclevel() { var i; var text = "";
|
54
|
+
for(i = 1; i <= #{@htmlToClevels}; i++) {
|
55
|
+
if (i > 1) { text += ","; } text += "h" + i + ":not(.TermNum)"; } }
|
56
|
+
</script>
|
52
57
|
|
53
58
|
<!--Google fonts-->
|
54
59
|
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,600,600i" rel="stylesheet">
|
@@ -109,6 +114,7 @@ module IsoDoc
|
|
109
114
|
def preface(isoxml, out)
|
110
115
|
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
111
116
|
foreword(isoxml, out) and next if c.name == "foreword"
|
117
|
+
authority_parse(isoxml, out) and next if c.name == "authority"
|
112
118
|
next if skip_render(c, isoxml)
|
113
119
|
out.div **attr_code(id: c["id"]) do |s|
|
114
120
|
clause_name(get_anchors[c['id']][:label],
|
@@ -143,12 +149,24 @@ module IsoDoc
|
|
143
149
|
File.join(File.dirname(__FILE__), loc)
|
144
150
|
end
|
145
151
|
|
152
|
+
def authority_cleanup(docxml)
|
153
|
+
dest = docxml.at("//div[@id = 'authority']") || return
|
154
|
+
auth = docxml.at("//div[@class = 'authority']") || return
|
155
|
+
dest.replace(auth.remove)
|
156
|
+
end
|
157
|
+
|
146
158
|
def cleanup(docxml)
|
147
159
|
super
|
148
160
|
term_cleanup(docxml)
|
149
161
|
requirement_cleanup(docxml)
|
150
162
|
end
|
151
163
|
|
164
|
+
def html_preface(docxml)
|
165
|
+
super
|
166
|
+
authority_cleanup(docxml)
|
167
|
+
docxml
|
168
|
+
end
|
169
|
+
|
152
170
|
def term_cleanup(docxml)
|
153
171
|
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
154
172
|
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
@@ -213,11 +231,44 @@ module IsoDoc
|
|
213
231
|
when "requirement" then requirement_parse(node, out)
|
214
232
|
when "permission" then permission_parse(node, out)
|
215
233
|
when "errata" then errata_parse(node, out)
|
234
|
+
when "authority" then authority_parse(node, out)
|
235
|
+
when "authority1" then authority1_parse(node, out, "authority1")
|
236
|
+
when "authority2" then authority1_parse(node, out, "authority2")
|
237
|
+
when "authority3" then authority1_parse(node, out, "authority3")
|
238
|
+
when "authority4" then authority1_parse(node, out, "authority4")
|
239
|
+
when "authority5" then authority1_parse(node, out, "authority5")
|
216
240
|
else
|
217
241
|
super
|
218
242
|
end
|
219
243
|
end
|
220
244
|
|
245
|
+
def authority_parse(node, out)
|
246
|
+
out.div **{class: "authority"} do |s|
|
247
|
+
node.children.each do |n|
|
248
|
+
if n.name == "title"
|
249
|
+
s.h1 do |h|
|
250
|
+
n.children.each { |nn| parse(nn, h) }
|
251
|
+
end
|
252
|
+
else
|
253
|
+
parse(n, s)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
def authority1_parse(node, out, classname)
|
259
|
+
out.div **{class: classname} do |s|
|
260
|
+
node.children.each do |n|
|
261
|
+
if n.name == "title"
|
262
|
+
s.h2 do |h|
|
263
|
+
n.children.each { |nn| parse(nn, h) }
|
264
|
+
end
|
265
|
+
else
|
266
|
+
parse(n, s)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
221
272
|
def nistvariable_parse(node, out)
|
222
273
|
out.span **{class: "nistvariable"} do |s|
|
223
274
|
node.children.each { |n| parse(n, s) }
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require_relative "metadata"
|
3
3
|
require "fileutils"
|
4
|
+
require "sassc"
|
4
5
|
|
5
6
|
module IsoDoc
|
6
7
|
module NIST
|
@@ -68,13 +69,19 @@ module IsoDoc
|
|
68
69
|
section_break(body)
|
69
70
|
end
|
70
71
|
|
72
|
+
def authority_cleanup(docxml)
|
73
|
+
insert = docxml.at("//div[@class = 'WordSection2']")
|
74
|
+
auth = docxml&.at("//div[@class = 'authority']")&.remove || return
|
75
|
+
insert.children.first.add_previous_sibling(auth)
|
76
|
+
end
|
77
|
+
|
71
78
|
def cleanup(docxml)
|
72
79
|
super
|
73
80
|
term_cleanup(docxml)
|
74
81
|
requirement_cleanup(docxml)
|
75
82
|
h1_cleanup(docxml)
|
76
83
|
word_annex_cleanup(docxml) # need it earlier
|
77
|
-
toc_insert(docxml)
|
84
|
+
toc_insert(docxml, @wordToClevels)
|
78
85
|
end
|
79
86
|
|
80
87
|
# create fallback h1 class to deal with page breaks
|
@@ -84,31 +91,22 @@ module IsoDoc
|
|
84
91
|
end
|
85
92
|
end
|
86
93
|
|
87
|
-
def
|
88
|
-
|
89
|
-
docxml.xpath("//h1[ancestor::*[@class = 'Section3']]").each do |h2|
|
90
|
-
h2.name = "p"
|
91
|
-
h2["class"] = "h1Annex"
|
92
|
-
end
|
93
|
-
docxml.xpath("//h3[ancestor::*[@class = 'Section3']]").each do |h2|
|
94
|
-
h2.name = "p"
|
95
|
-
h2["class"] = "h3Annex"
|
96
|
-
end
|
97
|
-
docxml.xpath("//h4[ancestor::*[@class = 'Section3']]").each do |h2|
|
98
|
-
h2.name = "p"
|
99
|
-
h2["class"] = "h4Annex"
|
100
|
-
end
|
101
|
-
docxml.xpath("//h5[ancestor::*[@class = 'Section3']]").each do |h2|
|
102
|
-
h2.name = "p"
|
103
|
-
h2["class"] = "h5Annex"
|
104
|
-
end
|
105
|
-
docxml.xpath("//h6[ancestor::*[@class = 'Section3']]").each do |h2|
|
94
|
+
def word_annex_cleanup1(docxml, i)
|
95
|
+
docxml.xpath("//h#{i}[ancestor::*[@class = 'Section3']]").each do |h2|
|
106
96
|
h2.name = "p"
|
107
|
-
h2["class"] = "
|
97
|
+
h2["class"] = "h#{i}Annex"
|
108
98
|
end
|
109
99
|
end
|
110
100
|
|
111
|
-
def
|
101
|
+
def word_annex_cleanup(docxml)
|
102
|
+
word_annex_cleanup1(docxml, 2)
|
103
|
+
word_annex_cleanup1(docxml, 3)
|
104
|
+
word_annex_cleanup1(docxml, 4)
|
105
|
+
word_annex_cleanup1(docxml, 5)
|
106
|
+
word_annex_cleanup1(docxml, 6)
|
107
|
+
end
|
108
|
+
|
109
|
+
def toc_insert(docxml, level)
|
112
110
|
insertion = docxml.at("//div[h1 = 'Executive Summary']/"\
|
113
111
|
"preceding-sibling::div[h1][1]") ||
|
114
112
|
docxml.at("//div[@class = 'WordSection2']/child::*[last()]")
|
@@ -124,7 +122,7 @@ module IsoDoc
|
|
124
122
|
insertion.next = make_AppendixWordToC(docxml)
|
125
123
|
insertion.next = %{<p class="TOCTitle">List of Appendices</p>}
|
126
124
|
end
|
127
|
-
insertion.next = make_WordToC(docxml)
|
125
|
+
insertion.next = make_WordToC(docxml, level)
|
128
126
|
insertion.next = %{<p class="TOCTitle" style="page-break-before:
|
129
127
|
always;">Table of Contents</p>}
|
130
128
|
docxml
|
@@ -187,18 +185,6 @@ module IsoDoc
|
|
187
185
|
%{\\1#{WORD_TOC_APPENDIX_PREFACE1}}) + WORD_TOC_SUFFIX1
|
188
186
|
end
|
189
187
|
|
190
|
-
def make_WordToC(docxml)
|
191
|
-
toc = ""
|
192
|
-
docxml.xpath("//h1[not(ancestor::*[@class = 'WordSection2'])] |"\
|
193
|
-
"//h1[contains(., 'Executive Summary')] |"\
|
194
|
-
"//h2[not(ancestor::*[@class = 'WordSection2'])] |"\
|
195
|
-
"//h3[not(ancestor::*[@class = 'WordSection2'])]").each do |h|
|
196
|
-
toc += word_toc_entry(h.name[1].to_i, header_strip(h))
|
197
|
-
end
|
198
|
-
toc.sub(/(<p class="MsoToc1">)/,
|
199
|
-
%{\\1#{WORD_TOC_PREFACE1}}) + WORD_TOC_SUFFIX1
|
200
|
-
end
|
201
|
-
|
202
188
|
def word_preface_cleanup(docxml)
|
203
189
|
docxml.xpath("//h1[@class = 'AbstractTitle'] | "\
|
204
190
|
"//h1[@class = 'IntroTitle']").each do |h2|
|
@@ -210,6 +196,7 @@ module IsoDoc
|
|
210
196
|
def word_cleanup(docxml)
|
211
197
|
super
|
212
198
|
word_preface_cleanup(docxml)
|
199
|
+
authority_cleanup(docxml)
|
213
200
|
docxml
|
214
201
|
end
|
215
202
|
|
@@ -265,6 +252,7 @@ module IsoDoc
|
|
265
252
|
def preface(isoxml, out)
|
266
253
|
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
267
254
|
foreword(isoxml, out) and next if c.name == "foreword"
|
255
|
+
authority_parse(c, out) and next if c.name == "authority"
|
268
256
|
next if skip_render(c, isoxml)
|
269
257
|
title = c&.at(ns("./title"))
|
270
258
|
patent = ["Call for Patent Claims", "Patent Disclosure Notice"].include? title&.text
|
@@ -371,11 +359,44 @@ module IsoDoc
|
|
371
359
|
when "requirement" then requirement_parse(node, out)
|
372
360
|
when "permission" then permission_parse(node, out)
|
373
361
|
when "errata" then errata_parse(node, out)
|
362
|
+
when "authority" then authority_parse(node, out)
|
363
|
+
when "authority1" then authority1_parse(node, out, "authority1")
|
364
|
+
when "authority2" then authority1_parse(node, out, "authority2")
|
365
|
+
when "authority3" then authority1_parse(node, out, "authority3")
|
366
|
+
when "authority4" then authority1_parse(node, out, "authority4")
|
367
|
+
when "authority5" then authority1_parse(node, out, "authority5")
|
374
368
|
else
|
375
369
|
super
|
376
370
|
end
|
377
371
|
end
|
378
372
|
|
373
|
+
def authority_parse(node, out)
|
374
|
+
out.div **{class: "authority"} do |s|
|
375
|
+
node.children.each do |n|
|
376
|
+
if n.name == "title"
|
377
|
+
s.p **{class: "h1Preface"} do |h|
|
378
|
+
n.children.each { |nn| parse(nn, h) }
|
379
|
+
end
|
380
|
+
else
|
381
|
+
parse(n, s)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
def authority1_parse(node, out, classname)
|
387
|
+
out.div **{class: classname} do |s|
|
388
|
+
node.children.each do |n|
|
389
|
+
if n.name == "title"
|
390
|
+
s.p **{class: "h2Preface"} do |h|
|
391
|
+
n.children.each { |nn| parse(nn, h) }
|
392
|
+
end
|
393
|
+
else
|
394
|
+
parse(n, s)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
379
400
|
def nistvariable_parse(node, out)
|
380
401
|
out.span **{class: "nistvariable"} do |s|
|
381
402
|
node.children.each { |n| parse(n, s) }
|