isodoc 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c17faca6084ff975799b3c8ffd31b6fffeaf6d11145547042e59c6be7abf8e6
4
- data.tar.gz: dbb039f5b14cdcd30579eeaea0b7cbbe5e0496e20d566280a9350f9a14ce2177
3
+ metadata.gz: 6a664c3da9b6df6b4e533371a17c3a407423cafaeb043eacc92a14ff0282113b
4
+ data.tar.gz: a01075ddc20896c5347367c296379a2ade09177804f37631b386ea92046fd740
5
5
  SHA512:
6
- metadata.gz: e50e9e38683d8a21577d96e81c8c38771c89b4fce3b6482cda3c12e6812385151601c5a3e1085dc47e0fedbf6d561dd4c308c0b9a55e3936ed5cc0c4068188ac
7
- data.tar.gz: ddc25eddf928b63c959fca69570c76fd6264b811601432e2869efc91bf6553c7e633f4ae3bb29c17e5a157ac2ade5949827aba9d930333dea0d715fb79bef25b
6
+ metadata.gz: 901a72db1d909f98dc6e2813ddb5d6ad7eec9feb870f0545d473fd5fc58e9c3e0d065f99c82dac964d06398af988c68b5c0743b19e51bf339ca085bcb7574125
7
+ data.tar.gz: fb8143ee5d1f5fb2a49c40f1218eeaa0e36a6c9fb9ba0c1abda1ca10154f0816aa0ac76072a2bd58e539c255d6dc85ca28888385a7407992a6502a988a511d03
@@ -136,6 +136,66 @@ module IsoDoc::Function
136
136
  image_title_parse(out, caption)
137
137
  end
138
138
 
139
+ def smallcap_parse(node, xml)
140
+ xml.span **{ style: "font-variant:small-caps;" } do |s|
141
+ node.children.each { |n| parse(n, s) }
142
+ end
143
+ end
144
+
145
+ def text_parse(node, out)
146
+ return if node.nil? || node.text.nil?
147
+ text = node.to_s
148
+ text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/>&nbsp;").
149
+ gsub(/[ ](?=[ ])/, "&nbsp;") if in_sourcecode
150
+ out << text
151
+ end
152
+
153
+ def bookmark_parse(node, out)
154
+ out.a **attr_code(id: node["id"])
155
+ end
156
+
157
+ def keyword_parse(node, out)
158
+ out.span **{ class: "keyword" } do |s|
159
+ node.children.each { |n| parse(n, s) }
160
+ end
161
+ end
162
+
163
+ def em_parse(node, out)
164
+ out.i do |e|
165
+ node.children.each { |n| parse(n, e) }
166
+ end
167
+ end
168
+
169
+ def strong_parse(node, out)
170
+ out.b do |e|
171
+ node.children.each { |n| parse(n, e) }
172
+ end
173
+ end
174
+
175
+ def sup_parse(node, out)
176
+ out.sup do |e|
177
+ node.children.each { |n| parse(n, e) }
178
+ end
179
+ end
180
+
181
+ def sub_parse(node, out)
182
+ out.sub do |e|
183
+ node.children.each { |n| parse(n, e) }
184
+ end
185
+ end
186
+
187
+ def tt_parse(node, out)
188
+ out.tt do |e|
189
+ node.children.each { |n| parse(n, e) }
190
+ end
191
+ end
192
+
193
+ def strike_parse(node, out)
194
+ out.s do |e|
195
+ node.children.each { |n| parse(n, e) }
196
+ end
197
+ end
198
+
139
199
  def error_parse(node, out)
140
200
  text = node.to_xml.gsub(/</, "&lt;").gsub(/>/, "&gt;")
141
201
  out.para do |p|
@@ -47,10 +47,9 @@ module IsoDoc::Function
47
47
  end
48
48
 
49
49
  def bibitem_ref_code(b)
50
- id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
50
+ id = b.at(ns("./docidentifier[@type = 'metanorma']"))
51
+ id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
51
52
  "or @type = 'ISSN' or @type = 'ISBN')]"))
52
- id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'ISSN' or "\
53
- "@type = 'ISBN')]"))
54
53
  id ||= b.at(ns("./docidentifier"))
55
54
  return id if id
56
55
  id = Nokogiri::XML::Node.new("docidentifier", b.document)
