metanorma-nist 1.0.6 → 1.1.0
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 -0
- data/.github/workflows/ubuntu.yml +10 -0
- data/.github/workflows/windows.yml +8 -0
- 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 +19 -48
- data/lib/asciidoctor/nist/front.rb +1 -0
- data/lib/asciidoctor/nist/front_id.rb +73 -23
- data/lib/asciidoctor/nist/isodoc.rng +450 -4
- data/lib/asciidoctor/nist/reqt.rng +23 -0
- data/lib/isodoc/nist/base_convert.rb +66 -62
- 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 +29 -64
- data/lib/isodoc/nist/metadata.rb +0 -12
- data/lib/isodoc/nist/nist.cswp.xsl +192 -60
- data/lib/isodoc/nist/nist.sp.xsl +193 -61
- 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 +47 -3
- data/lib/isodoc/nist/section.rb +55 -0
- data/lib/isodoc/nist/word_convert.rb +2 -42
- data/lib/isodoc/nist/{xrefs.rb → xref.rb} +2 -23
- data/lib/metanorma-nist.rb +2 -0
- data/lib/metanorma/nist/processor.rb +13 -4
- 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
|
@@ -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
|
+
"[not(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)
|
@@ -117,56 +121,17 @@ module IsoDoc
|
|
117
121
|
end
|
118
122
|
end
|
119
123
|
|
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
124
|
def termdef_parse(node, out)
|
148
|
-
pref = node.at(ns("./preferred"))
|
149
125
|
out.dl **{ class: "terms_dl" } do |dl|
|
150
126
|
dl.dt do |dt|
|
151
|
-
|
127
|
+
term_and_termref_parse(node, dt)
|
152
128
|
end
|
153
|
-
set_termdomain("")
|
154
129
|
dl.dd do |dd|
|
155
|
-
node
|
130
|
+
term_rest_parse(node, dd)
|
156
131
|
end
|
157
132
|
end
|
158
133
|
end
|
159
134
|
|
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
135
|
include BaseConvert
|
171
136
|
end
|
172
137
|
end
|
data/lib/isodoc/nist/metadata.rb
CHANGED
@@ -116,18 +116,6 @@ module IsoDoc
|
|
116
116
|
Date.parse(isodate).strftime("%m-%d-%Y")
|
117
117
|
end
|
118
118
|
|
119
|
-
def MMMddyyyy(isodate)
|
120
|
-
return nil if isodate.nil?
|
121
|
-
isodate += "-01" if /^\d\d\d\d-\d\d$/.match(isodate)
|
122
|
-
Date.parse(isodate).strftime("%B %d, %Y")
|
123
|
-
end
|
124
|
-
|
125
|
-
def keywords(ixml, _out)
|
126
|
-
keywords = []
|
127
|
-
ixml.xpath(ns("//bibdata/keyword")).each { |kw| keywords << kw.text }
|
128
|
-
set(:keywords, keywords)
|
129
|
-
end
|
130
|
-
|
131
119
|
def commentperiod(ixml, _out)
|
132
120
|
from = ixml.at(ns("//bibdata/ext/commentperiod/from"))&.text
|
133
121
|
to = ixml.at(ns("//bibdata/ext/commentperiod/to"))&.text
|
@@ -1391,19 +1391,21 @@
|
|
1391
1391
|
<xsl:attribute name="text-decoration">underline</xsl:attribute>
|
1392
1392
|
</xsl:if>
|
1393
1393
|
<!-- <xsl:text>[</xsl:text> --><xsl:value-of select="@citeas" disable-output-escaping="yes"/><!-- <xsl:text>]</xsl:text> -->
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
<xsl:when test="nist:locality/@type = 'section'">Section </xsl:when>
|
1398
|
-
<xsl:when test="nist:locality/@type = 'clause'">Clause </xsl:when>
|
1399
|
-
<xsl:otherwise/>
|
1400
|
-
</xsl:choose>
|
1401
|
-
<xsl:apply-templates select="nist:locality"/>
|
1402
|
-
</xsl:if>
|
1394
|
+
|
1395
|
+
<xsl:apply-templates select="nist:localityStack"/>
|
1396
|
+
|
1403
1397
|
</fo:basic-link>
|
1404
1398
|
<!-- </fo:inline> -->
|
1405
1399
|
</xsl:template>
|
1406
1400
|
|
1401
|
+
<xsl:template match="nist:locality">
|
1402
|
+
<xsl:choose>
|
1403
|
+
<xsl:when test="@type = 'section'">Section </xsl:when>
|
1404
|
+
<xsl:when test="@type = 'clause'">Clause </xsl:when>
|
1405
|
+
<xsl:otherwise/>
|
1406
|
+
</xsl:choose>
|
1407
|
+
<xsl:text> </xsl:text><xsl:value-of select="nist:referenceFrom"/>
|
1408
|
+
</xsl:template>
|
1407
1409
|
|
1408
1410
|
<xsl:template match="nist:terms[nist:term[nist:preferred and nist:definition]]">
|
1409
1411
|
<fo:block id="{@id}">
|
@@ -2731,11 +2733,14 @@
|
|
2731
2733
|
<xsl:value-of select="$section"/>
|
2732
2734
|
</xsl:template>
|
2733
2735
|
|
2734
|
-
<xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'
'"/><xsl:
|
2736
|
+
<xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'
'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
|
2737
|
+
|
2738
|
+
|
2739
|
+
</xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
|
2735
2740
|
<xsl:value-of select="."/>
|
2736
2741
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
|
2737
2742
|
<xsl:value-of select="$linebreak"/>
|
2738
|
-
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="1">
|
2743
|
+
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
|
2739
2744
|
<xsl:call-template name="add-zero-spaces"/>
|
2740
2745
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
|
2741
2746
|
|
@@ -2751,6 +2756,9 @@
|
|
2751
2756
|
|
2752
2757
|
<!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
|
2753
2758
|
|
2759
|
+
<!-- <xsl:if test="$namespace = 'iso'">
|
2760
|
+
<fo:block space-before="6pt"> </fo:block>
|
2761
|
+
</xsl:if> -->
|
2754
2762
|
|
2755
2763
|
<xsl:choose>
|
2756
2764
|
<xsl:when test="@unnumbered = 'true'"/>
|
@@ -2760,12 +2768,15 @@
|
|
2760
2768
|
|
2761
2769
|
<fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
|
2762
2770
|
|
2771
|
+
|
2772
|
+
|
2763
2773
|
<xsl:attribute name="font-family">Arial</xsl:attribute>
|
2764
2774
|
<xsl:attribute name="font-size">9pt</xsl:attribute>
|
2765
2775
|
|
2766
2776
|
|
2767
2777
|
|
2768
2778
|
|
2779
|
+
|
2769
2780
|
<xsl:text>Table </xsl:text>
|
2770
2781
|
<xsl:choose>
|
2771
2782
|
<xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
|
@@ -2775,6 +2786,8 @@
|
|
2775
2786
|
|
2776
2787
|
|
2777
2788
|
|
2789
|
+
|
2790
|
+
|
2778
2791
|
<xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
|
2779
2792
|
<xsl:number format="A-" count="*[local-name()='annex']"/>
|
2780
2793
|
<xsl:number format="1" level="any" count="*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'][ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
|
@@ -2784,10 +2797,11 @@
|
|
2784
2797
|
|
2785
2798
|
</xsl:when>
|
2786
2799
|
<xsl:otherwise>
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2800
|
+
|
2801
|
+
|
2802
|
+
<xsl:number format="A." count="*[local-name()='annex']"/>
|
2803
|
+
<xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
|
2804
|
+
|
2791
2805
|
</xsl:otherwise>
|
2792
2806
|
</xsl:choose>
|
2793
2807
|
<xsl:if test="*[local-name()='name']">
|
@@ -2832,11 +2846,11 @@
|
|
2832
2846
|
</xsl:call-template>
|
2833
2847
|
</xsl:variable>
|
2834
2848
|
|
2835
|
-
<xsl:variable name="colwidths2">
|
2849
|
+
<!-- <xsl:variable name="colwidths2">
|
2836
2850
|
<xsl:call-template name="calculate-column-widths">
|
2837
2851
|
<xsl:with-param name="cols-count" select="$cols-count"/>
|
2838
2852
|
</xsl:call-template>
|
2839
|
-
</xsl:variable>
|
2853
|
+
</xsl:variable> -->
|
2840
2854
|
|
2841
2855
|
<!-- cols-count=<xsl:copy-of select="$cols-count"/>
|
2842
2856
|
colwidthsNew=<xsl:copy-of select="$colwidths"/>
|
@@ -2857,7 +2871,11 @@
|
|
2857
2871
|
|
2858
2872
|
|
2859
2873
|
|
2860
|
-
|
2874
|
+
|
2875
|
+
|
2876
|
+
<fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
|
2877
|
+
|
2878
|
+
|
2861
2879
|
|
2862
2880
|
|
2863
2881
|
|
@@ -2888,6 +2906,9 @@
|
|
2888
2906
|
</xsl:for-each>
|
2889
2907
|
<xsl:apply-templates/>
|
2890
2908
|
</fo:table>
|
2909
|
+
|
2910
|
+
|
2911
|
+
|
2891
2912
|
</fo:block-container>
|
2892
2913
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
|
2893
2914
|
<xsl:apply-templates/>
|
@@ -2941,9 +2962,13 @@
|
|
2941
2962
|
</xsl:when>
|
2942
2963
|
<xsl:otherwise>
|
2943
2964
|
<xsl:for-each select="xalan:nodeset($table)//tr">
|
2965
|
+
<xsl:variable name="td_text">
|
2966
|
+
<xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
|
2967
|
+
</xsl:variable>
|
2944
2968
|
<xsl:variable name="words">
|
2945
2969
|
<xsl:call-template name="tokenize">
|
2946
|
-
<xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/>
|
2970
|
+
<!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
|
2971
|
+
<xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
|
2947
2972
|
</xsl:call-template>
|
2948
2973
|
</xsl:variable>
|
2949
2974
|
<xsl:variable name="max_length">
|
@@ -2984,51 +3009,82 @@
|
|
2984
3009
|
<xsl:with-param name="table" select="$table"/>
|
2985
3010
|
</xsl:call-template>
|
2986
3011
|
</xsl:if>
|
3012
|
+
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
|
3013
|
+
<xsl:variable name="zero-space"></xsl:variable>
|
3014
|
+
<xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
|
2987
3015
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
|
2988
|
-
<!--
|
2989
|
-
|
2990
|
-
|
2991
|
-
|
3016
|
+
<!-- font-weight="bold" -->
|
3017
|
+
<fo:table-header>
|
3018
|
+
<xsl:apply-templates/>
|
3019
|
+
</fo:table-header>
|
2992
3020
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
|
2993
3021
|
<xsl:apply-templates/>
|
3022
|
+
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
|
3023
|
+
<xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
|
3024
|
+
<xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
|
3025
|
+
|
3026
|
+
<fo:table-footer>
|
3027
|
+
|
3028
|
+
<xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
|
3029
|
+
|
3030
|
+
<!-- if there are note(s) or fn(s) then create footer row -->
|
3031
|
+
<xsl:if test="$isNoteOrFnExist = 'true'">
|
3032
|
+
|
3033
|
+
<xsl:variable name="cols-count">
|
3034
|
+
<xsl:choose>
|
3035
|
+
<xsl:when test="../*[local-name()='thead']">
|
3036
|
+
<!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
|
3037
|
+
<xsl:call-template name="calculate-columns-numbers">
|
3038
|
+
<xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
|
3039
|
+
</xsl:call-template>
|
3040
|
+
</xsl:when>
|
3041
|
+
<xsl:otherwise>
|
3042
|
+
<!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
|
3043
|
+
<xsl:call-template name="calculate-columns-numbers">
|
3044
|
+
<xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
|
3045
|
+
</xsl:call-template>
|
3046
|
+
</xsl:otherwise>
|
3047
|
+
</xsl:choose>
|
3048
|
+
</xsl:variable>
|
3049
|
+
|
3050
|
+
<fo:table-row>
|
3051
|
+
<fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
|
3052
|
+
|
3053
|
+
|
3054
|
+
|
3055
|
+
<!-- fn will be processed inside 'note' processing -->
|
3056
|
+
|
3057
|
+
|
3058
|
+
<!-- except gb -->
|
3059
|
+
|
3060
|
+
<xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
|
3061
|
+
|
3062
|
+
|
3063
|
+
<!-- horizontal row separator -->
|
3064
|
+
|
3065
|
+
|
3066
|
+
<!-- fn processing -->
|
3067
|
+
<xsl:call-template name="fn_display"/>
|
3068
|
+
|
3069
|
+
</fo:table-cell>
|
3070
|
+
</fo:table-row>
|
3071
|
+
|
3072
|
+
</xsl:if>
|
3073
|
+
</fo:table-footer>
|
3074
|
+
|
3075
|
+
</xsl:if>
|
2994
3076
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
<xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
|
3001
|
-
</xsl:call-template>
|
3002
|
-
</xsl:when>
|
3003
|
-
<xsl:otherwise>
|
3004
|
-
<!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
|
3005
|
-
<xsl:call-template name="calculate-columns-numbers">
|
3006
|
-
<xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
|
3007
|
-
</xsl:call-template>
|
3008
|
-
</xsl:otherwise>
|
3009
|
-
</xsl:choose>
|
3010
|
-
</xsl:variable>
|
3011
|
-
|
3077
|
+
|
3078
|
+
<xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
|
3079
|
+
|
3080
|
+
<xsl:call-template name="insertTableFooter"/>
|
3081
|
+
|
3012
3082
|
<fo:table-body>
|
3013
|
-
<xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
|
3014
3083
|
<xsl:apply-templates/>
|
3015
|
-
<xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
|
3016
|
-
|
3017
|
-
<xsl:if test="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']">
|
3018
|
-
<fo:table-row>
|
3019
|
-
<fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
|
3020
|
-
|
3021
|
-
|
3022
|
-
<!-- fn will be processed inside 'note' processing -->
|
3023
|
-
<xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
|
3024
|
-
<!-- fn processing -->
|
3025
|
-
<xsl:call-template name="fn_display"/>
|
3026
|
-
|
3027
|
-
</fo:table-cell>
|
3028
|
-
</fo:table-row>
|
3029
|
-
|
3030
|
-
</xsl:if>
|
3084
|
+
<!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
|
3085
|
+
|
3031
3086
|
</fo:table-body>
|
3087
|
+
|
3032
3088
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
|
3033
3089
|
<xsl:variable name="parent-name" select="local-name(..)"/>
|
3034
3090
|
<!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
|
@@ -3042,11 +3098,14 @@
|
|
3042
3098
|
|
3043
3099
|
|
3044
3100
|
|
3101
|
+
|
3045
3102
|
</xsl:if>
|
3046
3103
|
<xsl:if test="$parent-name = 'tfoot'">
|
3047
3104
|
|
3105
|
+
|
3048
3106
|
</xsl:if>
|
3049
3107
|
|
3108
|
+
|
3050
3109
|
<xsl:apply-templates/>
|
3051
3110
|
</fo:table-row>
|
3052
3111
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
|
@@ -3054,6 +3113,7 @@
|
|
3054
3113
|
|
3055
3114
|
|
3056
3115
|
|
3116
|
+
|
3057
3117
|
<xsl:attribute name="text-align">center</xsl:attribute>
|
3058
3118
|
<xsl:attribute name="background-color">black</xsl:attribute>
|
3059
3119
|
<xsl:attribute name="color">white</xsl:attribute>
|
@@ -3083,6 +3143,9 @@
|
|
3083
3143
|
|
3084
3144
|
|
3085
3145
|
|
3146
|
+
|
3147
|
+
|
3148
|
+
|
3086
3149
|
<xsl:if test="ancestor::*[local-name()='thead']">
|
3087
3150
|
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
3088
3151
|
</xsl:if>
|
@@ -3118,10 +3181,14 @@
|
|
3118
3181
|
|
3119
3182
|
<fo:block font-size="10pt" margin-bottom="12pt">
|
3120
3183
|
|
3184
|
+
|
3185
|
+
|
3121
3186
|
<fo:inline padding-right="2mm">
|
3187
|
+
|
3122
3188
|
<xsl:text>NOTE </xsl:text>
|
3123
3189
|
|
3124
3190
|
|
3191
|
+
|
3125
3192
|
<xsl:number format="1 "/>
|
3126
3193
|
|
3127
3194
|
</fo:inline>
|
@@ -3145,6 +3212,8 @@
|
|
3145
3212
|
<xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
|
3146
3213
|
<fo:block margin-bottom="12pt">
|
3147
3214
|
|
3215
|
+
|
3216
|
+
|
3148
3217
|
<fo:inline font-size="80%" padding-right="5mm" id="{@id}">
|
3149
3218
|
|
3150
3219
|
<xsl:attribute name="vertical-align">super</xsl:attribute>
|
@@ -3152,6 +3221,8 @@
|
|
3152
3221
|
|
3153
3222
|
|
3154
3223
|
|
3224
|
+
|
3225
|
+
|
3155
3226
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
3156
3227
|
|
3157
3228
|
<xsl:value-of select="@reference"/>
|
@@ -3198,6 +3269,7 @@
|
|
3198
3269
|
<fo:table width="95%" table-layout="fixed">
|
3199
3270
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3200
3271
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
3272
|
+
|
3201
3273
|
</xsl:if>
|
3202
3274
|
<fo:table-column column-width="15%"/>
|
3203
3275
|
<fo:table-column column-width="85%"/>
|
@@ -3237,6 +3309,7 @@
|
|
3237
3309
|
<fo:inline font-size="80%" keep-with-previous.within-line="always">
|
3238
3310
|
|
3239
3311
|
|
3312
|
+
|
3240
3313
|
<xsl:attribute name="vertical-align">super</xsl:attribute>
|
3241
3314
|
<xsl:attribute name="color">blue</xsl:attribute>
|
3242
3315
|
|
@@ -3264,7 +3337,7 @@
|
|
3264
3337
|
|
3265
3338
|
|
3266
3339
|
<fo:block margin-bottom="12pt" text-align="left">
|
3267
|
-
|
3340
|
+
|
3268
3341
|
<xsl:text>where </xsl:text>
|
3269
3342
|
<xsl:apply-templates select="*[local-name()='dt']/*"/>
|
3270
3343
|
<xsl:text/>
|
@@ -3277,12 +3350,15 @@
|
|
3277
3350
|
|
3278
3351
|
|
3279
3352
|
|
3353
|
+
|
3280
3354
|
<xsl:text>where</xsl:text>
|
3281
3355
|
</fo:block>
|
3282
3356
|
</xsl:when>
|
3283
3357
|
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
|
3284
3358
|
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
|
3285
3359
|
|
3360
|
+
|
3361
|
+
|
3286
3362
|
<xsl:text>Key</xsl:text>
|
3287
3363
|
</fo:block>
|
3288
3364
|
</xsl:when>
|
@@ -3298,13 +3374,13 @@
|
|
3298
3374
|
<xsl:attribute name="margin-left">5mm</xsl:attribute>
|
3299
3375
|
</xsl:if>
|
3300
3376
|
|
3301
|
-
|
3302
3377
|
<fo:block>
|
3303
3378
|
|
3304
3379
|
<xsl:if test="not(.//*[local-name()='dt']//*[local-name()='stem'])">
|
3305
3380
|
<xsl:attribute name="margin-left">-2.5mm</xsl:attribute>
|
3306
3381
|
</xsl:if>
|
3307
3382
|
|
3383
|
+
|
3308
3384
|
<!-- create virtual html table for dl/[dt and dd] -->
|
3309
3385
|
<xsl:variable name="html-table">
|
3310
3386
|
<xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
|
@@ -3324,12 +3400,14 @@
|
|
3324
3400
|
<!-- colwidths=<xsl:value-of select="$colwidths"/> -->
|
3325
3401
|
|
3326
3402
|
<fo:table width="95%" table-layout="fixed">
|
3403
|
+
|
3327
3404
|
<xsl:choose>
|
3328
3405
|
<xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
|
3329
3406
|
<!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
|
3330
3407
|
</xsl:when>
|
3331
3408
|
<xsl:when test="normalize-space($key_iso) = 'true'">
|
3332
3409
|
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
3410
|
+
|
3333
3411
|
</xsl:when>
|
3334
3412
|
</xsl:choose>
|
3335
3413
|
<xsl:choose>
|
@@ -3434,6 +3512,8 @@
|
|
3434
3512
|
<fo:table-row>
|
3435
3513
|
<fo:table-cell>
|
3436
3514
|
<fo:block margin-top="6pt">
|
3515
|
+
|
3516
|
+
|
3437
3517
|
<xsl:if test="normalize-space($key_iso) = 'true'">
|
3438
3518
|
<xsl:attribute name="margin-top">0</xsl:attribute>
|
3439
3519
|
|
@@ -3444,6 +3524,7 @@
|
|
3444
3524
|
|
3445
3525
|
|
3446
3526
|
<xsl:apply-templates/>
|
3527
|
+
|
3447
3528
|
</fo:block>
|
3448
3529
|
</fo:table-cell>
|
3449
3530
|
<fo:table-cell>
|
@@ -3482,7 +3563,7 @@
|
|
3482
3563
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
|
3483
3564
|
<xsl:apply-templates/>
|
3484
3565
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
|
3485
|
-
<fo:inline><xsl:apply-templates/></fo:inline>
|
3566
|
+
<fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
|
3486
3567
|
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
|
3487
3568
|
<fo:inline font-style="italic">
|
3488
3569
|
<xsl:apply-templates/>
|
@@ -3597,6 +3678,7 @@
|
|
3597
3678
|
<xsl:variable name="zero-space-after-dot">.</xsl:variable>
|
3598
3679
|
<xsl:variable name="zero-space-after-colon">:</xsl:variable>
|
3599
3680
|
<xsl:variable name="zero-space-after-equal">=</xsl:variable>
|
3681
|
+
<xsl:variable name="zero-space-after-underscore">_</xsl:variable>
|
3600
3682
|
<xsl:variable name="zero-space"></xsl:variable>
|
3601
3683
|
<xsl:choose>
|
3602
3684
|
<xsl:when test="contains($text, $zero-space-after-chars)">
|
@@ -3631,6 +3713,14 @@
|
|
3631
3713
|
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
|
3632
3714
|
</xsl:call-template>
|
3633
3715
|
</xsl:when>
|
3716
|
+
<xsl:when test="contains($text, $zero-space-after-underscore)">
|
3717
|
+
<xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
|
3718
|
+
<xsl:value-of select="$zero-space-after-underscore"/>
|
3719
|
+
<xsl:value-of select="$zero-space"/>
|
3720
|
+
<xsl:call-template name="add-zero-spaces">
|
3721
|
+
<xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
|
3722
|
+
</xsl:call-template>
|
3723
|
+
</xsl:when>
|
3634
3724
|
<xsl:otherwise>
|
3635
3725
|
<xsl:value-of select="$text"/>
|
3636
3726
|
</xsl:otherwise>
|
@@ -3801,4 +3891,46 @@
|
|
3801
3891
|
<xsl:value-of select="substring($str2, 2)"/>
|
3802
3892
|
</xsl:otherwise>
|
3803
3893
|
</xsl:choose>
|
3894
|
+
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
|
3895
|
+
<fo:inline font-family="STIX2Math">
|
3896
|
+
<fo:instream-foreign-object fox:alt-text="Math">
|
3897
|
+
<xsl:copy-of select="."/>
|
3898
|
+
</fo:instream-foreign-object>
|
3899
|
+
</fo:inline>
|
3900
|
+
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
|
3901
|
+
<xsl:for-each select="*[local-name()='locality']">
|
3902
|
+
<xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
|
3903
|
+
<xsl:apply-templates select="."/>
|
3904
|
+
<xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
|
3905
|
+
</xsl:for-each>
|
3906
|
+
</xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
|
3907
|
+
<xsl:variable name="target">
|
3908
|
+
<xsl:choose>
|
3909
|
+
<xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
|
3910
|
+
<xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
|
3911
|
+
</xsl:when>
|
3912
|
+
<xsl:otherwise>
|
3913
|
+
<xsl:value-of select="normalize-space(@target)"/>
|
3914
|
+
</xsl:otherwise>
|
3915
|
+
</xsl:choose>
|
3916
|
+
</xsl:variable>
|
3917
|
+
<fo:inline xsl:use-attribute-sets="link-style">
|
3918
|
+
<xsl:choose>
|
3919
|
+
<xsl:when test="$target = ''">
|
3920
|
+
<xsl:apply-templates/>
|
3921
|
+
</xsl:when>
|
3922
|
+
<xsl:otherwise>
|
3923
|
+
<fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
|
3924
|
+
<xsl:choose>
|
3925
|
+
<xsl:when test="normalize-space(.) = ''">
|
3926
|
+
<xsl:value-of select="$target"/>
|
3927
|
+
</xsl:when>
|
3928
|
+
<xsl:otherwise>
|
3929
|
+
<xsl:apply-templates/>
|
3930
|
+
</xsl:otherwise>
|
3931
|
+
</xsl:choose>
|
3932
|
+
</fo:basic-link>
|
3933
|
+
</xsl:otherwise>
|
3934
|
+
</xsl:choose>
|
3935
|
+
</fo:inline>
|
3804
3936
|
</xsl:template></xsl:stylesheet>
|