metanorma-iso 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f72b79497b89e3f1b8f3447a5550c2e1eba7d9460c2bfc98cdb916f7eefb8778
4
- data.tar.gz: 27bc402ce1e51f5a78b0d4a98870dd186c2e3bc850e2b6e46561898e4721ab4e
3
+ metadata.gz: 8dc143503bcfc2ff91eb0c405c76219646009e57557038f35cc2e0ed1ff72a91
4
+ data.tar.gz: 93f9648e76ad5d099cd967d726000d8ebbc06821a0c2d9f807274eaa3a10e071
5
5
  SHA512:
6
- metadata.gz: 950f85f08d92d4892a0dbadfb97357196396eb071deb0f638d9574c0f0b2448c8df5029a56e9f98d657c928edae7e697191afec3491f5a67148944d3517d0b43
7
- data.tar.gz: aabb12664fe0572859837e3efb1bc91b9d32e2b298515a06a04755bdea010fb5dfd3d88df29de9e2cdfe2a34452537f6f73a556abcf973a0652d7bdcdaad1c51
6
+ metadata.gz: 8f09feffde8baad445d16fea77828d154515cedd1b79f8692711092292875e55d423668a9429c3a708ede2c12a467e1ea8d3c255a38e035fa85678265498022d
7
+ data.tar.gz: f383f811b962a3fcbf517fff73bc7322fab6718f8925aef237b40c917c71d565fd3db0f4f82a52f41cdfada039c106069970f50b80688aa01961152d66fffb8e
@@ -34,7 +34,7 @@
34
34
  </data>
35
35
  </define>
36
36
  <start>
37
- <ref name="relaton_collection"/>
37
+ <ref name="bibitem"/>
38
38
  </start>
39
39
  <define name="status">
40
40
  <element name="status">
@@ -58,6 +58,8 @@ module Asciidoctor
58
58
  end
59
59
 
60
60
  PUBLISHER = "./contributor[role/@type = 'publisher']/organization".freeze
61
+ OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or "\
62
+ "@type = 'ISBN'".freeze
61
63
 
62
64
  def pub_class(bib)
63
65
  return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
@@ -66,8 +68,7 @@ module Asciidoctor
66
68
  return 2 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
67
69
  return 2 if bib.at("#{PUBLISHER}[name = 'International "\
68
70
  "Electrotechnical Commission']")