@@ -180,5 +180,29 @@ module IsoDoc::Function
180
180
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
181
181
  end
182
182
  end
183
+
184
+ def copyright_parse(node, out)
185
+ out.div **{class: "boilerplate-copyright"} do |div|
186
+ node.children.each { |n| parse(n, div) }
187
+ end
188
+ end
189
+
190
+ def license_parse(node, out)
191
+ out.div **{class: "boilerplate-license"} do |div|
192
+ node.children.each { |n| parse(n, div) }
193
+ end
194
+ end
195
+
196
+ def legal_parse(node, out)
197
+ out.div **{class: "boilerplate-legal"} do |div|
198
+ node.children.each { |n| parse(n, div) }
199
+ end
200
+ end
201
+
202
+ def feedback_parse(node, out)
203
+ out.div **{class: "boilerplate-feedback"} do |div|
204
+ node.children.each { |n| parse(n, div) }
205
+ end
206
+ end
183
207
  end
184
208
  end
@@ -80,6 +80,7 @@ module IsoDoc::Function
80
80
 
81
81
  def make_body3(body, docxml)
82
82
  body.div **{ class: "main-section" } do |div3|
83
+ boilerplate docxml, div3
83
84
  abstract docxml, div3
84
85
  foreword docxml, div3
85
86
  introduction docxml, div3
@@ -118,67 +119,20 @@ module IsoDoc::Function
118
119
  bibliography isoxml, out
119
120
  end
120
121
 
121
- def smallcap_parse(node, xml)
122
- xml.span **{ style: "font-variant:small-caps;" } do |s|
123
- #s << node.inner_html
124
- node.children.each { |n| parse(n, s) }
125
- end
126
- end
127
-
128
- def text_parse(node, out)
129
- return if node.nil? || node.text.nil?
130
- text = node.to_s
131
- text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/>&nbsp;").
132
- gsub(/[ ](?=[ ])/, "&nbsp;") if in_sourcecode
133
- out << text
134
- end
135
-
136
- def bookmark_parse(node, out)
137
- out.a **attr_code(id: node["id"])
138
- end
139
-
140
- def keyword_parse(node, out)
141
- out.span **{ class: "keyword" } do |s|
142
- #s << node.inner_html
143
- node.children.each { |n| parse(n, s) }
144
- end
145
- end
146
-
147
- def em_parse(node, out)
148
- out.i do |e|
149
- node.children.each { |n| parse(n, e) }
150
- end
151
- end
152
-
153
- def strong_parse(node, out)
154
- out.b do |e|
155
- node.children.each { |n| parse(n, e) }
156
- end
157
- end
158
-
159
- def sup_parse(node, out)
160
- out.sup do |e|
161
- node.children.each { |n| parse(n, e) }
162
- end
163
- end
164
-
165
- def sub_parse(node, out)
166
- out.sub do |e|
167
- node.children.each { |n| parse(n, e) }
168
- end
169
- end
170
-
171
- def tt_parse(node, out)
172
- out.tt do |e|
173
- node.children.each { |n| parse(n, e) }
174
- end
175
- end
176
-
177
- def strike_parse(node, out)
178
- out.s do |e|
179
- node.children.each { |n| parse(n, e) }
122
+ def boilerplate(node, out)
123
+ boilerplate = node.at(ns("//boilerplate")) or return
124
+ out.div **{class: "authority"} do |s|
125
+ boilerplate.children.each do |n|
126
+ if n.name == "title"
127
+ s.h1 do |h|
128
+ n.children.each { |nn| parse(nn, h) }
129
+ end
130
+ else
131
+ parse(n, s)
132
+ end
133
+ end
134
+ end
180
135
  end
181
- end
182
136
 
183
137
  def parse(node, out)
184
138
  if node.text?
@@ -251,6 +205,10 @@ module IsoDoc::Function
251
205
  when "index" then index_parse(node, out)
252
206
  when "concept" then concept_parse(node, out)
253
207
  when "termref" then termrefelem_parse(node, out)
208
+ when "copyright-statement" then copyright_parse(node, out)
209
+ when "license-statement" then license_parse(node, out)
210
+ when "legal-statement" then legal_parse(node, out)
211
+ when "feedback-statement" then feedback_parse(node, out)
254
212
  else
