metanorma-nist 1.1.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +14 -0
- data/lib/asciidoctor/nist/basicdoc.rng +31 -1
- data/lib/asciidoctor/nist/boilerplate.rb +2 -2
- data/lib/asciidoctor/nist/cleanup.rb +34 -4
- data/lib/asciidoctor/nist/converter.rb +20 -6
- data/lib/asciidoctor/nist/front.rb +37 -46
- data/lib/asciidoctor/nist/front_id.rb +1 -1
- data/lib/asciidoctor/nist/isodoc.rng +124 -15
- data/lib/asciidoctor/nist/nist.rng +18 -0
- data/lib/asciidoctor/nist/validate.rb +16 -9
- data/lib/isodoc/nist/base_convert.rb +26 -75
- data/lib/isodoc/nist/html/_coverpage.css +243 -0
- data/lib/isodoc/nist/html/htmlstyle.css +955 -0
- data/lib/isodoc/nist/html/nist.css +1067 -0
- data/lib/isodoc/nist/html/nist.scss +24 -10
- data/lib/isodoc/nist/html/nist_cswp.css +1008 -0
- data/lib/isodoc/nist/html/nist_cswp.scss +23 -9
- data/lib/isodoc/nist/html/wordstyle.css +1520 -0
- data/lib/isodoc/nist/html/wordstyle.scss +74 -3
- data/lib/isodoc/nist/html/wordstyle_cswp.css +1194 -0
- data/lib/isodoc/nist/html/wordstyle_cswp.scss +68 -2
- data/lib/isodoc/nist/html_convert.rb +3 -0
- data/lib/isodoc/nist/i18n-en.yaml +3 -0
- data/lib/isodoc/nist/i18n.rb +10 -0
- data/lib/isodoc/nist/init.rb +37 -0
- data/lib/isodoc/nist/metadata_id.rb +1 -1
- data/lib/isodoc/nist/nist.cswp.xsl +1871 -2273
- data/lib/isodoc/nist/nist.sp.xsl +1991 -2183
- data/lib/isodoc/nist/pdf_convert.rb +0 -1
- data/lib/isodoc/nist/presentation_xml_convert.rb +71 -1
- data/lib/isodoc/nist/refs.rb +2 -17
- data/lib/isodoc/nist/render.rb +2 -1
- data/lib/isodoc/nist/render_contributors.rb +1 -1
- data/lib/isodoc/nist/render_dates.rb +0 -25
- data/lib/isodoc/nist/section.rb +26 -13
- data/lib/isodoc/nist/word_convert.rb +47 -14
- data/lib/isodoc/nist/xref.rb +1 -24
- data/lib/metanorma/nist/version.rb +1 -1
- data/metanorma-nist.gemspec +2 -2
- metadata +14 -6
@@ -9,6 +9,24 @@
|
|
9
9
|
<start>
|
10
10
|
<ref name="nist-standard"/>
|
11
11
|
</start>
|
12
|
+
<define name="ol">
|
13
|
+
<element name="ol">
|
14
|
+
<attribute name="id">
|
15
|
+
<data type="ID"/>
|
16
|
+
</attribute>
|
17
|
+
<optional>
|
18
|
+
<attribute name="class">
|
19
|
+
<value>steps</value>
|
20
|
+
</attribute>
|
21
|
+
</optional>
|
22
|
+
<oneOrMore>
|
23
|
+
<ref name="li"/>
|
24
|
+
</oneOrMore>
|
25
|
+
<zeroOrMore>
|
26
|
+
<ref name="note"/>
|
27
|
+
</zeroOrMore>
|
28
|
+
</element>
|
29
|
+
</define>
|
12
30
|
<define name="DocumentType">
|
13
31
|
<value>standard</value>
|
14
32
|
</define>
|
@@ -21,26 +21,30 @@ module Asciidoctor
|
|
21
21
|
def doctype_validate(xmldoc)
|
22
22
|
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
23
23
|
%w(standard).include? doctype or
|
24
|
-
@log.add("Document Attributes", nil,
|
24
|
+
@log.add("Document Attributes", nil,
|
25
|
+
"#{doctype} is not a recognised document type")
|
25
26
|
end
|
26
27
|
|
27
28
|
def stage_validate(xmldoc)
|
28
29
|
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
29
30
|
%w(draft-internal draft-wip draft-prelim draft-public draft-approval
|
30
31
|
final final-review).include? stage or
|
31
|
-
@log.add("Document Attributes", nil,
|
32
|
+
@log.add("Document Attributes", nil,
|
33
|
+
"#{stage} is not a recognised stage")
|
32
34
|
end
|
33
35
|
|
34
36
|
def substage_validate(xmldoc)
|
35
37
|
substage = xmldoc&.at("//bibdata/status/substage")&.text or return
|
36
38
|
%w(active retired withdrawn).include? substage or
|
37
|
-
@log.add("Document Attributes", nil,
|
39
|
+
@log.add("Document Attributes", nil,
|
40
|
+
"#{substage} is not a recognised substage")
|
38
41
|
end
|
39
42
|
|
40
43
|
def iteration_validate(xmldoc)
|
41
44
|
iteration = xmldoc&.at("//bibdata/status/iteration")&.text or return
|
42
45
|
%w(final).include? iteration.downcase or /^\d+$/.match(iteration) or
|
43
|
-
@log.add("Document Attributes", nil,
|
46
|
+
@log.add("Document Attributes", nil,
|
47
|
+
"#{iteration} is not a recognised iteration")
|
44
48
|
end
|
45
49
|
|
46
50
|
def series_validate(xmldoc)
|
@@ -48,7 +52,8 @@ module Asciidoctor
|
|
48
52
|
found = false
|
49
53
|
SERIES.each { |_, v| found = true if v == series }
|
50
54
|
found or
|
51
|
-
@log.add("Document Attributes", nil,
|
55
|
+
@log.add("Document Attributes", nil,
|
56
|
+
"#{series} is not a recognised series")
|
52
57
|
end
|
53
58
|
|
54
59
|
def validate(doc)
|
@@ -60,8 +65,9 @@ module Asciidoctor
|
|
60
65
|
def introduction_validate(doc)
|
61
66
|
intro = doc.at("//sections/clause/title")
|
62
67
|
intro&.text == "Introduction" or
|
63
|
-
@log.add("Style", intro,
|
64
|
-
|
68
|
+
@log.add("Style", intro,
|
69
|
+
"First section of document body should be Introduction, "\
|
70
|
+
"not #{intro&.text}")
|
65
71
|
end
|
66
72
|
|
67
73
|
REF_SECTIONS_TO_VALIDATE = "//references[not(parent::clause)]/title | "\
|
@@ -80,8 +86,9 @@ module Asciidoctor
|
|
80
86
|
return if names == ["References"]
|
81
87
|
return if names == ["Bibliography"]
|
82
88
|
return if names == ["References", "Bibliography"]
|
83
|
-
@log.add("Style", nil,
|
84
|
-
|
89
|
+
@log.add("Style", nil,
|
90
|
+
"Reference clauses #{names.join(', ')} do not follow "\
|
91
|
+
"expected pattern in NIST")
|
85
92
|
end
|
86
93
|
end
|
87
94
|
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require_relative "metadata"
|
3
|
-
require_relative "xref"
|
4
2
|
require_relative "refs"
|
5
3
|
require_relative "section"
|
6
4
|
require "fileutils"
|
@@ -8,37 +6,6 @@ require "fileutils"
|
|
8
6
|
module IsoDoc
|
9
7
|
module NIST
|
10
8
|
module BaseConvert
|
11
|
-
def metadata_init(lang, script, labels)
|
12
|
-
@meta = Metadata.new(lang, script, labels)
|
13
|
-
end
|
14
|
-
|
15
|
-
def xref_init(lang, script, klass, labels, options)
|
16
|
-
@xrefs = Xref.new(lang, script, klass, labels, options)
|
17
|
-
end
|
18
|
-
|
19
|
-
def keywords(_docxml, out)
|
20
|
-
kw = @meta.get[:keywords]
|
21
|
-
kw.empty? and return
|
22
|
-
out.div **{ class: "Section3" } do |div|
|
23
|
-
clause_name(nil, "Keywords", div, class: "IntroTitle")
|
24
|
-
div.p kw.sort.join("; ")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
FRONT_CLAUSE = "//*[parent::preface][not(local-name() = 'abstract' or "\
|
29
|
-
"local-name() = 'foreword')]".freeze
|
30
|
-
|
31
|
-
def skip_render(c, isoxml)
|
32
|
-
return false unless c.name == "reviewernote"
|
33
|
-
status = isoxml&.at(ns("//bibdata/status/stage"))&.text
|
34
|
-
return true if status.nil?
|
35
|
-
/^final/.match status
|
36
|
-
end
|
37
|
-
|
38
|
-
def fileloc(loc)
|
39
|
-
File.join(File.dirname(__FILE__), loc)
|
40
|
-
end
|
41
|
-
|
42
9
|
def requirement_cleanup(docxml)
|
43
10
|
docxml.xpath("//div[@class = 'recommend' or @class = 'require' "\
|
44
11
|
"or @class = 'permission']").each do |d|
|
@@ -54,6 +21,7 @@ module IsoDoc
|
|
54
21
|
|
55
22
|
def dl_parse(node, out)
|
56
23
|
return glossary_parse(node, out) if node["type"] == "glossary"
|
24
|
+
return glossary_parse(node, out) if node.parent.name == "definitions"
|
57
25
|
super
|
58
26
|
end
|
59
27
|
|
@@ -84,9 +52,20 @@ module IsoDoc
|
|
84
52
|
end
|
85
53
|
|
86
54
|
def boilerplate(node, out)
|
87
|
-
|
88
|
-
|
55
|
+
boilerplate = node.at(ns("//boilerplate")) or return
|
56
|
+
out.div **{class: "authority"} do |s|
|
57
|
+
boilerplate.children.each do |n|
|
58
|
+
if n.name == "title"
|
59
|
+
s.h1 do |h|
|
60
|
+
n.children.each { |nn| parse(nn, h) }
|
61
|
+
end
|
62
|
+
else
|
63
|
+
parse(n, s)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
page_break(s)
|
89
67
|
end
|
68
|
+
end
|
90
69
|
|
91
70
|
def children_parse(node, out)
|
92
71
|
node.children.each do |n|
|
@@ -152,33 +131,6 @@ module IsoDoc
|
|
152
131
|
super
|
153
132
|
end
|
154
133
|
|
155
|
-
def wrap_brackets(txt)
|
156
|
-
return txt if /^\[.*\]$/.match txt
|
157
|
-
"[#{txt}]"
|
158
|
-
end
|
159
|
-
|
160
|
-
def get_linkend(node)
|
161
|
-
link = anchor_linkend(node, docid_l10n(node["target"] ||
|
162
|
-
wrap_brackets(node['citeas'])))
|
163
|
-
link += eref_localities(node.xpath(ns("./locality | ./localityStack")),
|
164
|
-
link)
|
165
|
-
contents = node.children.select do |c|
|
166
|
-
!%w{locality localityStack}.include? c.name
|
167
|
-
end
|
168
|
-
return link if contents.nil? || contents.empty?
|
169
|
-
Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
|
170
|
-
end
|
171
|
-
|
172
|
-
def load_yaml(lang, script)
|
173
|
-
y = if @i18nyaml then YAML.load_file(@i18nyaml)
|
174
|
-
elsif lang == "en"
|
175
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
176
|
-
else
|
177
|
-
YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
|
178
|
-
end
|
179
|
-
super.merge(y)
|
180
|
-
end
|
181
|
-
|
182
134
|
def terms_parse(node, out)
|
183
135
|
out.div **attr_code(id: node["id"]) do |div|
|
184
136
|
node.at(ns("./title")) and
|
@@ -218,28 +170,27 @@ module IsoDoc
|
|
218
170
|
def term_rest_parse(node, dd)
|
219
171
|
set_termdomain("")
|
220
172
|
node.children.each do |n|
|
221
|
-
parse(n, dd) unless %w(preferred termsource).include?(n.name)
|
173
|
+
parse(n, dd) unless %w(preferred termsource name).include?(n.name)
|
222
174
|
end
|
223
175
|
end
|
224
176
|
|
225
177
|
def modification_parse(node, out)
|
226
|
-
out << @
|
178
|
+
out << @i18n.modified
|
227
179
|
node.at(ns("./p[text()[normalize-space() != '']]")) and
|
228
180
|
out << " — "
|
229
181
|
node.at(ns("./p")).children.each { |n| parse(n, out) }
|
230
182
|
end
|
231
183
|
|
232
|
-
def
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
end
|
184
|
+
def ol_depth(node)
|
185
|
+
return super unless node["class"] == "steps" or
|
186
|
+
node.at(".//ancestor::xmlns:ol[@class = 'steps']")
|
187
|
+
depth = node.ancestors("ul, ol").size + 1
|
188
|
+
type = :arabic
|
189
|
+
type = :alphabet if [2, 7].include? depth
|
190
|
+
type = :roman if [3, 8].include? depth
|
191
|
+
type = :alphabet_upper if [4, 9].include? depth
|
192
|
+
type = :roman_upper if [5, 10].include? depth
|
193
|
+
ol_style(type)
|
243
194
|
end
|
244
195
|
end
|
245
196
|
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
.coverpage-maturity, .coverpage-stage {
|
2
|
+
font-family: 'Source Sans Pro', sans-serif;
|
3
|
+
font-weight: 400;
|
4
|
+
font-size: 1em;
|
5
|
+
margin: 0 0 2em 0;
|
6
|
+
text-transform: uppercase; }
|
7
|
+
|
8
|
+
.coverpage-maturity {
|
9
|
+
font-family: {{bodyfont}};
|
10
|
+
font-weight: 400;
|
11
|
+
font-size: 1em;
|
12
|
+
margin: 0 0 2em 0;
|
13
|
+
text-transform: uppercase; }
|
14
|
+
|
15
|
+
.coverpage-warning {
|
16
|
+
border: #f36f36 solid 2px;
|
17
|
+
color: #f36f36 !important;
|
18
|
+
margin: 50px 100px;
|
19
|
+
color: #2e81c2;
|
20
|
+
padding: 10px;
|
21
|
+
border-radius: 25px;
|
22
|
+
text-align: center;
|
23
|
+
font-size: 14px; }
|
24
|
+
.coverpage-warning p {
|
25
|
+
margin: 0;
|
26
|
+
line-height: 1.6; }
|
27
|
+
.coverpage-warning .title, .coverpage-warning .authority6 h1, .coverpage-warning .authority6 h2 {
|
28
|
+
margin-top: 0em;
|
29
|
+
font-family: 'Source Sans Pro', sans-serif;
|
30
|
+
font-weight: 300;
|
31
|
+
text-transform: uppercase;
|
32
|
+
font-size: 1.2em; }
|
33
|
+
|
34
|
+
.logo-wrapper {
|
35
|
+
margin-left: 3em;
|
36
|
+
margin-top: 100px;
|
37
|
+
margin-bottom: 100px;
|
38
|
+
float: right; }
|
39
|
+
|
40
|
+
img#NIST-logo {
|
41
|
+
width: 300px;
|
42
|
+
height: auto;
|
43
|
+
padding-top: 3m;
|
44
|
+
margin-right: 50px; }
|
45
|
+
|
46
|
+
.logo-info {
|
47
|
+
margin-left: 3em;
|
48
|
+
margin-bottom: 1.5em; }
|
49
|
+
|
50
|
+
.logo-info p {
|
51
|
+
margin: 0; }
|
52
|
+
|
53
|
+
#commerce-logo {
|
54
|
+
width: 150px;
|
55
|
+
height: auto; }
|
56
|
+
|
57
|
+
.authors-container, .currency {
|
58
|
+
margin-top: 2em; }
|
59
|
+
|
60
|
+
.affiliation {
|
61
|
+
font-style: italic;
|
62
|
+
margin-bottom: 1em; }
|
63
|
+
|
64
|
+
.main-section {
|
65
|
+
word-wrap: break-word; }
|
66
|
+
|
67
|
+
.coverpage-title {
|
68
|
+
font-family: {{headerfont}}; }
|
69
|
+
.coverpage-title span {
|
70
|
+
font-family: {{headerfont}};
|
71
|
+
font-size: 1.1em;
|
72
|
+
line-height: 1; }
|
73
|
+
|
74
|
+
.wrapper-top {
|
75
|
+
background: #fff;
|
76
|
+
color: #141115;
|
77
|
+
padding: 7em 0;
|
78
|
+
margin-left: 3em; }
|
79
|
+
|
80
|
+
.doc-number {
|
81
|
+
font-size: 20px;
|
82
|
+
font-family: {{bodyfont}};
|
83
|
+
line-height: 1.6;
|
84
|
+
margin: 1.5em 0; }
|
85
|
+
|
86
|
+
.title-second {
|
87
|
+
font-style: italic;
|
88
|
+
font-size: 15px;
|
89
|
+
line-height: 1.6;
|
90
|
+
margin-bottom: 1.5em; }
|
91
|
+
|
92
|
+
.download-info {
|
93
|
+
margin-top: 2em; }
|
94
|
+
|
95
|
+
.category {
|
96
|
+
color: #2677ea;
|
97
|
+
margin-top: 4em;
|
98
|
+
margin-right: 2em;
|
99
|
+
padding: 0.7em 1em;
|
100
|
+
text-align: center;
|
101
|
+
border-top: solid 1px #2677ea;
|
102
|
+
border-bottom: solid 1px #2677ea;
|
103
|
+
text-transform: uppercase; }
|
104
|
+
|
105
|
+
.banner {
|
106
|
+
border-top: 1px solid #2677ea;
|
107
|
+
border-bottom: 1px solid #2677ea;
|
108
|
+
margin-right: 50px;
|
109
|
+
margin-top: 100px; }
|
110
|
+
#inactive-draft.banner {
|
111
|
+
display: none; }
|
112
|
+
.banner p {
|
113
|
+
text-transform: uppercase;
|
114
|
+
font-weight: 300;
|
115
|
+
font-size: 16px;
|
116
|
+
letter-spacing: 5px;
|
117
|
+
text-align: center;
|
118
|
+
color: #2677ea;
|
119
|
+
font-family: {{monospacefont}}; }
|
120
|
+
|
121
|
+
.WordSection11 {
|
122
|
+
padding: 0 2em 0 3em; }
|
123
|
+
|
124
|
+
.info-section {
|
125
|
+
padding: 0; }
|
126
|
+
|
127
|
+
.prefatory-section {
|
128
|
+
padding: 0 3em 0 6em; }
|
129
|
+
|
130
|
+
.zzSTDTitle1, .MsoCommentText {
|
131
|
+
display: none; }
|
132
|
+
|
133
|
+
.coverpage {
|
134
|
+
text-align: left;
|
135
|
+
padding-left: 1.5em; }
|
136
|
+
|
137
|
+
.coverpage-logo span, .coverpage-tc-name span {
|
138
|
+
font-family: {{bodyfont}};
|
139
|
+
text-transform: none;
|
140
|
+
font-weight: 300; }
|
141
|
+
|
142
|
+
.coverpage-logo span {
|
143
|
+
display: block;
|
144
|
+
float: left; }
|
145
|
+
|
146
|
+
.coverpage-tc-name {
|
147
|
+
font-size: 1.2em;
|
148
|
+
line-height: 1.2em;
|
149
|
+
margin: 0.25em 0; }
|
150
|
+
|
151
|
+
.coverpage-doc-identity {
|
152
|
+
font-size: 2em;
|
153
|
+
line-height: 1.5em;
|
154
|
+
margin-bottom: 150px; }
|
155
|
+
|
156
|
+
.coverpage-stage-block {
|
157
|
+
font-family: 'Source Sans Pro', sans-serif;
|
158
|
+
font-weight: 600;
|
159
|
+
font-size: 1.25em;
|
160
|
+
margin: 2em 0em 2em 0em;
|
161
|
+
text-transform: uppercase; }
|
162
|
+
|
163
|
+
.copyright {
|
164
|
+
padding: 1em;
|
165
|
+
font-size: 0.9em;
|
166
|
+
text-align: left; }
|
167
|
+
|
168
|
+
table.coverpage-table {
|
169
|
+
max-width: 500px;
|
170
|
+
font-size: 14px; }
|
171
|
+
|
172
|
+
.more-info {
|
173
|
+
margin-right: 50px; }
|
174
|
+
.more-info h2 {
|
175
|
+
text-align: center;
|
176
|
+
color: #2e81c2;
|
177
|
+
font-size: 20px;
|
178
|
+
font-family: 'Source Sans Pro', sans-serif;
|
179
|
+
font-weight: 300;
|
180
|
+
text-transform: uppercase; }
|
181
|
+
.more-info p {
|
182
|
+
font-size: 14px; }
|
183
|
+
|
184
|
+
.contact-info, .authority5 {
|
185
|
+
padding: 2em;
|
186
|
+
margin-top: 5em;
|
187
|
+
text-align: left;
|
188
|
+
color: #2677ea !important;
|
189
|
+
background-color: #f1f8ff;
|
190
|
+
border-radius: 25px; }
|
191
|
+
.contact-info a, .contact-info a:hover, .authority5 a, .authority5 a:hover {
|
192
|
+
color: #2677ea; }
|
193
|
+
|
194
|
+
.authority5 h2 {
|
195
|
+
text-align: center; }
|
196
|
+
|
197
|
+
.authority3 {
|
198
|
+
border: solid;
|
199
|
+
padding: 1em; }
|
200
|
+
|
201
|
+
.contact-info {
|
202
|
+
width: 280px; }
|
203
|
+
.contact-info a:hover {
|
204
|
+
text-decoration: underline;
|
205
|
+
background: none;
|
206
|
+
box-shadow: 0 0 0 0; }
|
207
|
+
.contact-info p, .contact-info a {
|
208
|
+
font-family: {{monospacefont}};
|
209
|
+
font-variant-ligatures: none;
|
210
|
+
font-weight: 400; }
|
211
|
+
.contact-info .name {
|
212
|
+
font-weight: 700;
|
213
|
+
font-size: 14px;
|
214
|
+
margin-bottom: 5px; }
|
215
|
+
.contact-info .address {
|
216
|
+
font-size: 12px;
|
217
|
+
line-height: 1.3em;
|
218
|
+
margin-top: 0; }
|
219
|
+
|
220
|
+
.draft-state-container {
|
221
|
+
margin-bottom: 30px;
|
222
|
+
margin-top: -30px; }
|
223
|
+
|
224
|
+
.draft-state {
|
225
|
+
font-size: 20px;
|
226
|
+
color: #f36f36; }
|
227
|
+
#inactive-draft.draft-state {
|
228
|
+
color: #7e0d13; }
|
229
|
+
#inactive-final.draft-state {
|
230
|
+
color: #750697; }
|
231
|
+
|
232
|
+
.draft-description {
|
233
|
+
font-size: 14px; }
|
234
|
+
.draft-description p {
|
235
|
+
margin-top: 10px;
|
236
|
+
margin-bottom: 0; }
|
237
|
+
|
238
|
+
#retired-draft {
|
239
|
+
color: #7e0d13; }
|
240
|
+
|
241
|
+
@media print {
|
242
|
+
.coverpage {
|
243
|
+
height: 23cm; } }
|