metanorma-nist 1.0.8 → 1.0.9
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 +22 -0
- data/lib/asciidoctor/nist/biblio.rng +13 -3
- data/lib/asciidoctor/nist/front.rb +1 -0
- data/lib/asciidoctor/nist/front_id.rb +73 -23
- data/lib/asciidoctor/nist/isodoc.rng +17 -1
- data/lib/isodoc/nist/base_convert.rb +43 -61
- data/lib/isodoc/nist/html/nist.scss +1 -1
- data/lib/isodoc/nist/html/nist_cswp.scss +1 -1
- data/lib/isodoc/nist/html_convert.rb +29 -60
- data/lib/isodoc/nist/metadata.rb +0 -6
- data/lib/isodoc/nist/nist.cswp.xsl +181 -51
- data/lib/isodoc/nist/nist.sp.xsl +181 -51
- data/lib/isodoc/nist/refs.rb +38 -0
- data/lib/isodoc/nist/section.rb +55 -0
- data/lib/isodoc/nist/word_convert.rb +2 -38
- data/lib/metanorma/nist/version.rb +1 -1
- data/metanorma-nist.gemspec +2 -1
- metadata +19 -4
data/lib/isodoc/nist/refs.rb
CHANGED
@@ -57,6 +57,44 @@ module IsoDoc
|
|
57
57
|
bibitem = b.dup.to_xml
|
58
58
|
r.parent.add_child ::Iso690Render.render(bibitem, true)
|
59
59
|
end
|
60
|
+
|
61
|
+
def bibliography_parse(node, out)
|
62
|
+
title = node&.at(ns("./title"))&.text || ""
|
63
|
+
out.div do |div|
|
64
|
+
unless suppress_biblio_title(node)
|
65
|
+
anchor(node['id'], :label, false) and
|
66
|
+
clause_parse_title(node, div, node.at(ns("./title")), out) or
|
67
|
+
div.h2 title, **{ class: "Section3" }
|
68
|
+
end
|
69
|
+
biblio_list(node, div, true)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def bibliography(isoxml, out)
|
74
|
+
f = isoxml.at(ns("//bibliography/clause | //bibliography/references")) || return
|
75
|
+
page_break(out)
|
76
|
+
isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
|
77
|
+
out.div do |div|
|
78
|
+
div.h1 **{ class: "Section3" } do |h1|
|
79
|
+
if @bibliographycount == 1 then h1 << "References"
|
80
|
+
else
|
81
|
+
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
biblio_list(f, div, false)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def suppress_biblio_title(node)
|
90
|
+
return false unless node.parent.name == "annex"
|
91
|
+
return false if node.parent.xpath("./references | ./clause | "\
|
92
|
+
"./terms | ./definitions").size > 1
|
93
|
+
title1 = node&.at(ns("./title"))&.text
|
94
|
+
return true unless title1
|
95
|
+
title2 = node&.parent&.at(ns("./title"))&.text
|
96
|
+
title1&.casecmp(title2) == 0
|
97
|
+
end
|
60
98
|
end
|
61
99
|
end
|
62
100
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module NIST
|
3
|
+
module BaseConvert
|
4
|
+
def abstract(isoxml, out)
|
5
|
+
f = isoxml.at(ns("//preface/abstract")) || return
|
6
|
+
#page_break(out)
|
7
|
+
out.div **attr_code(id: f["id"]) do |s|
|
8
|
+
clause_name(nil, @abstract_lbl, s, class: "AbstractTitle")
|
9
|
+
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# All "[preface]" sections should have class "IntroTitle" to prevent
|
14
|
+
# page breaks, but for the Exec Summary
|
15
|
+
def preface(isoxml, out)
|
16
|
+
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
17
|
+
next if skip_render(c, isoxml)
|
18
|
+
title = c&.at(ns("./title"))
|
19
|
+
patent = ["Call for Patent Claims",
|
20
|
+
"Patent Disclosure Notice"].include? title&.text
|
21
|
+
preface1(c, title, patent, out)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def preface1(c, title, patent, out)
|
26
|
+
out.div **attr_code(id: c["id"]) do |s|
|
27
|
+
page_break(s) if patent
|
28
|
+
clause_name(anchor(c['id'], :label), title, s,
|
29
|
+
class: (c.name == "executivesummary") ? "NormalTitle" :
|
30
|
+
"IntroTitle")
|
31
|
+
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
32
|
+
parse(c1, s)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def middle(isoxml, out)
|
38
|
+
clause isoxml, out
|
39
|
+
bibliography isoxml, out
|
40
|
+
annex isoxml, out
|
41
|
+
end
|
42
|
+
|
43
|
+
def foreword(isoxml, out)
|
44
|
+
f = isoxml.at(ns("//foreword")) || return
|
45
|
+
out.div **attr_code(id: f["id"]) do |s|
|
46
|
+
title = f.at(ns("./title"))
|
47
|
+
s.h1(**{ class: "ForewordTitle" }) do |h1|
|
48
|
+
title and title.children.each { |e| parse(e, h1) }
|
49
|
+
end
|
50
|
+
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -155,29 +155,6 @@ module IsoDoc
|
|
155
155
|
docxml
|
156
156
|
end
|
157
157
|
|
158
|
-
def bibliography(isoxml, out)
|
159
|
-
f = isoxml.at(ns("//bibliography/clause | "\
|
160
|
-
"//bibliography/references")) || return
|
161
|
-
page_break(out)
|
162
|
-
isoxml.xpath(ns("//bibliography/clause | "\
|
163
|
-
"//bibliography/references")).each do |f|
|
164
|
-
out.div do |div|
|
165
|
-
#div.p **{ class: "h1Annex" } do |h1|
|
166
|
-
div.h1 do |h1|
|
167
|
-
if @bibliographycount == 1
|
168
|
-
h1 << "References"
|
169
|
-
else
|
170
|
-
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
171
|
-
end
|
172
|
-
end
|
173
|
-
f.elements.reject do |e|
|
174
|
-
["reference", "title", "bibitem"].include? e.name
|
175
|
-
end.each { |e| parse(e, div) }
|
176
|
-
biblio_list(f, div, false)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
158
|
def keywords(_docxml, out)
|
182
159
|
kw = @meta.get[:keywords]
|
183
160
|
kw.empty? and return
|
@@ -189,31 +166,18 @@ module IsoDoc
|
|
189
166
|
end
|
190
167
|
|
191
168
|
def termdef_parse(node, out)
|
192
|
-
pref = node.at(ns("./preferred"))
|
193
169
|
out.table **{ class: "terms_dl" } do |dl|
|
194
170
|
dl.tr do |tr|
|
195
171
|
tr.td **{ valign: "top", align: "left" } do |dt|
|
196
|
-
|
172
|
+
term_and_termref_parse(node, dt)
|
197
173
|
end
|
198
|
-
set_termdomain("")
|
199
174
|
tr.td **{ valign: "top" } do |dd|
|
200
|
-
node
|
175
|
+
term_rest_parse(node, dd)
|
201
176
|
end
|
202
177
|
end
|
203
178
|
end
|
204
179
|
end
|
205
180
|
|
206
|
-
def term_cleanup(docxml)
|
207
|
-
docxml.xpath("//table[@class = 'terms_dl']").each do |d|
|
208
|
-
prev = d.previous_element
|
209
|
-
next unless prev and prev.name == "table" and
|
210
|
-
prev["class"] == "terms_dl"
|
211
|
-
d.children.each { |n| prev.add_child(n.remove) }
|
212
|
-
d.remove
|
213
|
-
end
|
214
|
-
docxml
|
215
|
-
end
|
216
|
-
|
217
181
|
include BaseConvert
|
218
182
|
end
|
219
183
|
end
|
data/metanorma-nist.gemspec
CHANGED
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
28
28
|
spec.add_dependency "ruby-jing"
|
29
29
|
spec.add_dependency "twitter_cldr"
|
30
|
+
spec.add_dependency "iso-639"
|
30
31
|
spec.add_dependency "tzinfo-data" # we need this for windows only
|
31
32
|
|
32
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
33
|
+
spec.add_dependency "metanorma-standoc", "~> 1.4.0"
|
33
34
|
spec.add_dependency "isodoc", "~> 1.0.0"
|
34
35
|
#spec.add_dependency "relaton-nist", "~> 0.3.0"
|
35
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-nist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: iso-639
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: tzinfo-data
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +86,14 @@ dependencies:
|
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
89
|
+
version: 1.4.0
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
96
|
+
version: 1.4.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: isodoc
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,6 +302,7 @@ files:
|
|
288
302
|
- lib/isodoc/nist/render.rb
|
289
303
|
- lib/isodoc/nist/render_contributors.rb
|
290
304
|
- lib/isodoc/nist/render_dates.rb
|
305
|
+
- lib/isodoc/nist/section.rb
|
291
306
|
- lib/isodoc/nist/word_convert.rb
|
292
307
|
- lib/isodoc/nist/word_convert_toc.rb
|
293
308
|
- lib/isodoc/nist/xrefs.rb
|