255
213
  error_parse(node, out)
256
214
  end
@@ -2,6 +2,14 @@ require "roman-numerals"
2
2
 
3
3
  module IsoDoc::Function
4
4
  module XrefGen
5
+ def hiersep
6
+ "."
7
+ end
8
+
9
+ def hierfigsep
10
+ "-"
11
+ end
12
+
5
13
  class Counter
6
14
  def initialize
7
15
  @num = 0
@@ -30,13 +38,13 @@ module IsoDoc::Function
30
38
  end
31
39
 
32
40
  def listlabel(depth)
33
- return @num.to_s if [2, 7].include? depth
34
- return (96 + @num).chr.to_s if [1, 6].include? depth
35
- return (64 + @num).chr.to_s if [4, 9].include? depth
36
- return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
37
- return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
38
- return @num.to_s
39
- end
41
+ return @num.to_s if [2, 7].include? depth
42
+ return (96 + @num).chr.to_s if [1, 6].include? depth
43
+ return (64 + @num).chr.to_s if [4, 9].include? depth
44
+ return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
45
+ return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
46
+ return @num.to_s
47
+ end
40
48
  end
41
49
  end
42
50
  end
@@ -32,7 +32,7 @@ module IsoDoc::Function
32
32
  @anchors[n["id"]] = {
33
33
  type: "termexample", label: idx,
34
34
  xref: l10n("#{anchor(t['id'], :xref)}, "\
35
- "#{@example_xref_lbl} #{c.print}") }
35
+ "#{@example_xref_lbl} #{c.print}") }
36
36
  end
37
37
  end
38
38
  end
@@ -169,23 +169,23 @@ module IsoDoc::Function
169
169
  next if t["id"].nil? || t["id"].empty?
170
170
  id = c.increment(t).print
171
171
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
172
- sequential_permission_names1(t, id, "permission", @permission_lbl)
173
- sequential_permission_names1(t, id, "requirement", @requirement_lbl)
174
- sequential_permission_names1(t, id, "recommendation",
175
- @recommendation_lbl)
172
+ sequential_permission_names2(t, id)
176
173
  end
177
174
  end
178
175
 
176
+ def sequential_permission_names2(t, id)
177
+ sequential_permission_names1(t, id, "permission", @permission_lbl)
178
+ sequential_permission_names1(t, id, "requirement", @requirement_lbl)
179
+ sequential_permission_names1(t, id, "recommendation", @recommendation_lbl)
180
+ end
181
+
179
182
  def sequential_permission_names1(block, lbl, klass, label)
180
183
  c = Counter.new
181
184
  block.xpath(ns("./#{klass}")).each do |t|
182
185
  next if t["id"].nil? || t["id"].empty?
183
186
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
184
187
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
185
- sequential_permission_names1(t, id, "permission", @permission_lbl)
186
- sequential_permission_names1(t, id, "requirement", @requirement_lbl)
187
- sequential_permission_names1(t, id, "recommendation",
188
- @recommendation_lbl)
188
+ sequential_permission_names2(t, id)
189
189
  end
190
190
  end
191
191
 
@@ -198,14 +198,6 @@ module IsoDoc::Function
198
198
  sequential_permission_names(clause, "recommendation", @recommendation_lbl)
199
199
  end
200
200
 
201
- def hiersep
202
- "."
203
- end
204
-
205
- def hierfigsep
206
- "-"
207
- end
208
-
209
201
  def hierarchical_figure_names(clause, num)
210
202
  c = Counter.new
211
203
  j = 0
@@ -259,12 +251,9 @@ module IsoDoc::Function
259
251
  c = Counter.new
260
252
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
261
253
  next if t["id"].nil? || t["id"].empty?
262
- lbl = "#{num}#{hiersep}#{c.increment(t).print}"
263
- @anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
264
- sequential_permission_names1(t, lbl, "permission", @permission_lbl)
265
- sequential_permission_names1(t, lbl, "requirement", @requirement_lbl)
266
- sequential_permission_names1(t, lbl, "recommendation",
267
- @recommendation_lbl)
254
+ id = "#{num}#{hiersep}#{c.increment(t).print}"
255
+ @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
256
+ sequential_permission_names2(t, id)
268
257
  end
269
258
  end
270
259
  end
