isodoc 0.9.14 → 0.9.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.adoc +1 -1
- data/isodoc.gemspec +1 -1
- data/lib/isodoc/function/blocks.rb +10 -3
- data/lib/isodoc/html_function/html.rb +1 -1
- data/lib/isodoc/metadata.rb +44 -6
- data/lib/isodoc/pdf_convert.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/spec/isodoc/blocks_spec.rb +11 -23
- data/spec/isodoc/metadata_spec.rb +27 -7
- data/spec/isodoc/postproc_spec.rb +0 -43
- data/spec/isodoc/terms_spec.rb +12 -12
- data/spec/isodoc/xref_spec.rb +16 -26
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63d1745c833e13e8fb6301154c1f888c3b107ec0a51409d00bba57920f049ad4
|
4
|
+
data.tar.gz: a4c41afb2aac271ca31976e5b44bc1cd9bbe06e9c4d7448ea58d20efd89e5053
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e74800b697fab3fe77b6e0a03ffd698fa1dfc6c1c1312102aa4a6bc8b29fcd084662e8a0640dd75d553d1cc67ce8a66c96a0ee09f7972a414b29da218bf19a33
|
7
|
+
data.tar.gz: f8b77e105d81db551d503e86e386fe3de1192a7596db641db926f620a743494fe182d7e412ed4c17152c0842cd3fb4d0281c9a7b238accb42aa696b4a275a96f
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
isodoc (0.9.
|
4
|
+
isodoc (0.9.15)
|
5
5
|
asciimath
|
6
6
|
html2doc (~> 0.8.6)
|
7
7
|
htmlentities (~> 4.3.4)
|
8
8
|
liquid
|
9
9
|
metanorma (~> 0.3.0)
|
10
|
-
nokogiri
|
10
|
+
nokogiri (>= 1)
|
11
11
|
rake (~> 12.0)
|
12
12
|
roman-numerals
|
13
13
|
ruby-xslt
|
@@ -61,7 +61,7 @@ GEM
|
|
61
61
|
rb-inotify (~> 0.9, >= 0.9.7)
|
62
62
|
ruby_dep (~> 1.2)
|
63
63
|
lumberjack (1.0.13)
|
64
|
-
metanorma (0.3.
|
64
|
+
metanorma (0.3.7)
|
65
65
|
asciidoctor
|
66
66
|
method_source (0.9.2)
|
67
67
|
mime-types (3.2.2)
|
@@ -69,13 +69,13 @@ GEM
|
|
69
69
|
mime-types-data (3.2018.0812)
|
70
70
|
mini_portile2 (2.4.0)
|
71
71
|
nenv (0.3.0)
|
72
|
-
nokogiri (1.10.
|
72
|
+
nokogiri (1.10.1)
|
73
73
|
mini_portile2 (~> 2.4.0)
|
74
74
|
notiffany (0.1.1)
|
75
75
|
nenv (~> 0.1)
|
76
76
|
shellany (~> 0.0)
|
77
|
-
parallel (1.
|
78
|
-
parser (2.
|
77
|
+
parallel (1.13.0)
|
78
|
+
parser (2.6.0.0)
|
79
79
|
ast (~> 2.4.0)
|
80
80
|
powerpack (0.1.2)
|
81
81
|
pry (0.12.2)
|
data/README.adoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= isodoc: Ruby gem for converting ISODoc documents into HTML/Word
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/isodoc.svg["Gem Version", link="https://rubygems.org/gems/isodoc"]
|
4
|
-
image:https://img.shields.io/travis/riboseinc/
|
4
|
+
image:https://img.shields.io/travis/riboseinc/isodoc/master.svg["Build Status", link="https://travis-ci.org/riboseinc/isodoc"]
|
5
5
|
image:https://codeclimate.com/github/riboseinc/isodoc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/riboseinc/isodoc"]
|
6
6
|
|
7
7
|
== Purpose
|
data/isodoc.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency "asciimath"
|
32
32
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
33
|
-
spec.add_dependency "nokogiri"
|
33
|
+
spec.add_dependency "nokogiri", ">= 1"
|
34
34
|
spec.add_dependency "ruby-xslt"
|
35
35
|
spec.add_dependency "thread_safe"
|
36
36
|
spec.add_dependency "uuidtools"
|
@@ -83,7 +83,9 @@ module IsoDoc::Function
|
|
83
83
|
# used if we are boxing examples
|
84
84
|
def example_div_parse(node, out)
|
85
85
|
out.div **attr_code(id: node["id"], class: "example") do |div|
|
86
|
-
div.p {
|
86
|
+
div.p **{ class: "example-title" } do |p|
|
87
|
+
p << example_label(node)
|
88
|
+
end
|
87
89
|
node.children.each do |n|
|
88
90
|
parse(n, div)
|
89
91
|
end
|
@@ -96,7 +98,7 @@ module IsoDoc::Function
|
|
96
98
|
style: "border-collapse:collapse" )
|
97
99
|
end
|
98
100
|
|
99
|
-
def
|
101
|
+
def example_table_parse(node, out)
|
100
102
|
out.table **example_table_attr(node) do |t|
|
101
103
|
t.tr do |tr|
|
102
104
|
tr.td **EXAMPLE_TBL_ATTR do |td|
|
@@ -109,6 +111,10 @@ module IsoDoc::Function
|
|
109
111
|
end
|
110
112
|
end
|
111
113
|
|
114
|
+
def example_parse(node, out)
|
115
|
+
example_div_parse(node, out)
|
116
|
+
end
|
117
|
+
|
112
118
|
def sourcecode_name_parse(_node, div, name)
|
113
119
|
div.p **{ class: "FigureTitle", align: "center" } do |p|
|
114
120
|
name.children.each { |n| parse(n, p) }
|
@@ -223,7 +229,8 @@ module IsoDoc::Function
|
|
223
229
|
def image_parse(node, out, caption)
|
224
230
|
attrs = { src: node["src"],
|
225
231
|
height: node["height"] || "auto",
|
226
|
-
width: node["width"] || "auto"
|
232
|
+
width: node["width"] || "auto",
|
233
|
+
alt: node["alt"] }
|
227
234
|
out.img **attr_code(attrs)
|
228
235
|
image_title_parse(out, caption)
|
229
236
|
end
|
@@ -212,7 +212,7 @@ module IsoDoc::HtmlFunction
|
|
212
212
|
end
|
213
213
|
|
214
214
|
def move_image1(i)
|
215
|
-
matched = /\.(?<suffix
|
215
|
+
matched = /\.(?<suffix>[^. \r\n\t]+)$/.match i["src"]
|
216
216
|
uuid = UUIDTools::UUID.random_create.to_s
|
217
217
|
fname = "#{uuid}.#{matched[:suffix]}"
|
218
218
|
new_full_filename = File.join(tmpimagedir, fname)
|
data/lib/isodoc/metadata.rb
CHANGED
@@ -32,7 +32,45 @@ module IsoDoc
|
|
32
32
|
@metadata[key] = value
|
33
33
|
end
|
34
34
|
|
35
|
+
def extract_person_names(authors)
|
36
|
+
ret = []
|
37
|
+
authors.each do |a|
|
38
|
+
if a.at(ns("./name/completename"))
|
39
|
+
ret << a.at(ns("./name/completename")).text
|
40
|
+
else
|
41
|
+
fn = []
|
42
|
+
forenames = a.xpath(ns("./name/forename"))
|
43
|
+
forenames.each { |f| fn << f.text }
|
44
|
+
surname = a&.at(ns("./name/surname"))&.text
|
45
|
+
ret << fn.join(" ") + " " + surname
|
46
|
+
end
|
47
|
+
end
|
48
|
+
ret
|
49
|
+
end
|
50
|
+
|
51
|
+
def extract_person_names_affiliations(authors)
|
52
|
+
names = extract_person_names(authors)
|
53
|
+
affils = []
|
54
|
+
authors.each do |a|
|
55
|
+
affils << (a&.at(ns("./affiliation/org/name"))&.text || "")
|
56
|
+
end
|
57
|
+
ret = {}
|
58
|
+
affils.each_with_index do |a, i|
|
59
|
+
ret[a] ||= []
|
60
|
+
ret[a] << names[i]
|
61
|
+
end
|
62
|
+
ret
|
63
|
+
end
|
64
|
+
|
65
|
+
def personal_authors(isoxml)
|
66
|
+
authors = isoxml.xpath(ns("//bibdata/contributor[role/@type = 'author' "\
|
67
|
+
"or xmlns:role/@type = 'editor']/person"))
|
68
|
+
set(:authors, extract_person_names(authors))
|
69
|
+
set(:authors_affiliations, extract_person_names_affiliations(authors))
|
70
|
+
end
|
71
|
+
|
35
72
|
def author(xml, _out)
|
73
|
+
personal_authors(xml)
|
36
74
|
tc(xml)
|
37
75
|
sc(xml)
|
38
76
|
wg(xml)
|
@@ -121,7 +159,7 @@ module IsoDoc
|
|
121
159
|
end
|
122
160
|
|
123
161
|
def unpublished(status)
|
124
|
-
status.downcase == "published"
|
162
|
+
!(status.downcase == "published")
|
125
163
|
end
|
126
164
|
|
127
165
|
def status_print(status)
|
@@ -169,11 +207,11 @@ module IsoDoc
|
|
169
207
|
end
|
170
208
|
|
171
209
|
def url(xml, _out)
|
172
|
-
a = xml.at(ns("//bibdata/
|
173
|
-
a = xml.at(ns("//bibdata/
|
174
|
-
a = xml.at(ns("//bibdata/
|
175
|
-
a = xml.at(ns("//bibdata/
|
176
|
-
a = xml.at(ns("//bibdata/
|
210
|
+
a = xml.at(ns("//bibdata/uri[not(@type)]")) and set(:url, a.text)
|
211
|
+
a = xml.at(ns("//bibdata/uri[@type = 'html']")) and set(:html, a.text)
|
212
|
+
a = xml.at(ns("//bibdata/uri[@type = 'xml']")) and set(:xml, a.text)
|
213
|
+
a = xml.at(ns("//bibdata/uri[@type = 'pdf']")) and set(:pdf, a.text)
|
214
|
+
a = xml.at(ns("//bibdata/uri[@type = 'doc']")) and set(:doc, a.text)
|
177
215
|
end
|
178
216
|
end
|
179
217
|
end
|
data/lib/isodoc/pdf_convert.rb
CHANGED
@@ -27,7 +27,7 @@ module IsoDoc
|
|
27
27
|
return result if debug
|
28
28
|
postprocess(result, filename, dir)
|
29
29
|
FileUtils.rm_rf dir
|
30
|
-
::Metanorma::Output::Pdf.new.convert(filename
|
30
|
+
::Metanorma::Output::Pdf.new.convert("#{filename}.html", outname_html + ".pdf")
|
31
31
|
FileUtils.rm_r ["#{filename}.html", tmpimagedir]
|
32
32
|
end
|
33
33
|
|
data/lib/isodoc/version.rb
CHANGED
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -228,7 +228,7 @@ INPUT
|
|
228
228
|
<preface><foreword>
|
229
229
|
<figure id="figureA-1">
|
230
230
|
<name>Split-it-right <em>sample</em> divider</name>
|
231
|
-
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
|
231
|
+
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG" alt="alttext"/>
|
232
232
|
<image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
|
233
233
|
<image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
|
234
234
|
<fn reference="a">
|
@@ -252,7 +252,7 @@ B</pre>
|
|
252
252
|
<h1 class="ForewordTitle">Foreword</h1>
|
253
253
|
<div id="figureA-1" class="figure">
|
254
254
|
|
255
|
-
<img src="rice_images/rice_image1.png" height="20" width="30"/>
|
255
|
+
<img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext"/>
|
256
256
|
<img src="rice_images/rice_image1.png" height="20" width="auto"/>
|
257
257
|
<img src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto"/>
|
258
258
|
<a href="#_" class="TableFootnoteRef">a</a><aside class="footnote"><div id="fn:_"><a id="_" class="TableFootnoteRef">a  </a>
|
@@ -347,14 +347,10 @@ B</pre>
|
|
347
347
|
<br/>
|
348
348
|
<div>
|
349
349
|
<h1 class="ForewordTitle">Foreword</h1>
|
350
|
-
<
|
351
|
-
|
352
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE</td>
|
353
|
-
<td valign="top" class="example">
|
350
|
+
<div id="samplecode" class="example">
|
351
|
+
<p class="example-title">EXAMPLE</p>
|
354
352
|
<p>Hello</p>
|
355
|
-
|
356
|
-
</tr>
|
357
|
-
</table>
|
353
|
+
</div>
|
358
354
|
</div>
|
359
355
|
<p class="zzSTDTitle1"/>
|
360
356
|
</div>
|
@@ -381,22 +377,14 @@ B</pre>
|
|
381
377
|
<br/>
|
382
378
|
<div>
|
383
379
|
<h1 class="ForewordTitle">Foreword</h1>
|
384
|
-
<
|
385
|
-
|
386
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 1</td>
|
387
|
-
<td valign="top" class="example">
|
380
|
+
<div id="samplecode" class="example">
|
381
|
+
<p class="example-title">EXAMPLE 1</p>
|
388
382
|
<p>Hello</p>
|
389
|
-
|
390
|
-
|
391
|
-
</
|
392
|
-
<table id="samplecode2" class="example" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
|
393
|
-
<tr>
|
394
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 2</td>
|
395
|
-
<td valign="top" class="example">
|
383
|
+
</div>
|
384
|
+
<div id="samplecode2" class="example">
|
385
|
+
<p class="example-title">EXAMPLE 2</p>
|
396
386
|
<p>Hello</p>
|
397
|
-
</
|
398
|
-
</tr>
|
399
|
-
</table>
|
387
|
+
</div>
|
400
388
|
</div>
|
401
389
|
<p class="zzSTDTitle1"/>
|
402
390
|
</div>
|
@@ -12,11 +12,11 @@ RSpec.describe IsoDoc do
|
|
12
12
|
<bibdata type="international-standard">
|
13
13
|
<title>The Incredible Mr Ripley</title>
|
14
14
|
<title language="en">Cereals and pulses</title>
|
15
|
-
<
|
16
|
-
<
|
17
|
-
<
|
18
|
-
<
|
19
|
-
<
|
15
|
+
<uri>URL A</uri>
|
16
|
+
<uri type="html">URL B</uri>
|
17
|
+
<uri type="xml">URL C</uri>
|
18
|
+
<uri type="pdf">URL D</uri>
|
19
|
+
<uri type="doc">URL E</uri>
|
20
20
|
<docidentifier>17301-1</docidentifier>
|
21
21
|
<docnumber>17301</docnumber>
|
22
22
|
<date type="published"><on>2011</on></date>
|
@@ -35,6 +35,26 @@ RSpec.describe IsoDoc do
|
|
35
35
|
<organization>
|
36
36
|
<abbreviation>ISO</abbreviation>
|
37
37
|
</organization>
|
38
|
+
</contributor>
|
39
|
+
<contributor>
|
40
|
+
<role type="editor"/>
|
41
|
+
<person>
|
42
|
+
<name>
|
43
|
+
<forename>Barney</forename>
|
44
|
+
<surname>Rubble</surname>
|
45
|
+
</name>
|
46
|
+
<affiliation>
|
47
|
+
<org><name>Bedrock Inc.</name></org>
|
48
|
+
</affiliation>
|
49
|
+
</person>
|
50
|
+
</contributor>
|
51
|
+
<contributor>
|
52
|
+
<role type="author"/>
|
53
|
+
<person>
|
54
|
+
<name>
|
55
|
+
<completename>Fred Flintstone</completename>
|
56
|
+
</name>
|
57
|
+
</person>
|
38
58
|
</contributor>
|
39
59
|
<language>en</language>
|
40
60
|
<script>Latn</script>
|
@@ -60,7 +80,7 @@ RSpec.describe IsoDoc do
|
|
60
80
|
</version>
|
61
81
|
</iso-standard>
|
62
82
|
INPUT
|
63
|
-
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010–2011", :doc=>"URL E", :docnumber=>"17301-1", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :html=>"URL B", :ics=>"XXX", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :pdf=>"URL D", :publisheddate=>"2011", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :status=>"Committee draft", :tc=>"TC 34", :unpublished=>
|
83
|
+
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Bedrock Inc."=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :confirmeddate=>"XXX", :createddate=>"2010–2011", :doc=>"URL E", :docnumber=>"17301-1", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :html=>"URL B", :ics=>"XXX", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :pdf=>"URL D", :publisheddate=>"2011", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :status=>"Committee draft", :tc=>"TC 34", :unpublished=>true, :updateddate=>"XXX", :url=>"URL A", :wg=>"WG 3", :xml=>"URL C"}
|
64
84
|
OUTPUT
|
65
85
|
end
|
66
86
|
|
@@ -123,7 +143,7 @@ OUTPUT
|
|
123
143
|
</version>
|
124
144
|
</iso-standard>
|
125
145
|
INPUT
|
126
|
-
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :status=>"Published", :tc=>"ABC 34", :unpublished=>
|
146
|
+
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :status=>"Published", :tc=>"ABC 34", :unpublished=>false, :updateddate=>"XXX", :wg=>"GHI 3"}
|
127
147
|
OUTPUT
|
128
148
|
end
|
129
149
|
|
@@ -262,49 +262,6 @@ RSpec.describe IsoDoc do
|
|
262
262
|
OUTPUT
|
263
263
|
end
|
264
264
|
|
265
|
-
it "inserts default paragraph between two tables for Word" do
|
266
|
-
FileUtils.rm_f "test.doc"
|
267
|
-
FileUtils.rm_f "test.html"
|
268
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
269
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
270
|
-
<annex id="P" inline-header="false" obligation="normative">
|
271
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
|
272
|
-
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
273
|
-
</example>
|
274
|
-
<example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
|
275
|
-
<p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
276
|
-
</example>
|
277
|
-
</annex>
|
278
|
-
</iso-standard>
|
279
|
-
INPUT
|
280
|
-
word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
|
281
|
-
sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
|
282
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
283
|
-
<div class="WordSection3">
|
284
|
-
<p class="zzSTDTitle1"></p>
|
285
|
-
<p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
286
|
-
<div class="Section3"><a name="P" id="P"></a>
|
287
|
-
<table class="example" cellspacing="0" cellpadding="0" 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-collapse:collapse;"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
|
288
|
-
<tr>
|
289
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 1</td>
|
290
|
-
<td valign="top" class="example">
|
291
|
-
<p class="example"><a name="_158d4efa-b1c9-4aec-b325-756de8e4c968" id="_158d4efa-b1c9-4aec-b325-756de8e4c968"></a>'1M', '01M', and '0001M' all describe the calendar month January.</p>
|
292
|
-
</td>
|
293
|
-
</tr>
|
294
|
-
</table><p style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:0.0pt;margin-bottom:.0001pt;line-height:1.0pt;mso-line-height-rule:exactly" class="MsoNormal"><span lang="EN-GB" style="display:none;mso-hide:all" xml:lang="EN-GB"> </span></p>
|
295
|
-
<table class="example" cellspacing="0" cellpadding="0" 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-collapse:collapse;"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
|
296
|
-
<tr>
|
297
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 2</td>
|
298
|
-
<td valign="top" class="example">
|
299
|
-
<p class="example"><a name="_158d4efa-b1c9-4aec-b325-756de8e4c969" id="_158d4efa-b1c9-4aec-b325-756de8e4c969"></a>'2M', '02M', and '0002M' all describe the calendar month February.</p>
|
300
|
-
</td>
|
301
|
-
</tr>
|
302
|
-
</table>
|
303
|
-
</div>
|
304
|
-
</div>
|
305
|
-
OUTPUT
|
306
|
-
end
|
307
|
-
|
308
265
|
it "populates Word template with terms reference labels" do
|
309
266
|
FileUtils.rm_f "test.doc"
|
310
267
|
FileUtils.rm_f "test.html"
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -68,17 +68,17 @@ RSpec.describe IsoDoc do
|
|
68
68
|
<p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
69
69
|
|
70
70
|
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
71
|
-
<
|
71
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p class="example-title">EXAMPLE 1</p>
|
72
72
|
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
73
73
|
<ul>
|
74
74
|
<li>A</li>
|
75
75
|
</ul>
|
76
|
-
</
|
77
|
-
<
|
76
|
+
</div>
|
77
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p class="example-title">EXAMPLE 2</p>
|
78
78
|
<ul>
|
79
79
|
<li>A</li>
|
80
80
|
</ul>
|
81
|
-
</
|
81
|
+
</div>
|
82
82
|
|
83
83
|
<p>[TERMREF]
|
84
84
|
<a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
|
@@ -87,11 +87,11 @@ RSpec.describe IsoDoc do
|
|
87
87
|
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
88
88
|
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
89
89
|
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
90
|
-
<
|
90
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p class="example-title">EXAMPLE</p>
|
91
91
|
<ul>
|
92
92
|
<li>A</li>
|
93
93
|
</ul>
|
94
|
-
</
|
94
|
+
</div>
|
95
95
|
<div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
|
96
96
|
<div class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
|
97
97
|
<p>[TERMREF]
|
@@ -171,17 +171,17 @@ OUTPUT
|
|
171
171
|
<p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
172
172
|
|
173
173
|
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
174
|
-
<
|
174
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p class="example-title">EXAMPLE 1</p>
|
175
175
|
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
176
176
|
<ul>
|
177
177
|
<li>A</li>
|
178
178
|
</ul>
|
179
|
-
</
|
180
|
-
<
|
179
|
+
</div>
|
180
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p class="example-title">EXAMPLE 2</p>
|
181
181
|
<ul>
|
182
182
|
<li>A</li>
|
183
183
|
</ul>
|
184
|
-
</
|
184
|
+
</div>
|
185
185
|
|
186
186
|
<p>[TERMREF]
|
187
187
|
<a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
|
@@ -190,11 +190,11 @@ OUTPUT
|
|
190
190
|
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
191
191
|
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
192
192
|
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
193
|
-
<
|
193
|
+
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p class="example-title">EXAMPLE</p>
|
194
194
|
<ul>
|
195
195
|
<li>A</li>
|
196
196
|
</ul>
|
197
|
-
</
|
197
|
+
</div>
|
198
198
|
<div class="Note"><p class="Note">Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
|
199
199
|
<div class="Note"><p class="Note">Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
|
200
200
|
<p>[TERMREF]
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -553,31 +553,21 @@ RSpec.describe IsoDoc do
|
|
553
553
|
<br/>
|
554
554
|
<div class="Section3" id="intro">
|
555
555
|
<h1 class="IntroTitle">Introduction</h1>
|
556
|
-
<
|
557
|
-
<tr>
|
558
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE</td>
|
559
|
-
<td valign="top" class="example">
|
556
|
+
<div id="N1" class="example"><p class="example-title">EXAMPLE</p>
|
560
557
|
<p>Hello</p>
|
561
|
-
</
|
562
|
-
</tr>
|
563
|
-
</table>
|
558
|
+
</div>
|
564
559
|
<div id="xyz"><h2>Preparatory</h2>
|
565
|
-
<
|
560
|
+
<div id="N2" class="example"><p class="example-title">EXAMPLE</p>
|
566
561
|
<p>Hello</p>
|
567
|
-
</
|
562
|
+
</div>
|
568
563
|
</div>
|
569
564
|
</div>
|
570
565
|
<p class="zzSTDTitle1"/>
|
571
566
|
<div id="scope">
|
572
567
|
<h1>1.  Scope</h1>
|
573
|
-
|
574
|
-
<tr>
|
575
|
-
<td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE</td>
|
576
|
-
<td valign="top" class="example">
|
568
|
+
<div id="N" class="example"><p class="example-title">EXAMPLE</p>
|
577
569
|
<p>Hello</p>
|
578
|
-
|
579
|
-
</tr>
|
580
|
-
</table>
|
570
|
+
</div>
|
581
571
|
<p>
|
582
572
|
<a href="#N">Example</a>
|
583
573
|
</p>
|
@@ -596,29 +586,29 @@ RSpec.describe IsoDoc do
|
|
596
586
|
<div id="widgets">
|
597
587
|
<h1>3.  Widgets</h1>
|
598
588
|
<div id="widgets1"><h2>3.1. </h2>
|
599
|
-
<
|
589
|
+
<div id="note1" class="example"><p class="example-title">EXAMPLE 1</p>
|
600
590
|
<p>Hello</p>
|
601
|
-
</
|
602
|
-
<
|
591
|
+
</div>
|
592
|
+
<div id="note2" class="example"><p class="example-title">EXAMPLE 2</p>
|
603
593
|
<p>Hello</p>
|
604
|
-
</
|
594
|
+
</div>
|
605
595
|
<p> <a href="#note1">Example 1</a> <a href="#note2">Example 2</a> </p>
|
606
596
|
</div>
|
607
597
|
</div>
|
608
598
|
<br/>
|
609
599
|
<div id="annex1" class="Section3">
|
610
600
|
<div id="annex1a"><h2>A.1. </h2>
|
611
|
-
<
|
601
|
+
<div id="AN" class="example"><p class="example-title">EXAMPLE</p>
|
612
602
|
<p>Hello</p>
|
613
|
-
</
|
603
|
+
</div>
|
614
604
|
</div>
|
615
605
|
<div id="annex1b"><h2>A.2. </h2>
|
616
|
-
<
|
606
|
+
<div id="Anote1" class="example"><p class="example-title">EXAMPLE 1</p>
|
617
607
|
<p>Hello</p>
|
618
|
-
</
|
619
|
-
<
|
608
|
+
</div>
|
609
|
+
<div id="Anote2" class="example"><p class="example-title">EXAMPLE 2</p>
|
620
610
|
<p>Hello</p>
|
621
|
-
</
|
611
|
+
</div>
|
622
612
|
</div>
|
623
613
|
</div>
|
624
614
|
</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: 0.9.
|
4
|
+
version: 0.9.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: 2019-01-
|
11
|
+
date: 2019-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ruby-xslt
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|