metanorma-iec 0.1.0 → 0.1.1

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: 59882444ab68ff355cce06dbeb5c394b0ca507ada6cc39cd769d451cee433cc1
4
- data.tar.gz: 444b7bcf57cb3b9ac77da1a412c373ecbf2148f1597bb5301e9c920496357edc
3
+ metadata.gz: a0fa6687e3e29e5536c7a58e61de634c61e3d74a4cc452be1368456e4f59c090
4
+ data.tar.gz: 10a74908e1e2ef8217ddb6208f48f83ca12228e965804a8e675b074aab96efb9
5
5
  SHA512:
6
- metadata.gz: 7621099111dc60894038ba1edeeb0472017b612e99b0141bd1ef8ecdf1e65eb7d69ce88233ecb5fe784950d4ec825fe4f5ee4e92fba39552d1c206130c55a097
7
- data.tar.gz: 1322e888aef4aeb7e2826aadf306bdcc0da4c5263024f0a5786b42367c180714464bd5ab68242fc6589633cec3b4e43cea6443c6a22ec0897ee75c05bf38e1d6
6
+ metadata.gz: 12b0d50e87fc114cdb2094da1b111e1439719a5b318ae4846f197a60c33d20dd31076f1af212daf323170f4beb0c25d2d2a16fb782fc630fe3bb0e1dd96ef4de
7
+ data.tar.gz: 7fe0fa49671b375ac8e53938f52f4b38b3544ab539fd7aef977f422af2ce7a25b898c950c2dd1db48ae4f9032e1a56b5a3248e0965eb68f84ec97dee433732fa
@@ -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">
@@ -147,7 +147,7 @@ module Asciidoctor
147
147
  abbr
148
148
  end
149
149
 
150
- def load_yaml(lang, script)
150
+ def load_yaml(lang, script)
151
151
  y = if @i18nyaml then YAML.load_file(@i18nyaml)
152
152
  elsif lang == "en"
153
153
  YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
@@ -161,6 +161,9 @@ def load_yaml(lang, script)
161
161
  super.merge(y)
162
162
  end
163
163
 
164
+ def initial_boilerplate(xmldoc)
165
+ end
166
+
164
167
  def html_converter(node)
165
168
  node.nil? ? IsoDoc::Iec::HtmlConvert.new({}) :
166
169
  IsoDoc::Iec::HtmlConvert.new(html_extract_attributes(node))
@@ -4,10 +4,14 @@ require "metanorma-iso"
4
4
  module IsoDoc
5
5
  module Iec
6
6
  module BaseConvert
7
- def metadata_init(lang, script, labels)
7
+ def metadata_init(lang, script, labels)
8
8
  @meta = Metadata.new(lang, script, labels)
9
9
  end
10
10
 
11
+ def boilerplate(node, out)
12
+ # processed in foreword instead
13
+ end
14
+
11
15
  def foreword(isoxml, out)
12
16
  f = isoxml.at(ns("//foreword"))
13
17
  b = isoxml.at(ns("//boilerplate/legal-statement"))
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
6
6
 