@@ -19,6 +19,7 @@ module IsoDoc::HtmlFunction
19
19
 
20
20
  def make_body3(body, docxml)
21
21
  body.div **{ class: "main-section" } do |div3|
22
+ boilerplate docxml, div3
22
23
  abstract docxml, div3
23
24
  foreword docxml, div3
24
25
  introduction docxml, div3
@@ -91,8 +92,8 @@ module IsoDoc::HtmlFunction
91
92
  @sourcecode = true
92
93
  node.children.each { |n| parse(n, div) unless n.name == "name" }
93
94
  @sourcecode = false
94
- sourcecode_name_parse(node, div, name) if name
95
95
  end
96
+ sourcecode_name_parse(node, out, name)
96
97
  end
97
98
  end
98
99
  end
@@ -55,9 +55,23 @@ module IsoDoc::HtmlFunction
55
55
  docxml.at("//body") << mathjax(@openmathdelim, @closemathdelim)
56
56
  docxml.at("//body") << sourcecode_highlighter
57
57
  html_main(docxml)
58
+ authority_cleanup(docxml)
58
59
  docxml
59
60
  end
60
61
 
62
+ def authority_cleanup1(docxml, klass)
63
+ dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
64
+ auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or @class = 'boilerplate-#{klass}']")
65
+ auth&.xpath(".//h1 | .//h2")&.each { |h| h["class"] = "IntroTitle" }
66
+ dest and auth and dest.replace(auth.remove)
67
+ end
68
+
69
+ def authority_cleanup(docxml)
70
+ %w(copyright license legal feedback).each do |t|
71
+ authority_cleanup1(docxml, t)
72
+ end
73
+ end
74
+
61
75
  def html_cover(docxml)
62
76
  doc = to_xhtml_fragment(File.read(@htmlcoverpage, encoding: "UTF-8"))
63
77
  d = docxml.at('//div[@class="title-section"]')
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.0.14".freeze
2
+ VERSION = "1.0.15".freeze
3
3
  end
@@ -10,21 +10,6 @@ module IsoDoc::WordFunction
10
10
  super
11
11
  end
12
12
 
13
- =begin
14
- def anchor_names(docxml)
15
- super
16
- renumber_footnotes(docxml)
17
- end
18
-
19
- # undo merger of seen footnotes
20
- def renumber_footnotes(docxml)
21
- docxml.xpath(ns("//fn[not(ancestor::table or "\
22
- "ancestor::figure)]")).each_with_index do |f, i|
23
- f["reference"] = (i + 1).to_s
24
- end
25
- end
26
- =end
27
-
28
13
  def body_attr
29
14
  { lang: "EN-US", link: "blue", vlink: "#954F72" }
30
15
  end
@@ -40,6 +25,7 @@ module IsoDoc::WordFunction
40
25
 
41
26
  def make_body2(body, docxml)
42
27
  body.div **{ class: "WordSection2" } do |div2|
28
+ boilerplate docxml, div2
43
29
  abstract docxml, div2
44
30
  foreword docxml, div2
45
31
  introduction docxml, div2
@@ -65,9 +65,26 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
65
65
  word_example_cleanup(docxml)
66
66
  word_pseudocode_cleanup(docxml)
67
67
  word_image_caption(docxml)
68
+ authority_cleanup(docxml)
68
69
  docxml
69
70
  end
70
71
 
72
+ def authority_cleanup1(docxml, klass)
73
+ dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
74
+ auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or @class = 'boilerplate-#{klass}']")
75
+ auth&.xpath(".//h1 | .//h2")&.each do |h|
76
+ h.name = "p"
77
+ h["class"] = "TitlePageSubhead"
78
+ end
79
+ dest and auth and dest.replace(auth.remove)
80
+ end
81
+
82
+ def authority_cleanup(docxml)
83
+ %w(copyright license legal feedback).each do |t|
84
+ authority_cleanup1(docxml, t)
85
+ end
86
+ end
87
+
71
88
  def style_update(node, css)
72
89
  return unless node
73
90
  node["style"] = node["style"] ? node["style"].sub(/;?$/, ";#{css}") : css
@@ -369,8 +369,8 @@ B</pre>
369
369
  &#160;
370
370
  <br/>
371
371
  &#160;
