isodoc 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +41 -19
- data/lib/isodoc/convert.rb +2 -5
- data/lib/isodoc/version.rb +1 -1
- data/spec/isodoc/blocks_spec.rb +18 -18
- data/spec/isodoc/footnotes_spec.rb +4 -4
- data/spec/isodoc/i18n_spec.rb +4 -4
- data/spec/isodoc/inline_spec.rb +7 -7
- data/spec/isodoc/iso_spec.rb +5 -5
- data/spec/isodoc/lists_spec.rb +5 -5
- data/spec/isodoc/postproc_spec.rb +34 -14
- data/spec/isodoc/ref_spec.rb +2 -2
- data/spec/isodoc/section_spec.rb +7 -7
- data/spec/isodoc/table_spec.rb +2 -2
- data/spec/isodoc/terms_spec.rb +1 -1
- data/spec/isodoc/xref_spec.rb +11 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20de1f2b7084af74fa5e07dd9d21052070c0cb0c
|
4
|
+
data.tar.gz: f0a33338a94281fcd77c4c0c2c09ba075a168db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3ba4475aad7370d08dbb82125824181ce72aff52fcfabbdf04573b33de614424f3774e26e1baca1fdc8751312ed0905ca0eaff09ec53e3697c0178ef8b8614a
|
7
|
+
data.tar.gz: bb14792e1617a7ef072d797042c538ebbfb3a678af20966edd8b531b747b24e03d42ae65bf15498b584db9c23948b52d1b0bcde16943597da8ba90aed469aef1
|
data/README.adoc
CHANGED
@@ -7,31 +7,53 @@ image:https://codeclimate.com/github/riboseinc/isodoc/badges/gpa.svg["Code Clima
|
|
7
7
|
|
8
8
|
This Gem converts documents in the https://github.com/riboseinc/isodoc-models[ISODoc document model] into HTML and Microsoft Word.
|
9
9
|
|
10
|
-
The Gem
|
10
|
+
The Gem contains two classes, `IsoDoc::Convert` (for HTML output) and `IsoDoc::WordConvert` (for Word output). They are initialised with the following rendering parameters:
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
i18nyaml:: YAML file giving internationalisation equivalents for keywords in rendering output; see https://github.com/riboseinc/asciidoctor-iso#document-attributes for further documentation
|
13
|
+
bodyfont:: Font for body text
|
14
|
+
headerfont:: Font for header text
|
15
|
+
monospacefont:: Font for monospace text
|
16
|
+
titlefont:: Font for document title text (currently used only in GB)
|
17
|
+
script:: The ISO 15924 code for the main script that the standard document is in; used to pick the default fonts for the document
|
18
|
+
alt:: Generate alternate rendering (currently used only in ISO)
|
19
|
+
|
20
|
+
The IsoDoc gem classes themselves are abstract (though their current implementation contains rendering specific to the ISO standard.) Subclasses of the Isodoc gem classes are specific to different standards, and are associated with templates and stylesheets speciific to the rendering of those standards. Subclasses also provide the default values for the rendering parameters above; they should be used only as overrides.
|
20
21
|
|
21
22
|
e.g.
|
22
23
|
|
23
24
|
[source,ruby]
|
24
25
|
--
|
25
|
-
IsoDoc::Convert.new(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
htmlintropage: html_doc_path("iso_intro.html"),
|
33
|
-
wordintropage: html_doc_path("iso_intro.html"),
|
26
|
+
IsoDoc::Convert::Iso.new(
|
27
|
+
bodyfont: "Zapf Chancery",
|
28
|
+
headerfont: "Comic Sans",
|
29
|
+
monospacefont: "Andale Mono",
|
30
|
+
alt: true,
|
31
|
+
script: "Hans",
|
32
|
+
i18nyaml: "i18n-en.yaml"
|
34
33
|
)
|
35
34
|
--
|
36
35
|
|
37
|
-
|
36
|
+
The conversion takes place with a `convert` method, with three arguments: the filename to be used for the output (once its file type suffix is stripped), the XML document string to be converted (optional), and a "debug" argument (optional), which stops execution before the output file is generated. If the document string is nil, its contents are read in from the filename provided. So:
|
37
|
+
|
38
|
+
[source,ruby]
|
39
|
+
--
|
40
|
+
IsoDoc::Iso::Convert.new({}).convert("test.xml") # generates test.html
|
41
|
+
|
42
|
+
IsoDoc::Iso::WordConvert.new({script: "Hans"}).convert("test.xml") # generates test.doc, with Chinese font defaults rather than Roman
|
43
|
+
|
44
|
+
IsoDoc::Iso::Convert.new({}).convert("test", File.read("file1.xml")) # generates test.html, based on file1.xml
|
45
|
+
|
46
|
+
IsoDoc::Iso::Convert.new({}).convert("test", <<~"INPUT", true)
|
47
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
48
|
+
<preface><foreword>
|
49
|
+
<note>
|
50
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a
|
51
|
+
study carried out on three different types of kernel.</p>
|
52
|
+
</note>
|
53
|
+
</foreword></preface>
|
54
|
+
</iso-standard>
|
55
|
+
INPUT
|
56
|
+
# generates HTML output for the given input string, but does not save it to disk.
|
57
|
+
--
|
58
|
+
|
59
|
+
NOTE: In the HTML stylesheets specific to standards, the Cover page and Intro page must be XHTML fragments, not HTML fragments. In particular, unlike Word HTML, all HTML attributes need to be quoted: `<p class="MsoToc2">`, not `<p class=MsoToc2>`.
|
data/lib/isodoc/convert.rb
CHANGED
@@ -100,11 +100,8 @@ module IsoDoc
|
|
100
100
|
[docxml, filename, dir]
|
101
101
|
end
|
102
102
|
|
103
|
-
def convert(filename, debug = false)
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
def convert_file(file, filename, debug)
|
103
|
+
def convert(filename, file = nil, debug = false)
|
104
|
+
file = File.read(filename, encoding: "utf-8") if file.nil?
|
108
105
|
@openmathdelim, @closemathdelim = extract_delims(file)
|
109
106
|
docxml, filename, dir = convert_init(file, filename, debug)
|
110
107
|
result = convert1(docxml, filename, dir)
|
data/lib/isodoc/version.rb
CHANGED
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes unlabelled notes" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
8
|
<note>
|
@@ -27,7 +27,7 @@ RSpec.describe IsoDoc do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "processes labelled notes" do
|
30
|
-
expect(IsoDoc::Convert.new({}).
|
30
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
31
31
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
32
32
|
<preface><foreword>
|
33
33
|
<note id="note1">
|
@@ -52,7 +52,7 @@ INPUT
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "processes sequences of notes" do
|
55
|
-
expect(IsoDoc::Convert.new({}).
|
55
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
56
56
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
57
57
|
<preface><foreword>
|
58
58
|
<note id="note1">
|
@@ -83,7 +83,7 @@ INPUT
|
|
83
83
|
end
|
84
84
|
|
85
85
|
it "processes multi-para notes" do
|
86
|
-
expect(IsoDoc::Convert.new({}).
|
86
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
87
87
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
88
88
|
<preface><foreword>
|
89
89
|
<note>
|
@@ -110,7 +110,7 @@ INPUT
|
|
110
110
|
end
|
111
111
|
|
112
112
|
it "processes non-para notes" do
|
113
|
-
expect(IsoDoc::Convert.new({}).
|
113
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
114
114
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
115
115
|
<preface><foreword>
|
116
116
|
<note>
|
@@ -143,7 +143,7 @@ INPUT
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "processes figures" do
|
146
|
-
expect(strip_guid(IsoDoc::Convert.new({}).
|
146
|
+
expect(strip_guid(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to <<~"OUTPUT"
|
147
147
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
148
148
|
<preface><foreword>
|
149
149
|
<figure id="figureA-1">
|
@@ -181,7 +181,7 @@ INPUT
|
|
181
181
|
end
|
182
182
|
|
183
183
|
it "processes figures (Word)" do
|
184
|
-
expect(strip_guid(IsoDoc::WordConvert.new({}).
|
184
|
+
expect(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to <<~"OUTPUT"
|
185
185
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
186
186
|
<preface><foreword>
|
187
187
|
<figure id="figureA-1">
|
@@ -232,7 +232,7 @@ INPUT
|
|
232
232
|
end
|
233
233
|
|
234
234
|
it "processes examples" do
|
235
|
-
expect(IsoDoc::Convert.new({}).
|
235
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
236
236
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
237
237
|
<preface><foreword>
|
238
238
|
<example id="samplecode">
|
@@ -263,7 +263,7 @@ INPUT
|
|
263
263
|
|
264
264
|
|
265
265
|
it "processes sequences of examples" do
|
266
|
-
expect(IsoDoc::Convert.new({}).
|
266
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
267
267
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
268
268
|
<preface><foreword>
|
269
269
|
<example id="samplecode">
|
@@ -304,7 +304,7 @@ INPUT
|
|
304
304
|
end
|
305
305
|
|
306
306
|
it "processes sourcecode" do
|
307
|
-
expect(IsoDoc::Convert.new({}).
|
307
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
308
308
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
309
309
|
<preface><foreword>
|
310
310
|
<sourcecode id="samplecode">
|
@@ -328,7 +328,7 @@ INPUT
|
|
328
328
|
end
|
329
329
|
|
330
330
|
it "processes sourcecode with escapes preserved" do
|
331
|
-
expect(IsoDoc::Convert.new({}).
|
331
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
332
332
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
333
333
|
<preface><foreword>
|
334
334
|
<sourcecode id="samplecode">
|
@@ -352,7 +352,7 @@ INPUT
|
|
352
352
|
end
|
353
353
|
|
354
354
|
it "processes sourcecode with annotations" do
|
355
|
-
expect(IsoDoc::Convert.new({}).
|
355
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
356
356
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
357
357
|
<preface><foreword>
|
358
358
|
<sourcecode id="_">puts "Hello, world." <callout target="A">1</callout>
|
@@ -384,7 +384,7 @@ INPUT
|
|
384
384
|
end
|
385
385
|
|
386
386
|
it "processes admonitions" do
|
387
|
-
expect(IsoDoc::Convert.new({}).
|
387
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
388
388
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
389
389
|
<preface><foreword>
|
390
390
|
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
|
@@ -409,7 +409,7 @@ INPUT
|
|
409
409
|
end
|
410
410
|
|
411
411
|
it "processes formulae" do
|
412
|
-
expect(IsoDoc::Convert.new({}).
|
412
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
413
413
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
414
414
|
<preface><foreword>
|
415
415
|
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181934">
|
@@ -448,7 +448,7 @@ INPUT
|
|
448
448
|
end
|
449
449
|
|
450
450
|
it "processes paragraph alignments" do
|
451
|
-
expect(IsoDoc::Convert.new({}).
|
451
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
452
452
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
453
453
|
<preface><foreword>
|
454
454
|
<p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
|
@@ -476,7 +476,7 @@ World</p>
|
|
476
476
|
end
|
477
477
|
|
478
478
|
it "processes paragraph alignments (Word)" do
|
479
|
-
expect(IsoDoc::WordConvert.new({}).
|
479
|
+
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
480
480
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
481
481
|
<preface><foreword>
|
482
482
|
<p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
|
@@ -519,7 +519,7 @@ World</p>
|
|
519
519
|
|
520
520
|
|
521
521
|
it "processes blockquotes" do
|
522
|
-
expect(IsoDoc::Convert.new({}).
|
522
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
523
523
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
524
524
|
<preface><foreword>
|
525
525
|
<quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
|
@@ -549,7 +549,7 @@ World</p>
|
|
549
549
|
end
|
550
550
|
|
551
551
|
it "processes term domains" do
|
552
|
-
expect(IsoDoc::Convert.new({}).
|
552
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
553
553
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
554
554
|
<sections>
|
555
555
|
<terms>
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML footnotes" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword>
|
@@ -41,7 +41,7 @@ RSpec.describe IsoDoc do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "processes IsoXML footnotes (Word)" do
|
44
|
-
expect(IsoDoc::WordConvert.new({}).
|
44
|
+
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
45
45
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
46
46
|
<preface>
|
47
47
|
<foreword>
|
@@ -94,7 +94,7 @@ RSpec.describe IsoDoc do
|
|
94
94
|
|
95
95
|
it "processes IsoXML reviewer notes" do
|
96
96
|
system "rm -f test.html"
|
97
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
97
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
98
98
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
99
99
|
<preface>
|
100
100
|
<foreword>
|
@@ -189,7 +189,7 @@ RSpec.describe IsoDoc do
|
|
189
189
|
|
190
190
|
it "processes IsoXML reviewer notes (Word)" do
|
191
191
|
system "rm -f test.doc"
|
192
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
192
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
193
193
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
194
194
|
<preface>
|
195
195
|
<foreword>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes English" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<bibdata>
|
8
8
|
<language>en</language>
|
@@ -159,7 +159,7 @@ RSpec.describe IsoDoc do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
it "defaults to English" do
|
162
|
-
expect(IsoDoc::Convert.new({}).
|
162
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
163
163
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
164
164
|
<bibdata>
|
165
165
|
<language>tlh</language>
|
@@ -316,7 +316,7 @@ RSpec.describe IsoDoc do
|
|
316
316
|
end
|
317
317
|
|
318
318
|
it "processes French" do
|
319
|
-
expect(IsoDoc::Convert.new({}).
|
319
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
320
320
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
321
321
|
<bibdata>
|
322
322
|
<language>fr</language>
|
@@ -472,7 +472,7 @@ RSpec.describe IsoDoc do
|
|
472
472
|
end
|
473
473
|
|
474
474
|
it "processes Simplified Chinese" do
|
475
|
-
expect(IsoDoc::Convert.new({}).
|
475
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
476
476
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
477
477
|
<bibdata>
|
478
478
|
<language>zh</language>
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes inline formatting" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
8
|
<p>
|
@@ -32,7 +32,7 @@ RSpec.describe IsoDoc do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "processes links" do
|
35
|
-
expect(IsoDoc::Convert.new({}).
|
35
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
36
36
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
37
37
|
<preface><foreword>
|
38
38
|
<p>
|
@@ -60,7 +60,7 @@ RSpec.describe IsoDoc do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "processes unrecognised markup" do
|
63
|
-
expect(IsoDoc::Convert.new({}).
|
63
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
64
64
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
65
65
|
<preface><foreword>
|
66
66
|
<p>
|
@@ -86,7 +86,7 @@ RSpec.describe IsoDoc do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "processes AsciiMath and MathML" do
|
89
|
-
expect(IsoDoc::Convert.new({}).
|
89
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
90
90
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
91
91
|
<preface><foreword>
|
92
92
|
<p>
|
@@ -118,7 +118,7 @@ RSpec.describe IsoDoc do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "overrides AsciiMath delimiters" do
|
121
|
-
expect(IsoDoc::Convert.new({}).
|
121
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
122
122
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
123
123
|
<preface><foreword>
|
124
124
|
<p>
|
@@ -146,7 +146,7 @@ RSpec.describe IsoDoc do
|
|
146
146
|
end
|
147
147
|
|
148
148
|
it "processes eref types" do
|
149
|
-
expect(IsoDoc::Convert.new({}).
|
149
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
150
150
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
151
151
|
<preface><foreword>
|
152
152
|
<p>
|
@@ -191,7 +191,7 @@ RSpec.describe IsoDoc do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it "processes eref content" do
|
194
|
-
expect(IsoDoc::Convert.new({}).
|
194
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
195
195
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
196
196
|
<preface><foreword>
|
197
197
|
<p>
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
system "rm -f test.html"
|
5
5
|
it "processes isodoc as ISO: HTML output" do
|
6
|
-
IsoDoc::Iso::Convert.new({}).
|
6
|
+
IsoDoc::Iso::Convert.new({}).convert("test", <<~"INPUT", false)
|
7
7
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
8
8
|
<preface><foreword>
|
9
9
|
<note>
|
@@ -20,7 +20,7 @@ RSpec.describe IsoDoc do
|
|
20
20
|
|
21
21
|
it "processes isodoc as ISO: alt HTML output" do
|
22
22
|
system "rm -f test.html"
|
23
|
-
IsoDoc::Iso::Convert.new({alt: true}).
|
23
|
+
IsoDoc::Iso::Convert.new({alt: true}).convert("test", <<~"INPUT", false)
|
24
24
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
25
25
|
<preface><foreword>
|
26
26
|
<note>
|
@@ -37,7 +37,7 @@ RSpec.describe IsoDoc do
|
|
37
37
|
|
38
38
|
it "processes isodoc as ISO: Chinese HTML output" do
|
39
39
|
system "rm -f test.html"
|
40
|
-
IsoDoc::Iso::Convert.new({script: "Hans"}).
|
40
|
+
IsoDoc::Iso::Convert.new({script: "Hans"}).convert("test", <<~"INPUT", false)
|
41
41
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
42
42
|
<preface><foreword>
|
43
43
|
<note>
|
@@ -54,7 +54,7 @@ RSpec.describe IsoDoc do
|
|
54
54
|
|
55
55
|
it "processes isodoc as ISO: user nominated fonts" do
|
56
56
|
system "rm -f test.html"
|
57
|
-
IsoDoc::Iso::Convert.new({bodyfont: "Zapf Chancery", headerfont: "Comic Sans", monospacefont: "Andale Mono"}).
|
57
|
+
IsoDoc::Iso::Convert.new({bodyfont: "Zapf Chancery", headerfont: "Comic Sans", monospacefont: "Andale Mono"}).convert("test", <<~"INPUT", false)
|
58
58
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
59
59
|
<preface><foreword>
|
60
60
|
<note>
|
@@ -71,7 +71,7 @@ RSpec.describe IsoDoc do
|
|
71
71
|
|
72
72
|
it "processes isodoc as ISO: Word output" do
|
73
73
|
system "rm -f test.doc"
|
74
|
-
IsoDoc::Iso::WordConvert.new({}).
|
74
|
+
IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", false)
|
75
75
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
76
76
|
<preface><foreword>
|
77
77
|
<note>
|
data/spec/isodoc/lists_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes unordered lists" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
8
|
<ul id="_61961034-0fb1-436b-b281-828857a59ddb">
|
@@ -37,7 +37,7 @@ RSpec.describe IsoDoc do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "processes ordered lists" do
|
40
|
-
expect(IsoDoc::Convert.new({}).
|
40
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
41
41
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
42
42
|
<preface><foreword>
|
43
43
|
<ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet">
|
@@ -86,7 +86,7 @@ RSpec.describe IsoDoc do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "processes Roman Upper ordered lists" do
|
89
|
-
expect(IsoDoc::Convert.new({}).
|
89
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
90
90
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
91
91
|
<preface><foreword>
|
92
92
|
<ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
|
@@ -127,7 +127,7 @@ RSpec.describe IsoDoc do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it "processes definition lists" do
|
130
|
-
expect(IsoDoc::Convert.new({}).
|
130
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
131
131
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
132
132
|
<preface><foreword>
|
133
133
|
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
|
@@ -176,7 +176,7 @@ RSpec.describe IsoDoc do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it "processes definition lists (Word)" do
|
179
|
-
expect(IsoDoc::WordConvert.new({}).
|
179
|
+
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
180
180
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
181
181
|
<preface><foreword>
|
182
182
|
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
|
@@ -1,10 +1,30 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
|
+
it "generates file based on string input" do
|
5
|
+
system "rm -f test.doc"
|
6
|
+
system "rm -f test.html"
|
7
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
|
8
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
9
|
+
<preface><foreword>
|
10
|
+
<note>
|
11
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
12
|
+
</note>
|
13
|
+
</foreword></preface>
|
14
|
+
</iso-standard>
|
15
|
+
INPUT
|
16
|
+
expect(File.exist?("test.html")).to be true
|
17
|
+
html = File.read("test.html")
|
18
|
+
expect(html).to match(%r{<title>test</title><style>})
|
19
|
+
expect(html).to match(/another empty stylesheet/)
|
20
|
+
expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/2\.7\.1/MathJax\.js})
|
21
|
+
expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
|
22
|
+
end
|
23
|
+
|
4
24
|
it "generates HTML output docs with null configuration" do
|
5
25
|
system "rm -f test.doc"
|
6
26
|
system "rm -f test.html"
|
7
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
27
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
8
28
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
9
29
|
<preface><foreword>
|
10
30
|
<note>
|
@@ -24,7 +44,7 @@ RSpec.describe IsoDoc do
|
|
24
44
|
it "generates Word output docs with null configuration" do
|
25
45
|
system "rm -f test.doc"
|
26
46
|
system "rm -f test.html"
|
27
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
47
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
28
48
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
29
49
|
<preface><foreword>
|
30
50
|
<note>
|
@@ -41,7 +61,7 @@ RSpec.describe IsoDoc do
|
|
41
61
|
it "generates HTML output docs with null configuration from file" do
|
42
62
|
system "rm -f spec/assets/iso.doc"
|
43
63
|
system "rm -f spec/assets/iso.html"
|
44
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", false)
|
64
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
|
45
65
|
expect(File.exist?("spec/assets/iso.html")).to be true
|
46
66
|
html = File.read("spec/assets/iso.html")
|
47
67
|
expect(html).to match(/another empty stylesheet/)
|
@@ -51,7 +71,7 @@ RSpec.describe IsoDoc do
|
|
51
71
|
|
52
72
|
it "generates Word output docs with null configuration from file" do
|
53
73
|
system "rm -f spec/assets/iso.doc"
|
54
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", false)
|
74
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
|
55
75
|
expect(File.exist?("spec/assets/iso.doc")).to be true
|
56
76
|
word = File.read("spec/assets/iso.doc")
|
57
77
|
expect(word).to match(/one empty stylesheet/)
|
@@ -60,7 +80,7 @@ RSpec.describe IsoDoc do
|
|
60
80
|
it "generates HTML output docs with complete configuration" do
|
61
81
|
system "rm -f test.doc"
|
62
82
|
system "rm -f test.html"
|
63
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).
|
83
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
|
64
84
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
65
85
|
<preface><foreword>
|
66
86
|
<note>
|
@@ -81,7 +101,7 @@ RSpec.describe IsoDoc do
|
|
81
101
|
it "generates Word output docs with complete configuration" do
|
82
102
|
system "rm -f test.doc"
|
83
103
|
system "rm -f test.html"
|
84
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).
|
104
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
|
85
105
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
86
106
|
<preface><foreword>
|
87
107
|
<note>
|
@@ -102,7 +122,7 @@ RSpec.describe IsoDoc do
|
|
102
122
|
it "converts definition lists to tables for Word" do
|
103
123
|
system "rm -f test.doc"
|
104
124
|
system "rm -f test.html"
|
105
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
125
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
106
126
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
107
127
|
<preface><foreword>
|
108
128
|
<dl>
|
@@ -144,7 +164,7 @@ RSpec.describe IsoDoc do
|
|
144
164
|
it "converts annex subheadings to h2Annex class for Word" do
|
145
165
|
system "rm -f test.doc"
|
146
166
|
system "rm -f test.html"
|
147
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
167
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
148
168
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
149
169
|
<annex id="P" inline-header="false" obligation="normative">
|
150
170
|
<title>Annex</title>
|
@@ -179,7 +199,7 @@ RSpec.describe IsoDoc do
|
|
179
199
|
it "populates Word template with terms reference labels" do
|
180
200
|
system "rm -f test.doc"
|
181
201
|
system "rm -f test.html"
|
182
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
202
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
183
203
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
184
204
|
<sections>
|
185
205
|
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
@@ -223,7 +243,7 @@ RSpec.describe IsoDoc do
|
|
223
243
|
|
224
244
|
it "populates Word header" do
|
225
245
|
system "rm -f test.doc"
|
226
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", header: "spec/assets/header.html"}).
|
246
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", header: "spec/assets/header.html"}).convert("test", <<~"INPUT", false)
|
227
247
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
228
248
|
<bibdata type="article">
|
229
249
|
<docidentifier>
|
@@ -249,7 +269,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
|
|
249
269
|
|
250
270
|
it "populates Word ToC" do
|
251
271
|
system "rm -f test.doc"
|
252
|
-
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).
|
272
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
|
253
273
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
254
274
|
<sections>
|
255
275
|
<clause inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
@@ -328,7 +348,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
|
|
328
348
|
|
329
349
|
it "reorders footnote numbers in HTML" do
|
330
350
|
system "rm -f test.html"
|
331
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).
|
351
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
|
332
352
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
333
353
|
<sections>
|
334
354
|
<clause inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
|
@@ -383,7 +403,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
|
|
383
403
|
it "moves images in HTML" do
|
384
404
|
system "rm -f test.html"
|
385
405
|
system "rm -rf _images"
|
386
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
406
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
387
407
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
388
408
|
<preface><foreword>
|
389
409
|
<figure id="_">
|
@@ -415,7 +435,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
|
|
415
435
|
it "processes IsoXML terms for HTML" do
|
416
436
|
system "rm -f test.doc"
|
417
437
|
system "rm -f test.html"
|
418
|
-
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).
|
438
|
+
IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
419
439
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
420
440
|
<sections>
|
421
441
|
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML bibliographies" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
8
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
|
@@ -112,7 +112,7 @@ RSpec.describe IsoDoc do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it "processes empty IsoXML Normative References" do
|
115
|
-
expect(IsoDoc::Convert.new({}).
|
115
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
116
116
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
117
117
|
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
118
118
|
</references>
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes section names" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword obligation="informative">
|
@@ -157,7 +157,7 @@ OUTPUT
|
|
157
157
|
end
|
158
158
|
|
159
159
|
it "processes section names (Word)" do
|
160
|
-
expect(IsoDoc::WordConvert.new({}).
|
160
|
+
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
161
161
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
162
162
|
<preface>
|
163
163
|
<foreword obligation="informative">
|
@@ -326,7 +326,7 @@ OUTPUT
|
|
326
326
|
end
|
327
327
|
|
328
328
|
it "processes simple terms & definitions" do
|
329
|
-
expect(IsoDoc::Convert.new({}).
|
329
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
330
330
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
331
331
|
<sections>
|
332
332
|
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
@@ -373,7 +373,7 @@ OUTPUT
|
|
373
373
|
end
|
374
374
|
|
375
375
|
it "processes terms & definitions with external source" do
|
376
|
-
expect(IsoDoc::Convert.new({}).
|
376
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
377
377
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
378
378
|
<termdocsource type="inline" bibitemid="ISO712"/>
|
379
379
|
<sections>
|
@@ -439,7 +439,7 @@ OUTPUT
|
|
439
439
|
end
|
440
440
|
|
441
441
|
it "processes empty terms & definitions with external source" do
|
442
|
-
expect(IsoDoc::Convert.new({}).
|
442
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
443
443
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
444
444
|
<termdocsource type="inline" bibitemid="ISO712"/>
|
445
445
|
<termdocsource type="inline" bibitemid="ISO712"/>
|
@@ -503,7 +503,7 @@ OUTPUT
|
|
503
503
|
|
504
504
|
|
505
505
|
it "processes empty terms & definitions" do
|
506
|
-
expect(IsoDoc::Convert.new({}).
|
506
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
507
507
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
508
508
|
<sections>
|
509
509
|
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
@@ -544,7 +544,7 @@ OUTPUT
|
|
544
544
|
end
|
545
545
|
|
546
546
|
it "processes inline section headers" do
|
547
|
-
expect(IsoDoc::Convert.new({}).
|
547
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
548
548
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
549
549
|
<sections>
|
550
550
|
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
data/spec/isodoc/table_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML tables" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword>
|
@@ -123,7 +123,7 @@ RSpec.describe IsoDoc do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it "processes IsoXML tables (Word)" do
|
126
|
-
expect(IsoDoc::WordConvert.new({}).
|
126
|
+
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
127
127
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
128
128
|
<preface>
|
129
129
|
<foreword>
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML terms" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<sections>
|
8
8
|
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "cross-references notes" do
|
5
|
-
expect(IsoDoc::Convert.new({}).
|
5
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)). to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword>
|
@@ -115,7 +115,7 @@ RSpec.describe IsoDoc do
|
|
115
115
|
end
|
116
116
|
|
117
117
|
it "cross-references figures" do
|
118
|
-
expect(IsoDoc::Convert.new({}).
|
118
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
119
119
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
120
120
|
<preface>
|
121
121
|
<foreword id="fwd">
|
@@ -247,7 +247,7 @@ RSpec.describe IsoDoc do
|
|
247
247
|
end
|
248
248
|
|
249
249
|
it "cross-references subfigures" do
|
250
|
-
expect(IsoDoc::Convert.new({}).
|
250
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
251
251
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
252
252
|
<preface>
|
253
253
|
<foreword id="fwd">
|
@@ -367,7 +367,7 @@ RSpec.describe IsoDoc do
|
|
367
367
|
end
|
368
368
|
|
369
369
|
it "cross-references examples" do
|
370
|
-
expect(IsoDoc::Convert.new({}).
|
370
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
371
371
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
372
372
|
<preface>
|
373
373
|
<foreword>
|
@@ -492,7 +492,7 @@ RSpec.describe IsoDoc do
|
|
492
492
|
end
|
493
493
|
|
494
494
|
it "cross-references formulae" do
|
495
|
-
expect(IsoDoc::Convert.new({}).
|
495
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
496
496
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
497
497
|
<preface>
|
498
498
|
<foreword>
|
@@ -614,7 +614,7 @@ RSpec.describe IsoDoc do
|
|
614
614
|
end
|
615
615
|
|
616
616
|
it "cross-references tables" do
|
617
|
-
expect(IsoDoc::Convert.new({}).
|
617
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
618
618
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
619
619
|
<preface>
|
620
620
|
<foreword>
|
@@ -775,7 +775,7 @@ RSpec.describe IsoDoc do
|
|
775
775
|
end
|
776
776
|
|
777
777
|
it "cross-references term notes" do
|
778
|
-
expect(IsoDoc::Convert.new({}).
|
778
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
779
779
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
780
780
|
<preface>
|
781
781
|
<foreword>
|
@@ -841,7 +841,7 @@ RSpec.describe IsoDoc do
|
|
841
841
|
end
|
842
842
|
|
843
843
|
it "cross-references sections" do
|
844
|
-
expect(IsoDoc::Convert.new({}).
|
844
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
845
845
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
846
846
|
<preface>
|
847
847
|
<foreword obligation="informative">
|
@@ -1027,7 +1027,7 @@ RSpec.describe IsoDoc do
|
|
1027
1027
|
end
|
1028
1028
|
|
1029
1029
|
it "cross-references lists" do
|
1030
|
-
expect(IsoDoc::Convert.new({}).
|
1030
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
1031
1031
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1032
1032
|
<preface>
|
1033
1033
|
<foreword>
|
@@ -1141,7 +1141,7 @@ RSpec.describe IsoDoc do
|
|
1141
1141
|
end
|
1142
1142
|
|
1143
1143
|
it "cross-references list items" do
|
1144
|
-
expect(IsoDoc::Convert.new({}).
|
1144
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
1145
1145
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1146
1146
|
<preface>
|
1147
1147
|
<foreword>
|
@@ -1255,7 +1255,7 @@ RSpec.describe IsoDoc do
|
|
1255
1255
|
end
|
1256
1256
|
|
1257
1257
|
it "cross-references nested list items" do
|
1258
|
-
expect(IsoDoc::Convert.new({}).
|
1258
|
+
expect(IsoDoc::Convert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
1259
1259
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1260
1260
|
<preface>
|
1261
1261
|
<foreword>
|