@@ -144,197 +144,6 @@ RSpec.describe IsoDoc do
144
144
  expect(word).to include(%{Content-Location: file:///C:/Doc/test_files/header.html})
145
145
  end
146
146
 
147
- it "populates Word ToC" do
148
- FileUtils.rm_f "test.doc"
149
- IsoDoc::Iec::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
150
- <iso-standard xmlns="http://riboseinc.com/isoxml">
151
- <sections>
152
- <clause inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
153
-
154
- <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
155
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
156
- </fn></title>
157
- </clause>
158
- <clause id="O" inline-header="false" obligation="normative">
159
- <title>Clause 4.2</title>
160
- <p>A<fn reference="1">
161
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
162
- </fn></p>
163
- </clause></clause>
164
- </sections>
165
- </iso-standard>
166
-
167
- INPUT
168
- word = File.read("test.doc", encoding: "UTF-8").sub(/^.*An empty word intro page\./m, '').
169
- sub(%r{<p class="zzSTDTitle1">.*$}m, "")
170
- expect(xmlpp("<div>" + word.gsub(/_Toc\d\d+/, "_Toc") + "</div>")).to be_equivalent_to xmlpp(<<~'OUTPUT')
171
- <div>
172
- <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
173
- \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
174
- <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
175
- <a href="#_Toc">FOREWORD<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
176
- <span style="mso-tab-count:1 dotted">. </span>
177
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
178
- <span style="mso-element:field-begin"></span></span>
179
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
180
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
181
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
182
-
183
- <p class="MsoToc1">
184
- <span class="MsoHyperlink">
185
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
186
- <a href="#_Toc">1 Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
187
- <span style="mso-tab-count:1 dotted">. </span>
188
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
189
- <span style="mso-element:field-begin"></span></span>
190
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
191
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
192
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
193
- </span>
194
- </p>
195
-
196
-
197
- <p class="MsoToc2">
198
- <span class="MsoHyperlink">
199
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
200
- <a href="#_Toc">1.1 Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
201
- <span style="mso-tab-count:1 dotted">. </span>
202
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
203
- <span style="mso-element:field-begin"></span></span>
204
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
205
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
206
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
207
- </span>
208
- </p>
209
-
210
- <p class="MsoToc2">
211
- <span class="MsoHyperlink">
212
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
213
- <a href="#_Toc">1.2 Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
214
- <span style="mso-tab-count:1 dotted">. </span>
215
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
216
- <span style="mso-element:field-begin"></span></span>
217
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
218
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
219
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
220
- </span>
221
- </p>
222
-
223
- <p class="MsoToc1">
224
- <span lang="EN-GB" xml:lang="EN-GB">
225
- <span style="mso-element:field-end"></span>
226
- </span>
227
- <span lang="EN-GB" xml:lang="EN-GB">
228
- <p class="MsoNormal">&#xA0;</p>
229
- </span>
230
- </p>
231
-
232
-
233
- <p class="MsoNormal">
234
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
235
- </p>
236
- </div>
237
- OUTPUT
238
- end
239
-
240
- it "reorders footnote numbers in HTML" do
241
- FileUtils.rm_f "test.html"
242
- IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
243
- <iso-standard xmlns="http://riboseinc.com/isoxml">
244
- <sections>
245
- <clause inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
246
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
247
- </fn><clause id="N" inline-header="false" obligation="normative">
248
-
249
- <title>Introduction to this<fn reference="2">
250
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
251
- </fn></title>
252
- </clause>
253
- <clause id="O" inline-header="false" obligation="normative">
254
- <title>Clause 4.2</title>
255
- <p>A<fn reference="1">
256
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
257
- </fn></p>
258
- </clause></clause>
259
- </sections>
260
- </iso-standard>
261
- INPUT
262
- html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">').
263
- sub(%r{</main>.*$}m, "</main>")
264
- expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
265
- <main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
266
- <br/>
267
- #{IEC_TITLE}
268
- <div id="">
269
- <h1 class="ForewordTitle">FOREWORD</h1>
270
- <div class="boilerplate_legal"></div>
271
- </div>
272
- #{IEC_TITLE}
273
- <div>
274
- <h1>1&#xA0; Clause 4</h1>
275
- <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
276
- <sup>1</sup>
277
- </a>
278
- <div id="N">
279
-
280
- <h2>1.1&#160; Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2</sup></a></h2>
281
- </div>
282
- <div id="O">
283
- <h2>1.2&#160; Clause 4.2</h2>
284
- <p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
285
- </div>
286
- </div>
287
- <aside id="fn:3" class="footnote">
288
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:3" epub:type="footnote">
289
- <sup>1</sup>
290
- </a>This is a footnote.</p>
291
- <a href="#fnref:1">&#x21A9;</a></aside>
292
- <aside id="fn:2" class="footnote">
293
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a>Formerly denoted as 15 % (m/m).</p>
294
- <a href="#fnref:2">&#x21A9;</a></aside>
295
-
296
- </main>
297
- OUTPUT
298
- end
299
-
300
- it "moves images in HTML" do
301
- FileUtils.rm_f "test.html"
302
- FileUtils.rm_rf "_images"
303
- FileUtils.rm_rf "test_htmlimages"
304
- IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
305
- <iso-standard xmlns="http://riboseinc.com/isoxml">
306
- <preface><foreword>
307
- <figure id="_">
308
- <name>Split-it-right sample divider</name>
309
- <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
310
- <image src="spec/assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
311
- <image src="spec/assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
312
- </figure>
313
- </foreword></preface>
314
- </iso-standard>
315
- INPUT
316
- html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
317
- sub(%r{</main>.*$}m, "</main>")
318
- expect(`ls test_htmlimages`).to match(/\.png$/)
319
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
320
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
321
- <br />
322
- #{IEC_TITLE}
323
- <div>
324
- <h1 class="ForewordTitle">FOREWORD</h1>
325
- <div class="boilerplate_legal"></div>
326
- <div id="_" class="figure">
327
- <img src="test_htmlimages/_.png" height="776" width="922" />
328
- <img src="test_htmlimages/_.png" height="800" width="53" />
329
- <img src="test_htmlimages/_.png" height="83" width="99" />
330
- <p class="FigureTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
331
- </div>
332
- #{IEC_TITLE}
333
- </main>
334
- OUTPUT
335
-
336
- end
337
-
338
147
  it "processes IsoXML terms for HTML" do
339
148
  FileUtils.rm_f "test.html"
340
149
  FileUtils.rm_f "test.doc"
@@ -457,8 +266,9 @@ RSpec.describe IsoDoc do
457
266
  <div class="Section3"><a name="P" id="P"></a>
458
267
  <p class="Sourcecode"><a name="A" id="A"></a>puts "Hello, world."</p>
459
268
  <p class="TableTitle" style="text-align:center;">Table A.1</p>
460
- <div align="center">
461
- <table style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;" class="MsoISOTable"><a name="samplecode" id="samplecode"></a>
269
+ <div align='center' class='table_container'>
270
+ <table class='MsoISOTable' style='mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
271
+ <a name='samplecode' id='samplecode'/>
462
272
  <tbody>
463
273
  <tr>
464
274
  <td style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;" class="TABLE-cell">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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