372
- <p class='SourceTitle' style='text-align:center;'>Sample</p>
373
372
  </pre>
373
+ <p class='SourceTitle' style='text-align:center;'>Sample</p>
374
374
  </div>
375
375
  </div>
376
376
  <p class="zzSTDTitle1"/>
@@ -440,7 +440,8 @@ Que?
440
440
  <br/>
441
441
  <div>
442
442
  <h1 class="ForewordTitle">Foreword</h1>
443
- <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p></pre>
443
+ <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/></pre>
444
+ <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p>
444
445
  <pre class='prettyprint '>
445
446
  <br/>
446
447
  Que?
@@ -518,7 +519,8 @@ Que?
518
519
  <br/>
519
520
  <div>
520
521
  <h1 class="ForewordTitle">Foreword</h1>
521
- <pre id="samplecode" class="prettyprint "><br/>&#160;&#160;&#160; <br/>&#160; &lt;xml&gt;<br/><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; XML code</p></pre>
522
+ <pre id="samplecode" class="prettyprint "><br/>&#160;&#160;&#160; <br/>&#160; &lt;xml&gt;<br/></pre>
523
+ <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; XML code</p>
522
524
  </div>
523
525
  <p class="zzSTDTitle1"/>
524
526
  </div>
@@ -547,6 +549,7 @@ Que?
547
549
  <div>
548
550
  <h1 class="ForewordTitle">Foreword</h1>
549
551
  <pre id="_" class="prettyprint ">puts "Hello, world." &lt;1&gt;<br/>&#160;&#160; %w{a b c}.each do |x|<br/>&#160;&#160;&#160;&#160; puts x &lt;2&gt;<br/>&#160;&#160; end<br/><br/>&lt;1&gt; This is one callout<br/>&lt;2&gt; This is another callout</pre>
552
+ <p class='SourceTitle' style='text-align:center;'>Figure 1</p>
550
553
  </div>
551
554
  <p class="zzSTDTitle1"/>
552
555
  </div>
@@ -1106,8 +1109,8 @@ INPUT
1106
1109
  <p class='example-title'>EXAMPLE</p>
1107
1110
  <pre id='B' class='prettyprint '>
1108
1111
  A B C
1109
- <p class='SourceTitle' style='text-align:center;'>Label</p>
1110
1112
  </pre>
1113
+ <p class='SourceTitle' style='text-align:center;'>Label</p>
1111
1114
  <div id='A' class='pseudocode'>
1112
1115
  <p id='_'>
1113
1116
  &#160;&#160;
@@ -762,5 +762,4 @@ INPUT
762
762
 
763
763
  OUTPUT
764
764
  end
765
-
766
765
  end
@@ -925,7 +925,9 @@ TOCLEVEL
925
925
  <br />
926
926
  <div>
927
927
  <h1 class="ForewordTitle">Foreword</h1>
928
- <pre id="samplecode" class="prettyprint "><br />&#xA0;&#xA0;&#xA0; <br />&#xA0; &lt;xml&gt; &amp;<br /><p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; XML code</p></pre>
928
+ <pre id="samplecode" class="prettyprint "><br />&#xA0;&#xA0;&#xA0; <br />&#xA0; &lt;xml&gt; &amp;<br />
929
+ </pre>
930
+ <p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; XML code</p>
929
931
  </div>
930
932
  <p class="zzSTDTitle1"></p>
931
933
  </main>
@@ -1139,4 +1141,84 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
1139
1141
  OUTPUT
1140
1142
  end
1141
1143
 
