metanorma-nist 1.0.7 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +8 -1
- data/.github/workflows/ubuntu.yml +20 -7
- data/.github/workflows/windows.yml +8 -1
- data/README.adoc +22 -0
- data/lib/asciidoctor/nist/biblio.rng +36 -6
- data/lib/asciidoctor/nist/cleanup.rb +5 -4
- data/lib/asciidoctor/nist/converter.rb +13 -18
- data/lib/asciidoctor/nist/front.rb +1 -0
- data/lib/asciidoctor/nist/front_id.rb +73 -23
- data/lib/asciidoctor/nist/isodoc.rng +444 -1
- data/lib/asciidoctor/nist/reqt.rng +23 -0
- data/lib/isodoc/nist/base_convert.rb +66 -62
- data/lib/isodoc/nist/html/_coverpage.scss +1 -1
- data/lib/isodoc/nist/html/html_nist_titlepage.html +1 -1
- data/lib/isodoc/nist/html/nist.scss +1 -1
- data/lib/isodoc/nist/html/nist_cswp.scss +1 -1
- data/lib/isodoc/nist/html/scripts.html +10 -7
- data/lib/isodoc/nist/html_convert.rb +30 -68
- 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/pdf_convert.rb +4 -15
- data/lib/isodoc/nist/presentation_xml_convert.rb +10 -0
- data/lib/isodoc/nist/refs.rb +53 -5
- data/lib/isodoc/nist/section.rb +56 -0
- data/lib/isodoc/nist/word_convert.rb +2 -42
- data/lib/isodoc/nist/word_convert_toc.rb +2 -2
- data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -2
- data/lib/metanorma-nist.rb +2 -0
- data/lib/metanorma/nist/processor.rb +11 -9
- data/lib/metanorma/nist/version.rb +1 -1
- data/metanorma-nist.gemspec +3 -2
- metadata +27 -13
- data/lib/isodoc/nist/html/scripts.pdf.html +0 -72
@@ -30,9 +30,22 @@
|
|
30
30
|
<data type="boolean"/>
|
31
31
|
</attribute>
|
32
32
|
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="number"/>
|
35
|
+
</optional>
|
33
36
|
<optional>
|
34
37
|
<attribute name="subsequence"/>
|
35
38
|
</optional>
|
39
|
+
<optional>
|
40
|
+
<attribute name="keep-with-next">
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
<optional>
|
45
|
+
<attribute name="keep-lines-together">
|
46
|
+
<data type="boolean"/>
|
47
|
+
</attribute>
|
48
|
+
</optional>
|
36
49
|
<attribute name="id">
|
37
50
|
<data type="ID"/>
|
38
51
|
</attribute>
|
@@ -141,6 +154,16 @@
|
|
141
154
|
<data type="boolean"/>
|
142
155
|
</attribute>
|
143
156
|
</optional>
|
157
|
+
<optional>
|
158
|
+
<attribute name="keep-with-next">
|
159
|
+
<data type="boolean"/>
|
160
|
+
</attribute>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-lines-together">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
144
167
|
<oneOrMore>
|
145
168
|
<ref name="BasicBlock"/>
|
146
169
|
</oneOrMore>
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require_relative "metadata"
|
3
|
-
require_relative "
|
3
|
+
require_relative "xref"
|
4
4
|
require_relative "refs"
|
5
|
+
require_relative "section"
|
5
6
|
require "fileutils"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module NIST
|
9
10
|
module BaseConvert
|
10
|
-
def
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
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
17
|
end
|
18
18
|
|
19
19
|
def keywords(_docxml, out)
|
@@ -25,27 +25,8 @@ module IsoDoc
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
FRONT_CLAUSE = "//*[parent::preface][not(local-name() = 'abstract' or
|
29
|
-
|
30
|
-
# All "[preface]" sections should have class "IntroTitle" to prevent
|
31
|
-
# page breaks
|
32
|
-
# But for the Exec Summary
|
33
|
-
def preface(isoxml, out)
|
34
|
-
isoxml.xpath(ns(FRONT_CLAUSE)).each do |c|
|
35
|
-
next if skip_render(c, isoxml)
|
36
|
-
title = c&.at(ns("./title"))
|
37
|
-
patent = ["Call for Patent Claims", "Patent Disclosure Notice"].include? title&.text
|
38
|
-
out.div **attr_code(id: c["id"]) do |s|
|
39
|
-
page_break(s) if patent
|
40
|
-
clause_name(anchor(c['id'], :label), title, s,
|
41
|
-
class: (c.name == "executivesummary") ? "NormalTitle" :
|
42
|
-
"IntroTitle")
|
43
|
-
c.elements.reject { |c1| c1.name == "title" }.each do |c1|
|
44
|
-
parse(c1, s)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
28
|
+
FRONT_CLAUSE = "//*[parent::preface][not(local-name() = 'abstract' or "\
|
29
|
+
"local-name() = 'foreword')]".freeze
|
49
30
|
|
50
31
|
def skip_render(c, isoxml)
|
51
32
|
return false unless c.name == "reviewernote"
|
@@ -121,7 +102,7 @@ module IsoDoc
|
|
121
102
|
|
122
103
|
def errata_parse(node, out)
|
123
104
|
out.a **{ name: "errata_XYZZY" }
|
124
|
-
out.table **
|
105
|
+
out.table **table_attrs(node) do |t|
|
125
106
|
errata_head(t)
|
126
107
|
errata_body(t, node)
|
127
108
|
end
|
@@ -153,17 +134,18 @@ module IsoDoc
|
|
153
134
|
end
|
154
135
|
end
|
155
136
|
|
156
|
-
|
157
|
-
"//terms[parent::sections]"
|
137
|
+
def middle_clause
|
138
|
+
"//clause[parent::sections] | //terms[parent::sections]"
|
139
|
+
end
|
158
140
|
|
159
141
|
def middle(isoxml, out)
|
142
|
+
middle_admonitions(isoxml, out)
|
160
143
|
clause isoxml, out
|
161
144
|
bibliography isoxml, out
|
162
145
|
annex isoxml, out
|
163
146
|
end
|
164
147
|
|
165
148
|
def info(isoxml, out)
|
166
|
-
@meta.keywords isoxml, out
|
167
149
|
@meta.series isoxml, out
|
168
150
|
@meta.commentperiod isoxml, out
|
169
151
|
@meta.note isoxml, out
|
@@ -176,13 +158,15 @@ module IsoDoc
|
|
176
158
|
end
|
177
159
|
|
178
160
|
def get_linkend(node)
|
179
|
-
link = anchor_linkend(node, docid_l10n(node["target"] ||
|
180
|
-
|
181
|
-
|
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
|
182
168
|
return link if contents.nil? || contents.empty?
|
183
169
|
Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
|
184
|
-
# so not <origin bibitemid="ISO7301" citeas="ISO 7301">
|
185
|
-
# <locality type="section"><reference>3.1</reference></locality></origin>
|
186
170
|
end
|
187
171
|
|
188
172
|
def load_yaml(lang, script)
|
@@ -205,36 +189,56 @@ module IsoDoc
|
|
205
189
|
end
|
206
190
|
end
|
207
191
|
|
208
|
-
def
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
192
|
+
def termref_parse(node, out)
|
193
|
+
end
|
194
|
+
|
195
|
+
def term_cleanup(docxml)
|
196
|
+
docxml.xpath("//table[@class = 'terms_dl']").each do |d|
|
197
|
+
prev = d.previous_element
|
198
|
+
next unless prev && prev.name == "table" &&
|
199
|
+
prev["class"] == "terms_dl"
|
200
|
+
d.children.each { |n| prev.add_child(n.remove) }
|
201
|
+
d.remove
|
217
202
|
end
|
203
|
+
docxml
|
218
204
|
end
|
219
205
|
|
220
|
-
def
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
206
|
+
def term_and_termref_parse(node, dt)
|
207
|
+
pref = node.at(ns("./preferred"))
|
208
|
+
source = node.xpath(ns("./termsource"))
|
209
|
+
pref.children.each { |n| parse(n, dt) }
|
210
|
+
return if source.empty?
|
211
|
+
dt << "<br/>"
|
212
|
+
source.each_with_index do |s, i|
|
213
|
+
i > 0 and dt << "; "
|
214
|
+
s.elements.each { |n| parse(n, dt) }
|
215
|
+
end
|
228
216
|
end
|
229
217
|
|
230
|
-
def
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
218
|
+
def term_rest_parse(node, dd)
|
219
|
+
set_termdomain("")
|
220
|
+
node.children.each do |n|
|
221
|
+
parse(n, dd) unless %w(preferred termsource).include?(n.name)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def modification_parse(node, out)
|
226
|
+
out << @modified_lbl
|
227
|
+
node.at(ns("./p[text()[normalize-space() != '']]")) and
|
228
|
+
out << " — "
|
229
|
+
node.at(ns("./p")).children.each { |n| parse(n, out) }
|
230
|
+
end
|
231
|
+
|
232
|
+
def annex_name(annex, name, div)
|
233
|
+
div.h1 **{ class: "Annex" } do |t|
|
234
|
+
t << "#{@xrefs.anchor(annex['id'], :label)} — "
|
235
|
+
t.b do |b|
|
236
|
+
if @bibliographycount == 1 && annex.at(ns("./references"))
|
237
|
+
b << "References"
|
238
|
+
else
|
239
|
+
name&.children&.each { |c2| parse(c2, b) }
|
240
|
+
end
|
236
241
|
end
|
237
|
-
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
238
242
|
end
|
239
243
|
end
|
240
244
|
end
|
@@ -163,7 +163,7 @@
|
|
163
163
|
|
164
164
|
|
165
165
|
{% unless unpublished %}
|
166
|
-
<div class="
|
166
|
+
<div class="currency">
|
167
167
|
<span>{{ issueddate_monthyear }}</span>
|
168
168
|
{%if confirmeddate and confirmeddate != "XXX" %}
|
169
169
|
<br/>Publication is current as of {{ confirmeddate_MMMddyyyy }}
|
@@ -693,7 +693,7 @@ div.Admonition {
|
|
693
693
|
mso-ansi-language:EN-AU;
|
694
694
|
}
|
695
695
|
|
696
|
-
div
|
696
|
+
div.Admonition p {
|
697
697
|
margin-top:6.0pt;margin-right:0cm;
|
698
698
|
margin-bottom:6.0pt;margin-left:0cm;text-align:left;mso-pagination:widow-orphan;
|
699
699
|
mso-hyphenate:auto;background:#dddddd;mso-layout-grid-align:auto;mso-vertical-align-alt:
|
@@ -643,7 +643,7 @@ div.Admonition {
|
|
643
643
|
mso-ansi-language:EN-AU;
|
644
644
|
}
|
645
645
|
|
646
|
-
div
|
646
|
+
div.Admonition p {
|
647
647
|
margin-top:6.0pt;margin-right:0cm;
|
648
648
|
margin-bottom:6.0pt;margin-left:0cm;text-align:left;mso-pagination:widow-orphan;
|
649
649
|
mso-hyphenate:auto;background:#dddddd;mso-layout-grid-align:auto;mso-vertical-align-alt:
|
@@ -42,13 +42,16 @@ $('#toggle').on('click', function(){
|
|
42
42
|
</script>
|
43
43
|
|
44
44
|
<script>
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
46
|
+
//
|
47
|
+
// AnchorJS - v4.2.2 - 2020-04-20
|
48
|
+
// https://www.bryanbraun.com/anchorjs/
|
49
|
+
// Copyright (c) 2020 Bryan Braun; Licensed MIT
|
50
|
+
//
|
51
|
+
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
52
|
+
!function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
|
53
|
+
// @license-end
|
54
|
+
</script>
|
52
55
|
<script>
|
53
56
|
/*
|
54
57
|
$(document).ready(function() {
|
@@ -20,9 +20,11 @@ module IsoDoc
|
|
20
20
|
|
21
21
|
def default_fonts(options)
|
22
22
|
{
|
23
|
-
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
24
|
-
|
25
|
-
|
23
|
+
bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
24
|
+
'"Libre Baskerville",serif'),
|
25
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
26
|
+
'"Libre Baskerville",serif'),
|
27
|
+
monospacefont: '"Space Mono",monospace'
|
26
28
|
}
|
27
29
|
end
|
28
30
|
|
@@ -35,10 +37,6 @@ module IsoDoc
|
|
35
37
|
}
|
36
38
|
end
|
37
39
|
|
38
|
-
def metadata_init(lang, script, labels)
|
39
|
-
@meta = Metadata.new(lang, script, labels)
|
40
|
-
end
|
41
|
-
|
42
40
|
def googlefonts
|
43
41
|
<<~HEAD.freeze
|
44
42
|
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,600,600i" rel="stylesheet">
|
@@ -48,28 +46,34 @@ module IsoDoc
|
|
48
46
|
end
|
49
47
|
|
50
48
|
def toclevel
|
51
|
-
ret = toclevel_classes.map
|
52
|
-
|
49
|
+
ret = toclevel_classes.map do |l|
|
50
|
+
"#{l}:not(:empty):not(.TermNum):not(.noTOC):not(.AbstractTitle):"\
|
51
|
+
"not(.IntroTitle):not(.ForewordTitle)"
|
52
|
+
end
|
53
|
+
<<~HEAD.freeze
|
53
54
|
function toclevel() { return "#{ret.join(',')}";}
|
54
|
-
|
55
|
-
|
55
|
+
HEAD
|
56
|
+
end
|
56
57
|
|
57
58
|
def html_toc(docxml)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
idx = docxml.at("//div[@id = 'toc']") or return docxml
|
60
|
+
toc = "<ul>"
|
61
|
+
path = toclevel_classes.map do |l|
|
62
|
+
"//main//#{l}[not(@class = 'TermNum')][not(@class = 'noTOC')]"\
|
63
|
+
"[text()][not(@class = 'AbstractTitle')]"\
|
64
|
+
"[not(@class = 'IntroTitle')][not(@class = 'ForewordTitle')]"
|
65
|
+
end
|
66
|
+
docxml.xpath(path.join(" | ")).each_with_index do |h, tocidx|
|
67
|
+
h["id"] ||= "toc#{tocidx}"
|
68
|
+
toc += html_toc_entry(h.name, h)
|
69
|
+
end
|
70
|
+
idx.children = "#{toc}</ul>"
|
71
|
+
docxml
|
66
72
|
end
|
67
|
-
idx.children = "#{toc}</ul>"
|
68
|
-
docxml
|
69
|
-
end
|
70
73
|
|
71
74
|
def make_body(xml, docxml)
|
72
|
-
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
75
|
+
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
76
|
+
"xml:lang": "EN-US", class: "container" }
|
73
77
|
xml.body **body_attr do |body|
|
74
78
|
make_body1(body, docxml)
|
75
79
|
make_body2(body, docxml)
|
@@ -77,10 +81,6 @@ module IsoDoc
|
|
77
81
|
end
|
78
82
|
end
|
79
83
|
|
80
|
-
def html_toc(docxml)
|
81
|
-
docxml
|
82
|
-
end
|
83
|
-
|
84
84
|
def authority_cleanup(docxml)
|
85
85
|
dest = docxml.at("//div[@id = 'authority']") || return
|
86
86
|
auth = docxml.at("//div[@class = 'authority']") || return
|
@@ -102,6 +102,7 @@ module IsoDoc
|
|
102
102
|
super
|
103
103
|
term_cleanup(docxml)
|
104
104
|
requirement_cleanup(docxml)
|
105
|
+
docxml
|
105
106
|
end
|
106
107
|
|
107
108
|
def make_body3(body, docxml)
|
@@ -117,56 +118,17 @@ module IsoDoc
|
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
120
|
-
def bibliography(isoxml, out)
|
121
|
-
f = isoxml.at(ns("//bibliography/clause | //bibliography/references")) || return
|
122
|
-
page_break(out)
|
123
|
-
isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
|
124
|
-
out.div do |div|
|
125
|
-
div.h1 **{ class: "Section3" } do |h1|
|
126
|
-
if @bibliographycount == 1 then h1 << "References"
|
127
|
-
else
|
128
|
-
f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
|
129
|
-
end
|
130
|
-
end
|
131
|
-
biblio_list(f, div, false)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
def keywords(_docxml, out)
|
137
|
-
kw = @meta.get[:keywords]
|
138
|
-
kw.empty? and return
|
139
|
-
out.div **{ class: "Section3" } do |div|
|
140
|
-
out.div do |div|
|
141
|
-
clause_name(nil, "Keywords", div, class: "IntroTitle")
|
142
|
-
div.p kw.sort.join("; ")
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
121
|
def termdef_parse(node, out)
|
148
|
-
pref = node.at(ns("./preferred"))
|
149
122
|
out.dl **{ class: "terms_dl" } do |dl|
|
150
123
|
dl.dt do |dt|
|
151
|
-
|
124
|
+
term_and_termref_parse(node, dt)
|
152
125
|
end
|
153
|
-
set_termdomain("")
|
154
126
|
dl.dd do |dd|
|
155
|
-
node
|
127
|
+
term_rest_parse(node, dd)
|
156
128
|
end
|
157
129
|
end
|
158
130
|
end
|
159
131
|
|
160
|
-
def term_cleanup(docxml)
|
161
|
-
docxml.xpath("//table[@class = 'terms_dl']").each do |d|
|
162
|
-
prev = d.previous_element
|
163
|
-
next unless prev and prev.name == "table" and prev["class"] == "terms_dl"
|
164
|
-
d.children.each { |n| prev.add_child(n.remove) }
|
165
|
-
d.remove
|
166
|
-
end
|
167
|
-
docxml
|
168
|
-
end
|
169
|
-
|
170
132
|
include BaseConvert
|
171
133
|
end
|
172
134
|
end
|
data/lib/isodoc/nist/metadata.rb
CHANGED
@@ -116,12 +116,6 @@ module IsoDoc
|
|
116
116
|
Date.parse(isodate).strftime("%m-%d-%Y")
|
117
117
|
end
|
118
118
|
|
119
|
-
def keywords(ixml, _out)
|
120
|
-
keywords = []
|
121
|
-
ixml.xpath(ns("//bibdata/keyword")).each { |kw| keywords << kw.text }
|
122
|
-
set(:keywords, keywords)
|
123
|
-
end
|
124
|
-
|
125
119
|
def commentperiod(ixml, _out)
|
126
120
|
from = ixml.at(ns("//bibdata/ext/commentperiod/from"))&.text
|
127
121
|
to = ixml.at(ns("//bibdata/ext/commentperiod/to"))&.text
|