69
- return 3 if bib.at("./docidentifier[@type][not(@type = 'DOI' or "\
70
- "@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
71
+ return 3 if bib.at("./docidentifier[@type][not(#{OTHERIDS})]")
71
72
  4
72
73
  end
73
74
 
@@ -87,14 +88,40 @@ module Asciidoctor
87
88
  def sort_biblio_key(bib)
88
89
  pubclass = pub_class(bib)
89
90
  num = bib&.at("./docnumber")&.text
90
- id = bib&.at("./docidentifier[not(@type = 'DOI' or "\
91
- "@type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
91
+ id = bib&.at("./docidentifier[not(#{OTHERIDS})]")
92
92
  metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
93
93
  abbrid = metaid unless /^\[\d+\]$/.match(metaid)
94
94
  type = id['type'] if id
95
95
  title = bib&.at("./title[@type = 'main']")&.text ||
96
96
  bib&.at("./title")&.text || bib&.at("./formattedref")&.text
97
- "#{pubclass} :: #{type} :: #{num.nil? ? abbrid : sprintf("%09d", num.to_i)} :: #{id&.text} :: #{title}"
97
+ "#{pubclass} :: #{type} :: "\
98
+ "#{num.nil? ? abbrid : sprintf("%09d", num.to_i)} :: "\
99
+ "#{id&.text} :: #{title}"
100
+ end
101
+
102
+ def boilerplate_cleanup(xmldoc)
103
+ super
104
+ initial_boilerplace(xmldoc)
105
+ end
106
+
107
+ def initial_boilerplace(x)
108
+ return if x.at("//boilerplate")
109
+ preface = x.at("//preface") || x.at("//sections") || x.at("//annex") ||
110
+ x.at("//references") || return
111
+ preface.previous = boilerplate(x)
112
+ end
113
+
114
+ def boilerplate(x_orig)
115
+ x = x_orig.dup
116
+ # TODO variable
117
+ x.root.add_namespace(nil, "http://riboseinc.com/isoxml")
118
+ x = Nokogiri::XML(x.to_xml)
119
+ conv = IsoDoc::Iso::HtmlConvert.new({})
120
+ conv.metadata_init("en", "Latn", {})
121
+ conv.info(x, nil)
122
+ file = @boilerplateauthority ? "#{@localdir}/#{@boilerplateauthority}" :
123
+ File.join(File.dirname(__FILE__), "iso_intro.xml")
124
+ conv.populate_template((File.read(file, encoding: "UTF-8")), nil)
98
125
  end
99
126
  end
100
127
  end
@@ -0,0 +1,46 @@
1
+ <boilerplate>
2
+ <copyright-statement>
3
+ <clause>
4
+ <p id="authority1">
5
+ &copy; {{ agency }} {{ docyear }}, Published in Switzerland
6
+ </p>
7
+
8
+ <p id="authority2">
9
+ All rights
10
+ reserved. Unless otherwise specified, no part of this publication may be
11
+ reproduced or utilized otherwise in any form or by any means, electronic or
12
+ mechanical, including photocopying, or posting on the internet or an intranet,
13
+ without prior written permission. Permission can be requested from either ISO
14
+ at the address below or ISO's member body in the country of the requester.
15
+ </p>
16
+
17
+ <p id="authority3" align="left">
18
+ ISO copyright office<br/>
19
+ Ch. de Blandonnet 8 &#x2022; CP 401<br/>
20
+ CH-1214 Vernier, Geneva, Switzerland<br/>
21
+ Tel.&nbsp;&nbsp;+ 41 22 749 01 11<br/>
22
+ Fax&nbsp;&nbsp;+ 41 22 749 09 47<br/>
23
+ copyright@iso.org<br/>
24
+ www.iso.org
25
+ </p>
26
+ </clause>
27
+ </copyright-statement>
28
+
29
+ {% if unpublished %}
30
+ <license-statement>
31
+ <clause>
32
+ <title>Warning for WDs and CDs</title>
33
+
34
+ <p>This
35
+ document is not an ISO International Standard. It is distributed for review and
36
+ comment. It is subject to change without notice and may not be referred to as
37
+ an International Standard.</p>
38
+
39
+ <p>Recipients
40
+ of this draft are invited to submit, with their comments, notification of any
41
+ relevant patent rights of which they are aware and to provide supporting
42
+ documentation.</p>
43
+ </clause>
44
+ </license-statement>
45
+ {% endif %}
46
+ </boilerplate>
@@ -164,8 +164,8 @@ module Asciidoctor
164
164
  end
165
165
 
166
166
  ASSETS_TO_STYLE =
167
- "//termsource | //formula | //termnote | //p | //li[not(p)] | "\
168
- "//dt | //dd[not(p)] | //td[not(p)] | //th[not(p)]".freeze
167
+ "//termsource | //formula | //termnote | //p[not(ancestor::boilerplate)] | "\
168
+ "//li[not(p)] | //dt | //dd[not(p)] | //td[not(p)] | //th[not(p)]".freeze
169
169
 
170
170
  NORM_BIBITEMS =
171
171
  "//references[title = 'Normative References']/bibitem".freeze
@@ -58,6 +58,14 @@ module IsoDoc
58
58
  def error_parse(node, out)
59
59
  case node.name
60
60
  when "appendix" then clause_parse(node, out)
61
+ when "copyright-statement"
62
+ out.div **{class: "copyright"} do |div|
63
+ node.children.each { |n| parse(n, div) }
64
+ end
65
+ when "license-statement"
66
+ out.div **{class: "license"} do |div|
67
+ node.children.each { |n| parse(n, out) }
68
+ end
61
69
  else
62
70
  super
63
71
  end
@@ -125,15 +133,15 @@ module IsoDoc
125
133
  end
126
134
 
127
135
  def example_span_label(node, div, name)
128
- n = get_anchors[node["id"]]
129
- div.span **{ class: "example_label" } do |p|
130
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
131
- l10n("#{@example_lbl} #{n[:label]}")
132
- p << lbl
133
- name and !lbl.nil? and p << "&nbsp;&mdash; "
134
- name and name.children.each { |n| parse(n, div) }
136
+ n = get_anchors[node["id"]]
137
+ div.span **{ class: "example_label" } do |p|
138
+ lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
139
+ l10n("#{@example_lbl} #{n[:label]}")
140
+ p << lbl
141
+ name and !lbl.nil? and p << "&nbsp;&mdash; "
142
+ name and name.children.each { |n| parse(n, div) }
143
+ end
135
144
  end
136
- end
137
145
 
138
146
  def example_p_parse(node, div)
139
147
  name = node&.at(ns("./name"))&.remove
@@ -189,6 +197,21 @@ module IsoDoc
189
197
  def clausedelim
190
198
  ""
191
199
  end
200
+
201
+ def boilerplate(node, out)
202
+ boilerplate = node.at(ns("//boilerplate")) or return
203
+ out.div **{class: "authority"} do |s|
204
+ boilerplate.children.each do |n|
205
+ if n.name == "title"
206
+ s.h1 do |h|
207
+ n.children.each { |nn| parse(nn, h) }
208
+ end
209
+ else
210
+ parse(n, s)
211
+ end
212
+ end
213
+ end
214
+ end
192
215
  end
193
216
  end
194
217
  end
@@ -1,30 +1,4 @@
1
- <div class="copyright">
2
- <p class="year">
3
- &copy; {{ agency }} {{ docyear }}, Published in Switzerland
4
- </p>
5
-
6
- <p class="message">
7
- All rights
8
- reserved. Unless otherwise specified, no part of this publication may be
9
- reproduced or utilized otherwise in any form or by any means, electronic or
10
- mechanical, including photocopying, or posting on the internet or an intranet,
11
- without prior written permission. Permission can be requested from either ISO
12
- at the address below or ISO’s member body in the country of the requester.
13
- </p>
14
-
15
- <p class="name">ISO copyright office</p>
16
- <p class="address">
17
- Ch. de Blandonnet 8 &#x2022; CP 401<br/>
18
- CH-1214 Vernier, Geneva, Switzerland<br/>
19
- Tel.&nbsp;&nbsp;+ 41 22 749 01 11<br/>
20
- Fax&nbsp;&nbsp;+ 41 22 749 09 47<br/>
21
- copyright@iso.org<br/>
22
- www.iso.org
23
- </p>
24
- </div>
25
-
26
-
27
- </div>
1
+ <div id="copyright"/>
28
2
 
29
3
  <nav>
30
4
 
@@ -44,7 +44,8 @@ name="CVP_Secretariat_Loca">Secretariat</a>: {{ secretariat }}</p>
44
44
 
45
45
  {% if unpublished %}
46
46
  <div class="coverpage_warning">
47
-
47
+ <div id="license"/>
48
+ <!--
48
49
  <p>Warning for WDs
49
50
  and CDs</p>
50
51
 
@@ -57,6 +58,6 @@ an International Standard.</p>
57
58
  of this draft are invited to submit, with their comments, notification of any
58
59
  relevant patent rights of which they are aware and to provide supporting
59
60
  documentation.</p>
60
-
61
+ -->
61
62
  </div>
62
63
  {% endif %}
@@ -379,15 +379,12 @@ p.zzCopyright, li.zzCopyright, div.zzCopyright
379
379
  mso-style-unhide:no;
380
380
  mso-style-next:Normal;
381
381
  margin-top:0cm;
382
- margin-right:14.2pt;
383
382
  margin-bottom:12.0pt;
384
- margin-left:14.2pt;
385
383
  text-align:justify;
386
384
  line-height:12.0pt;
387
385
  mso-pagination:widow-orphan;
388
386
  tab-stops:20.15pt 25.7pt 481.15pt;
389
387
  border:none;
390
- mso-border-alt:solid blue .5pt;
391
388
  padding:0cm;
392
389
  mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt;
393
390
  font-size:11.0pt;
@@ -395,6 +392,57 @@ p.zzCopyright, li.zzCopyright, div.zzCopyright
395
392
  mso-fareast-font-family:$bodyfont;
396
393
  mso-bidi-font-family:$bodyfont;
397
394
  mso-ansi-language:EN-GB;}
395
+ p.zzCopyright1
396
+ {mso-style-name:zzCopyright;
397
+ mso-style-noshow:yes;
398
+ mso-style-unhide:no;
399
+ mso-style-next:Normal;
400
+ margin-top:0cm;
401
+ margin-bottom:12.0pt;
402
+ text-align:justify;
403
+ line-height:12.0pt;
404
+ mso-pagination:widow-orphan;
405
+ tab-stops:20.15pt 25.7pt 481.15pt;
406
+ border:none;
407
+ padding:0cm;
408
+ mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt;
409
+ font-size:10.0pt;
410
+ font-family:$bodyfont;
411
+ mso-fareast-font-family:$bodyfont;
412
+ mso-bidi-font-family:$bodyfont;
413
+ mso-ansi-language:EN-GB;}
414
+ p.zzAddress {
415
+ margin:0cm;
416
+ margin-bottom:.0001pt;
417
+ margin-left:20.15pt;
418
+ mso-layout-grid-align:none;
419
+ text-autospace:none;
420
+ padding:0cm;
421
+ mso-padding-alt:0cm 4.0pt 0cm 4.0pt;
422
+ font-size:10.0pt;
423
+ font-family:$bodyfont;
424
+ }
425
+ p.zzWarning {
426
+ border:none;
427
+ mso-border-alt:solid windowtext .5pt;
428
+ padding:0cm;
429
+ mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt;
430
+ font-size:10.0pt;
431
+ mso-bidi-font-weight:bold;
432
+ font-family:$bodyfont;
433
+ }
434
+ p.zzWarningHdr {
435
+ margin-bottom:6.0pt;
436
+ border:none;
437
+ mso-border-alt:solid windowtext .5pt;
438
+ padding:0cm;
439
+ mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt;
440
+ font-size:10.0pt;
441
+ mso-bidi-font-weight:bold;
442
+ font-family:$bodyfont;
443
+ text-align:center;
444
+ font-weight:bold;
445
+ }
398
446
  p.zzSTDTitle, li.zzSTDTitle, div.zzSTDTitle
399
447
  {mso-style-name:zzSTDTitle;
400
448
  mso-style-noshow:yes;
@@ -1,70 +1,8 @@
1
1
  <div style='mso-element:para-border-div;border:solid windowtext 1.0pt;
2
- border-bottom:none;mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:
2
+ border-bottom-alt:solid windowtext .5pt;mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:
3
3
  solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 0cm 4.0pt;
4
4
  margin-left:5.1pt;margin-right:5.1pt'>
5
-
6
- <p class="zzCopyright" align="left" style='margin-top:2.0pt;margin-right:0cm;
7
- margin-bottom:12.0pt;margin-left:0cm;text-align:left;page-break-before:always;
8
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-top-alt:
9
- solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;mso-border-right-alt:
10
- solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 0cm 4.0pt'><span
11
- lang="EN-GB" style='color:windowtext'>© {{ agency }} {{ docyear }}, Published in Switzerland.<o:p></o:p></span></p>
12
-
13
- <p class="zzCopyright" style='margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;
14
- margin-left:0cm;mso-layout-grid-align:none;text-autospace:none;border:none;
15
- mso-border-left-alt:solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;
16
- padding:0cm;mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB"
17
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt;color:windowtext'>All rights
18
- reserved. Unless otherwise specified, no part of this publication may be
19
- reproduced or utilized otherwise in any form or by any means, electronic or
20
- mechanical, including photocopying, or posting on the internet or an intranet,
21
- without prior written permission. Permission can be requested from either ISO
22
- at the address below or ISO’s member body in the country of the requester.<o:p></o:p></span></p>
23
-
24
- <p class="zzCopyright" style='margin:0cm;margin-bottom:.0001pt;text-indent:20.15pt;
25
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-left-alt:
26
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
27
- mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
28
- mso-bidi-font-size:11.0pt;color:windowtext'>ISO copyright office<o:p></o:p></span></p>
29
-
30
- <p class="zzCopyright" style='margin:0cm;margin-bottom:.0001pt;text-indent:20.15pt;
31
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-left-alt:
32
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
33
- mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
34
- mso-bidi-font-size:11.0pt;color:windowtext'>Ch. de Blandonnet 8 &#x2022; CP 401<o:p></o:p></span></p>
35
-
36
- <p class="zzCopyright" style='margin:0cm;margin-bottom:.0001pt;text-indent:20.15pt;
37
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-left-alt:
38
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
39
- mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
40
- mso-bidi-font-size:11.0pt;color:windowtext'>CH-1214 Vernier, Geneva,
41
- Switzerland<o:p></o:p></span></p>
42
-
43
- <p class="zzCopyright" style='margin:0cm;margin-bottom:.0001pt;text-indent:20.15pt;
44
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-left-alt:
45
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
46
- mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
47
- mso-bidi-font-size:11.0pt;color:windowtext'>Tel.&nbsp;&nbsp;+ 41 22 749 01 11<o:p></o:p></span></p>
48
-
49
- <p class="zzCopyright" style='margin:0cm;margin-bottom:.0001pt;text-indent:20.15pt;
50
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-left-alt:
51
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
52
- mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
53
- mso-bidi-font-size:11.0pt;color:windowtext'>Fax&nbsp;&nbsp;+ 41 22 749 09 47<o:p></o:p></span></p>
54
-
55
- <p class="zzCopyright" style='margin:0cm;margin-bottom:.0001pt;text-indent:20.15pt;
56
- mso-layout-grid-align:none;text-autospace:none;border:none;mso-border-left-alt:
57
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
58
- mso-padding-alt:0cm 4.0pt 0cm 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
59
- mso-bidi-font-size:11.0pt;color:windowtext'>copyright@iso.org<o:p></o:p></span></p>
60
-
61
- <p class="zzCopyright" style='margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;
62
- margin-left:0cm;text-indent:20.15pt;mso-layout-grid-align:none;text-autospace:
63
- none;border:none;mso-border-left-alt:solid windowtext .5pt;mso-border-bottom-alt:
64
- solid windowtext .5pt;mso-border-right-alt:solid windowtext .5pt;padding:0cm;
65
- mso-padding-alt:0cm 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;
66
- mso-bidi-font-size:11.0pt;color:windowtext'>www.iso.org<o:p></o:p></span></p>
67
-
5
+ <div id="copyright"/>
68
6
  </div>
69
7
 
70
8
  <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
@@ -60,11 +60,14 @@ lang="EN-GB" style='font-size:40.0pt'>{% if unpublished %}{{ stageabbr }} stage{
60
60
  <p class="MsoNormal" style='margin-bottom:6.0pt'><span lang="EN-GB"><o:p>&nbsp;</o:p></span></p>
61
61
 
62
62
  {% if unpublished %}
63
-
63
+ <!--
64
64
  <div style='mso-element:para-border-div;border:solid windowtext 1.0pt;
65
65
  mso-border-alt:solid windowtext .5pt;padding:1.0pt 4.0pt 1.0pt 4.0pt;
66
66
  margin-left:4.25pt;margin-right:4.25pt'>
67
+ -->
67
68
 
69
+ <div id="license"/>
70
+ <!--
68
71
  <p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
69
72
  border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:
70
73
  1.0pt 4.0pt 1.0pt 4.0pt'><b style='mso-bidi-font-weight:normal'><span
@@ -85,9 +88,9 @@ of this draft are invited to submit, with their comments, notification of any
85
88
  relevant patent rights of which they are aware and to provide supporting
86
89
  documentation.</span><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:
87
90
  11.0pt'><o:p></o:p></span></p>
88
-
91
+ -->
89
92
  {% endif %}
90
93
 
91
- </div>
94
+ <!--</div>-->
92
95
 
93
96
 
@@ -12,18 +12,22 @@ module IsoDoc
12
12
 
13
13
  def default_fonts(options)
14
14
  {
15
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
16
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
17
- monospacefont: (options[:alt] ? '"Space Mono",monospace' : '"Courier New",monospace'),
15
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
16
+ options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
17
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
18
+ options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
19
+ monospacefont: (options[:alt] ? '"Space Mono",monospace' :
20
+ '"Courier New",monospace'),
18
21
  }
19
22
  end
20
23
 
21
24
  def default_file_locations(options)
22
25
  {
23
- htmlstylesheet: options[:alt] ? html_doc_path("style-human.scss") : html_doc_path("style-iso.scss"),
24
- htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
25
- htmlintropage: html_doc_path("html_iso_intro.html"),
26
- scripts: html_doc_path("scripts.html"),
26
+ htmlstylesheet: (options[:alt] ? html_doc_path("style-human.scss") :
27
+ html_doc_path("style-iso.scss")),
28
+ htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
29
+ htmlintropage: html_doc_path("html_iso_intro.html"),
30
+ scripts: html_doc_path("scripts.html"),
27
31
  }
28
32
  end
29
33
 
@@ -36,6 +40,35 @@ module IsoDoc
36
40
  insert
37
41
  end
38
42
 
43
+ def make_body3(body, docxml)
44
+ body.div **{ class: "main-section" } do |div3|
45
+ boilerplate docxml, div3
46
+ abstract docxml, div3
47
+ foreword docxml, div3
48
+ introduction docxml, div3
49
+ middle docxml, div3
50
+ footnotes div3
51
+ comments div3
52
+ end
53
+ end
54
+
55
+ def html_preface(docxml)
56
+ super
57
+ authority_cleanup(docxml)
58
+ docxml
59
+ end
60
+
61
+ def authority_cleanup(docxml)
62
+ dest = docxml.at("//div[@id = 'copyright']")
63
+ auth = docxml.at("//div[@class = 'copyright']")
64
+ auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
65
+ dest and auth and dest.replace(auth.remove)
66
+ dest = docxml.at("//div[@id = 'license']")
67
+ auth = docxml.at("//div[@class = 'license']")
68
+ auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
69
+ dest and auth and dest.replace(auth.remove)
70
+ end
71
+
39
72
  include BaseConvert
40
73
  end
41
74
  end
@@ -12,15 +12,18 @@ module IsoDoc
12
12
 
13
13
  def default_fonts(options)
14
14
  {
15
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Cambria",serif'),
16
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Cambria",serif'),
15
+ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
16
+ '"Cambria",serif'),
17
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
18
+ '"Cambria",serif'),
17
19
  monospacefont: '"Courier New",monospace',
18
20
  }
19
21
  end
20
22
 
21
23
  def default_file_locations(options)
22
24
  {
23
- htmlstylesheet: options[:alt] ? html_doc_path("style-human.scss") : html_doc_path("style-iso.scss"),
25
+ htmlstylesheet: (options[:alt] ? html_doc_path("style-human.scss") :
26
+ html_doc_path("style-iso.scss")),
24
27
  htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
25
28
  htmlintropage: html_doc_path("html_iso_intro.html"),
26
29
  scripts: html_doc_path("scripts.html"),
@@ -44,17 +47,29 @@ module IsoDoc
44
47
  end
45
48
  end
46
49
 
50
+ def make_body2(body, docxml)
51
+ body.div **{ class: "WordSection2" } do |div2|
52
+ boilerplate docxml, div2
53
+ abstract docxml, div2
54
+ foreword docxml, div2
55
+ introduction docxml, div2
56
+ div2.p { |p| p << "&nbsp;" } # placeholder
57
+ end
58
+ section_break(body)
59
+ end
60
+
47
61
  def colophon(body, docxml)
48
62
  stage = @meta.get[:stage_int]
49
63
  return if !stage.nil? && stage < 60
50
- body.br **{ clear: "all", style: "page-break-before:left;mso-break-type:section-break" }
64
+ body.br **{ clear: "all", style: "page-break-before:left;"\
65
+ "mso-break-type:section-break" }
51
66
  body.div **{ class: "colophon" } do |div|
52
67
  end
53
68
  end
54
69
 
55
- def figure_cleanup(docxml)
70
+ def figure_cleanup(xml)
56
71
  super
57
- docxml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
72
+ xml.xpath("//div[@class = 'figure']//table[@class = 'dl']").each do |t|
58
73
  t["class"] = "figdl"
59
74
  d = t.add_previous_sibling("<div class='figdl'/>")
60
75
  t.parent = d.first
@@ -77,6 +92,41 @@ module IsoDoc
77
92
  word_annex_cleanup1(docxml, 6)
78
93
  end
79
94
 
95
+ def authority_hdr_cleanup(docxml)
96
+ docxml&.xpath("//div[@class = 'license']").each do |d|
97
+ d.xpath(".//h1").each do |p|
98
+ p.name = "p"
99
+ p["class"] = "zzWarningHdr"
100
+ end
101
+ end
102
+ docxml&.xpath("//div[@class = 'copyright']").each do |d|
103
+ d.xpath(".//h1").each do |p|
104
+ p.name = "p"
105
+ p["class"] = "zzCopyrightHdr"
106
+ end
107
+ end
108
+ end
109
+
110
+ def authority_cleanup(docxml)
111
+ insert = docxml.at("//div[@id = 'license']")
112
+ auth = docxml&.at("//div[@class = 'license']")&.remove
113
+ auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
114
+ auth and insert.children = auth
115
+ insert = docxml.at("//div[@id = 'copyright']")
116
+ auth = docxml&.at("//div[@class = 'copyright']")&.remove
117
+ auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzCopyright" }
118
+ auth&.xpath(".//p[@id = 'authority2']")&.each { |p| p["class"] = "zzCopyright1" }
119
+ auth&.xpath(".//p[@id = 'authority3']")&.each { |p| p["class"] = "zzAddress" }
120
+ auth and insert.children = auth
121
+ end
122
+
123
+ def word_cleanup(docxml)
124
+ authority_hdr_cleanup(docxml)
125
+ super
126
+ authority_cleanup(docxml)
127
+ docxml
128
+ end
129
+
80
130
  include BaseConvert
81
131
  end
82
132
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.3.8".freeze
3
+ VERSION = "1.3.9".freeze
4
4
  end
5
5
  end
@@ -45,7 +45,7 @@ RSpec.describe Asciidoctor::ISO do
45
45
  end
46
46
 
47
47
  it "processes default metadata" do
48
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
48
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
49
49
  = Document title
50
50
  Author
51
51
  :docfile: test.adoc
@@ -168,7 +168,7 @@ RSpec.describe Asciidoctor::ISO do
168
168
 
169
169
 
170
170
  it "processes complex metadata" do
171
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~'OUTPUT'
171
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to <<~'OUTPUT'
172
172
  = Document title
173
173
  Author
174
174
  :docfile: test.adoc
@@ -280,7 +280,7 @@ RSpec.describe Asciidoctor::ISO do
280
280
  end
281
281
 
282
282
  it "defaults substage" do
283
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
283
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
284
284
  = Document title
285
285
  Author
286
286
  :docfile: test.adoc
@@ -342,7 +342,7 @@ OUTPUT
342
342
  end
343
343
 
344
344
  it "defaults substage for stage 60" do
345
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
345
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
346
346
  = Document title
347
347
  Author
348
348
  :docfile: test.adoc
@@ -404,7 +404,7 @@ OUTPUT
404
404
  end
405
405
 
406
406
  it "populates metadata for PRF" do
407
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
407
+ expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true).sub(%r{<boilerplate>.*</boilerplate>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
408
408
  = Document title
409
409
  Author
410
410
  :docfile: test.adoc
@@ -184,7 +184,7 @@ RSpec.describe IsoDoc do
184
184
  IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
185
185
  <iso-standard xmlns="http://riboseinc.com/isoxml">
186
186
  <sections>
187
- <clause inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
187
+ <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
188
188
 
189
189
  <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
190
190
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
@@ -203,7 +203,7 @@ RSpec.describe IsoDoc do
203
203
  word = File.read("test.doc", encoding: "UTF-8").sub(/^.*An empty word intro page\./m, '').
204
204
  sub(%r{</div>.*$}m, "</div>")
205
205
 
206
- expect(("<div>" + word.gsub(/_Toc\d\d+/, "_Toc") )).to be_equivalent_to xmlpp(<<~'OUTPUT')
206
+ expect(xmlpp("<div>" + word.gsub(/_Toc\d\d+/, "_Toc") )).to be_equivalent_to xmlpp(<<~'OUTPUT')
207
207
  <div>
208
208
  <p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes">&#xA0;</span>TOC
209
209
  \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
@@ -262,7 +262,7 @@ RSpec.describe IsoDoc do
262
262
  IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
263
263
  <iso-standard xmlns="http://riboseinc.com/isoxml">
264
264
  <sections>
265
- <clause inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
265
+ <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
266
266
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
267
267
  </fn><clause id="N" inline-header="false" obligation="normative">
268
268
 
@@ -284,7 +284,7 @@ RSpec.describe IsoDoc do
284
284
  expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
285
285
  <main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
286
286
  <p class="zzSTDTitle1"></p>
287
- <div>
287
+ <div id="A">
288
288
  <h1>1&#xA0; Clause 4</h1>
289
289
  <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
290
290
  <sup>1</sup>
@@ -478,6 +478,105 @@ RSpec.describe IsoDoc do
478
478
  OUTPUT
479
479
  end
480
480
 
481
+ it "processes boilerplate" do
482
+ FileUtils.rm_f "test.doc"
483
+ FileUtils.rm_f "test.html"
484
+ IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
485
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
486
+ <bibdata type="standard">
487
+ <status><stage>30</stage></status>
488
+ </bibdata>
489
+ <boilerplate>
490
+ <copyright-statement>
491
+ <clause>
492
+ <p id="authority1">
493
+ © ISO 2019, Published in Switzerland
494
+ </p>
495
+
496
+ <p id="authority2">
497
+ I am the Walrus.
498
+ </p>
499
+
500
+ <p id="authority3" align="left">
501
+ ISO copyright office<br/>
502
+ Ch. de Blandonnet 8 ?~@? CP 401<br/>
503
+ CH-1214 Vernier, Geneva, Switzerland<br/>
504
+ Tel. + 41 22 749 01 11<br/>
505
+ Fax + 41 22 749 09 47<br/>
506
+ copyright@iso.org<br/>
507
+ www.iso.org
508
+ </p>
509
+ </clause>
510
+ </copyright-statement>
511
+
512
+
513
+ <license-statement>
514
+ <clause>
515
+ <title>Warning for Stuff</title>
516
+
517
+ <p>This
518
+ document is not an ISO International Standard. It is distributed for review and
519
+ comment. It is subject to change without notice and may not be referred to as
520
+ an International Standard.</p>
521
+
522
+ <p>Recipients
523
+ of this draft are invited to submit, with their comments, notification of any
524
+ relevant patent rights of which they are aware and to provide supporting
525
+ documentation.</p>
526
+ </clause>
527
+ </license-statement>
528
+
529
+ </boilerplate>
530
+ </iso-standard>
531
+ INPUT
532
+ word = File.read("test.html", encoding: "UTF-8")
533
+ expect(xmlpp(word)).to include "<h1 class='IntroTitle'>Warning for Stuff</h1>"
534
+ expect(xmlpp(word)).to include "I am the Walrus."
535
+ end
536
+
537
+ it "processes boilerplate (Word)" do
538
+ FileUtils.rm_f "test.doc"
539
+ FileUtils.rm_f "test.html"
540
+ IsoDoc::Iso::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
541
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
542
+ <bibdata type="standard">
543
+ <status><stage>30</stage></status>
544
+ </bibdata>
545
+ <boilerplate>
546
+ <copyright-statement>
547
+ <clause>
548
+ <p id="authority1">Published in Elbonia</p>
549
+
550
+ <p id="authority2">No soup for you</p>
551
+
552
+ <p id="authority3" align="left">Elbonia 5000</p>
553
+ </clause>
554
+ </copyright-statement>
555
+
556
+
557
+ <license-statement>
558
+ <clause>
559
+ <title>Warning for Stuff</title>
481
560
 
561
+ <p>I am the Walrus</p>
562
+ </clause>
563
+ </license-statement>
564
+
565
+ </boilerplate>
566
+ </iso-standard>
567
+ INPUT
568
+ word = File.read("test.doc", encoding: "UTF-8")
569
+ expect(xmlpp(word.sub(%r{^.*<p class="zzCopyright">}m, '<p class="zzCopyright">').sub(%r{</p>.*$}m, '</p>'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
570
+ <p class="zzCopyright"><a name="authority1" id="authority1"></a>Published in Elbonia</p>
571
+ OUTPUT
572
+ expect(xmlpp(word.sub(%r{^.*<p class="zzCopyright1">}m, '<p class="zzCopyright1">').sub(%r{</p>.*$}m, '</p>'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
573
+ <p class="zzCopyright1"><a name="authority2" id="authority2"></a>No soup for you</p>
574
+ OUTPUT
575
+ expect(xmlpp(word.sub(%r{^.*<p align="left" style="text-align:left" class="zzAddress">}m, '<p align="left" style="text-align:left" class="zzAddress">').sub(%r{</p>.*$}m, '</p>'))).to be_equivalent_to xmlpp(<<~"OUTPUT")
576
+ <p align="left" style="text-align:left" class="zzAddress"><a name="authority3" id="authority3"></a>Elbonia 5000</p>
577
+ OUTPUT
578
+ expect(word).to include '<p class="zzWarning">I am the Walrus</p>'
579
+ expect(word).to include '<p class="zzWarning">I am the Walrus</p>'
580
+ end
482
581
 
483
582
  end
@@ -95,6 +95,13 @@ VALIDATING_BLANK_HDR = <<~"HDR"
95
95
 
96
96
  HDR
97
97
 
98
+ BOILERPLATE =
99
+ HTMLEntities.new.decode(
100
+ File.read(File.join(File.dirname(__FILE__), "..", "lib", "asciidoctor", "iso", "iso_intro.xml"), encoding: "utf-8").
101
+ gsub(/\{\{ agency \}\}/, "ISO").gsub(/\{\{ docyear \}\}/, Date.today.year.to_s).
102
+ gsub(/\{% if unpublished %\}.*\{% endif %\}/m, ""))
103
+
104
+
98
105
  BLANK_HDR = <<~"HDR"
99
106
  <?xml version="1.0" encoding="UTF-8"?>
100
107
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -137,6 +144,7 @@ BLANK_HDR = <<~"HDR"
137
144
  </editorialgroup>
138
145
  </ext>
139
146
  </bibdata>
147
+ #{BOILERPLATE}
140
148
  HDR
141
149
 
142
150
  TERM_BOILERPLATE = <<~END
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2019-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -263,6 +263,7 @@ files:
263
263
  - lib/asciidoctor/iso/i18n-en.yaml
264
264
  - lib/asciidoctor/iso/i18n-fr.yaml
265
265
  - lib/asciidoctor/iso/i18n-zh-Hans.yaml
266
+ - lib/asciidoctor/iso/iso_intro.xml
266
267
  - lib/asciidoctor/iso/isodoc.rng
267
268
  - lib/asciidoctor/iso/isostandard.rnc
268
269
  - lib/asciidoctor/iso/isostandard.rng