1144
+ it "cleans up boilerplate" do
1145
+ expect(xmlpp(IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).html_preface(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
1146
+ <html>
1147
+ <head/>
1148
+ <body>
1149
+ <div class="main-section">
1150
+ <div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
1151
+ <div id="boilerplate-license"> <h1>License</h1> </div>
1152
+ <div id="boilerplate-legal"> <h1>Legal</h1> </div>
1153
+ <div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
1154
+ <hr/>
1155
+ <div id="boilerplate-feedback-destination"/>
1156
+ <div id="boilerplate-legal-destination"/>
1157
+ <div id="boilerplate-license-destination"/>
1158
+ <div id="boilerplate-copyright-destination"/>
1159
+ </div>
1160
+ </body>
1161
+ </html>
1162
+ INPUT
1163
+ <main class='main-section'>
1164
+ <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
1165
+ <hr/>
1166
+ <div id='boilerplate-feedback'>
1167
+ <h1 class='IntroTitle'>Feedback</h1>
1168
+ </div>
1169
+ <div id='boilerplate-legal'>
1170
+ <h1 class='IntroTitle'>Legal</h1>
1171
+ </div>
1172
+ <div id='boilerplate-license'>
1173
+ <h1 class='IntroTitle'>License</h1>
1174
+ </div>
1175
+ <div id='boilerplate-copyright'>
1176
+ <h1 class='IntroTitle'>Copyright</h1>
1177
+ </div>
1178
+ </main>
1179
+ OUTPUT
1180
+ end
1181
+
1182
+ it "cleans up boilerplate (Word)" do
1183
+ expect(xmlpp(IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
1184
+ <html>
1185
+ <head/>
1186
+ <body>
1187
+ <div class="main-section">
1188
+ <div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
1189
+ <div id="boilerplate-license"> <h1>License</h1> </div>
1190
+ <div id="boilerplate-legal"> <h1>Legal</h1> </div>
1191
+ <div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
1192
+ <hr/>
1193
+ <div id="boilerplate-feedback-destination"/>
1194
+ <div id="boilerplate-legal-destination"/>
1195
+ <div id="boilerplate-license-destination"/>
1196
+ <div id="boilerplate-copyright-destination"/>
1197
+ </div>
1198
+ </body>
1199
+ </html>
1200
+ INPUT
1201
+ <html>
1202
+ <head/>
1203
+ <body>
1204
+ <div class='main-section'>
1205
+ <hr/>
1206
+ <div id='boilerplate-feedback'>
1207
+ <p class='TitlePageSubhead'>Feedback</p>
1208
+ </div>
1209
+ <div id='boilerplate-legal'>
1210
+ <p class='TitlePageSubhead'>Legal</p>
1211
+ </div>
1212
+ <div id='boilerplate-license'>
1213
+ <p class='TitlePageSubhead'>License</p>
1214
+ </div>
1215
+ <div id='boilerplate-copyright'>
1216
+ <p class='TitlePageSubhead'>Copyright</p>
1217
+ </div>
1218
+ </div>
1219
+ </body>
1220
+ </html>
1221
+ OUTPUT
1222
+ end
1223
+
1142
1224
  end
@@ -112,6 +112,7 @@ RSpec.describe IsoDoc do
112
112
  <bibitem id="ref12">
113
113
  <formattedref format="application/x-isodoc+xml">CitationWorks. 2019. <em>How to cite a reference</em>.</formattedref>
114
114
  <docidentifier type="metanorma">[Citn]</docidentifier>
115
+ <docidentifier type="IETF">RFC 20</docidentifier>
115
116
  </bibitem>
116
117
 
117
118
 
@@ -159,7 +160,7 @@ RSpec.describe IsoDoc do
159
160
  <p id="ISO3696" class="Biblio">[3]&#160; ISO 3696, <i>Water for analytical laboratory use</i></p>
160
161
  <p id="ref10" class="Biblio">[10]&#160; <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
161
162
  <p id="ref11" class="Biblio">[5]&#160; IETF RFC 10, <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i></p>
162
- <p id="ref12" class="Biblio">[Citn]&#160; CitationWorks. 2019. <i>How to cite a reference</i>.</p>
163
+ <p id="ref12" class="Biblio">[6]&#160; Citn, CitationWorks. 2019. <i>How to cite a reference</i>.</p>
163
164
  </div>
164
165
  <aside id="fn:1" class="footnote">
165
166
  <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
@@ -30,6 +30,28 @@ RSpec.describe IsoDoc do
30
30
  it "processes section names" do
31
31
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
32
32
  <iso-standard xmlns="http://riboseinc.com/isoxml">
33
+ <boilerplate>
34
+ <copyright-statement>
35
+ <clause>
36
+ <title>Copyright</title>
37
+ </clause>
38
+ </copyright-statement>
39
+ <license-statement>
40
+ <clause>
41
+ <title>License</title>
42
+ </clause>
43
+ </license-statement>
44
+ <legal-statement>
45
+ <clause>
46
+ <title>Legal</title>
47
+ </clause>
48
+ </legal-statement>
49
+ <feedback-statement>
50
+ <clause>
51
+ <title>Feedback</title>
52
+ </clause>
53
+ </feedback-statement>
54
+ </boilerplate>
33
55
  <preface>
34
56
  <abstract obligation="informative">
35
57
  <title>Foreword</title>
@@ -98,6 +120,28 @@ RSpec.describe IsoDoc do
98
120
  </iso-standard>
99
121
  INPUT
100
122
  #{HTML_HDR}
123
+ <div class='authority'>
124
+ <div class='boilerplate-copyright'>
125
+ <div>
126
+ <h1>Copyright</h1>
127
+ </div>
128
+ </div>
129
+ <div class='boilerplate-license'>
130
+ <div>
131
+ <h1>License</h1>
132
+ </div>
133
+ </div>
134
+ <div class='boilerplate-legal'>
135
+ <div>
136
+ <h1>Legal</h1>
137
+ </div>
138
+ </div>
139
+ <div class='boilerplate-feedback'>
140
+ <div>
141
+ <h1>Feedback</h1>
142
+ </div>
143
+ </div>
144
+ </div>
101
145
  <br/>
102
146
  <div>
103
147
  <h1 class="AbstractTitle">Abstract</h1>
@@ -181,6 +225,28 @@ OUTPUT
181
225
  it "processes section names (Word)" do
182
226
  expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
183
227
  <iso-standard xmlns="http://riboseinc.com/isoxml">
228
+ <boilerplate>
229
+ <copyright-statement>
230
+ <clause>
231
+ <title>Copyright</title>
232
+ </clause>
233
+ </copyright-statement>
234
+ <license-statement>
235
+ <clause>
236
+ <title>License</title>
237
+ </clause>
238
+ </license-statement>
239
+ <legal-statement>
240
+ <clause>
241
+ <title>Legal</title>
242
+ </clause>
243
+ </legal-statement>
244
+ <feedback-statement>
245
+ <clause>
246
+ <title>Feedback</title>
247
+ </clause>
248
+ </feedback-statement>
249
+ </boilerplate>
184
250
  <preface>
185
251
  <abstract obligation="informative">
186
252
  <title>Foreword</title>
@@ -254,6 +320,28 @@ OUTPUT
254
320
  </div>
255
321
  <p><br clear="all" class="section"/></p>
256
322
  <div class="WordSection2">
323
+ <div class='authority'>
324
+ <div class='boilerplate-copyright'>
325
+ <div>
326
+ <h1>Copyright</h1>
327
+ </div>
328
+ </div>
329
+ <div class='boilerplate-license'>
330
+ <div>
331
+ <h1>License</h1>
332
+ </div>
333
+ </div>
334
+ <div class='boilerplate-legal'>
335
+ <div>
336
+ <h1>Legal</h1>
337
+ </div>
338
+ </div>
339
+ <div class='boilerplate-feedback'>
340
+ <div>
341
+ <h1>Feedback</h1>
342
+ </div>
343
+ </div>
344
+ </div>
257
345
  <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
258
346
  <div>
259
347
  <h1 class="AbstractTitle">Abstract</h1>
@@ -344,8 +344,8 @@ RSpec.describe IsoDoc do
344
344
  &#160; A B C
345
345
  <br/>
346
346
  &#160;
347
- <p class='SourceTitle' style='text-align:center;'>Figure 5&#160;&#8212; Source! Code!</p>
348
347
  </pre>
348
+ <p class='SourceTitle' style='text-align:center;'>Figure 5&#160;&#8212; Source! Code!</p>
349
349
  <div id='note5' class='example'>
350
350
  <p class='example-title'>EXAMPLE</p>
351
351
  <pre id='note51' class='prettyprint '>
@@ -385,8 +385,8 @@ RSpec.describe IsoDoc do
385
385
  &#160; A B C
386
386
  <br/>
387
387
  &#160;
388
- <p class='SourceTitle' style='text-align:center;'>Figure A.3&#160;&#8212; Source! Code!</p>
389
388
  </pre>
389
+ <p class='SourceTitle' style='text-align:center;'>Figure A.3&#160;&#8212; Source! Code!</p>
390
390
  </div>
391
391
  </div>
392
392
  </div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.14
4
+ version: 1.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-16 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath