isodoc 1.2.8 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +15 -1
- data/isodoc.gemspec +1 -1
- data/lib/isodoc-yaml/i18n-en.yaml +55 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +56 -0
- data/lib/isodoc/base_style/blocks.scss +2 -2
- data/lib/isodoc/base_style/typography.scss +1 -1
- data/lib/isodoc/convert.rb +13 -85
- data/lib/isodoc/css.rb +95 -0
- data/lib/isodoc/function/inline_simple.rb +10 -1
- data/lib/isodoc/function/lists.rb +2 -1
- data/lib/isodoc/function/references.rb +7 -12
- data/lib/isodoc/function/section.rb +1 -1
- data/lib/isodoc/function/table.rb +10 -0
- data/lib/isodoc/function/to_word_html.rb +4 -2
- data/lib/isodoc/function/utils.rb +2 -2
- data/lib/isodoc/gem_tasks.rb +4 -0
- data/lib/isodoc/html_function/html.rb +7 -0
- data/lib/isodoc/html_function/mathvariant_to_plain.rb +82 -0
- data/lib/isodoc/html_function/postprocess.rb +43 -22
- data/lib/isodoc/metadata_contributor.rb +4 -3
- data/lib/isodoc/presentation_function/bibdata.rb +3 -3
- data/lib/isodoc/presentation_function/inline.rb +5 -3
- data/lib/isodoc/presentation_function/section.rb +9 -0
- data/lib/isodoc/presentation_xml_convert.rb +2 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +0 -20
- data/lib/isodoc/word_function/inline.rb +2 -2
- data/lib/isodoc/word_function/postprocess.rb +38 -80
- data/lib/isodoc/word_function/postprocess_cover.rb +55 -0
- data/lib/isodoc/word_function/table.rb +10 -0
- data/lib/isodoc/xref.rb +1 -0
- data/lib/isodoc/xref/xref_counter.rb +63 -20
- data/lib/isodoc/xref/xref_gen.rb +20 -2
- data/lib/isodoc/xref/xref_sect_gen.rb +34 -27
- data/spec/assets/html.scss +14 -0
- data/spec/isodoc/blocks_spec.rb +26 -73
- data/spec/isodoc/cleanup_spec.rb +0 -1
- data/spec/isodoc/inline_spec.rb +14 -14
- data/spec/isodoc/lists_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +3 -1
- data/spec/isodoc/postproc_spec.rb +473 -11
- data/spec/isodoc/presentation_xml_spec.rb +2 -2
- data/spec/isodoc/ref_spec.rb +323 -5
- data/spec/isodoc/table_spec.rb +28 -0
- data/spec/isodoc/xref_spec.rb +472 -19
- metadata +6 -4
data/lib/isodoc/xref/xref_gen.rb
CHANGED
@@ -66,6 +66,10 @@ module IsoDoc::XrefGen
|
|
66
66
|
"//sections/clause | //sections/definitions | "\
|
67
67
|
"//bibliography/references | //bibliography/clause".freeze
|
68
68
|
|
69
|
+
def sections_xpath
|
70
|
+
SECTIONS_XPATH
|
71
|
+
end
|
72
|
+
|
69
73
|
CHILD_NOTES_XPATH =
|
70
74
|
"./*[not(self::xmlns:clause) and not(self::xmlns:appendix) and "\
|
71
75
|
"not(self::xmlns:terms) and not(self::xmlns:definitions)]//xmlns:note | "\
|
@@ -123,9 +127,9 @@ module IsoDoc::XrefGen
|
|
123
127
|
end
|
124
128
|
|
125
129
|
def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
|
126
|
-
c = Counter.new
|
130
|
+
c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
|
127
131
|
list.xpath(ns("./li")).each do |li|
|
128
|
-
label = c.increment(li).listlabel(depth)
|
132
|
+
label = c.increment(li).listlabel(list, depth)
|
129
133
|
label = "#{prev_label}.#{label}" unless prev_label.empty?
|
130
134
|
label = "#{list_anchor[:xref]} #{label}" if refer_list
|
131
135
|
li["id"] and @anchors[li["id"]] =
|
@@ -136,5 +140,19 @@ module IsoDoc::XrefGen
|
|
136
140
|
end
|
137
141
|
end
|
138
142
|
end
|
143
|
+
|
144
|
+
def bookmark_anchor_names(sections)
|
145
|
+
sections.each do |s|
|
146
|
+
notes = s.xpath(ns(".//bookmark")) - s.xpath(ns(".//clause//bookmark")) -
|
147
|
+
s.xpath(ns(".//appendix//bookmark"))
|
148
|
+
notes.each do |n|
|
149
|
+
next if n["id"].nil? || n["id"].empty?
|
150
|
+
@anchors[n["id"]] = {
|
151
|
+
type: "bookmark", label: nil, value: nil,
|
152
|
+
xref: @anchors[s["id"]][:xref] }
|
153
|
+
end
|
154
|
+
bookmark_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
155
|
+
end
|
156
|
+
end
|
139
157
|
end
|
140
158
|
end
|
@@ -1,23 +1,25 @@
|
|
1
1
|
module IsoDoc::XrefGen
|
2
2
|
module Sections
|
3
3
|
def back_anchor_names(docxml)
|
4
|
-
|
5
|
-
|
4
|
+
i = Counter.new("@")
|
5
|
+
docxml.xpath(ns("//annex")).each do |c|
|
6
|
+
i.increment(c)
|
7
|
+
annex_names(c, i.print)
|
8
|
+
end
|
9
|
+
docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
|
10
|
+
preface_names(b)
|
11
|
+
end
|
12
|
+
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
13
|
+
reference_names(ref)
|
6
14
|
end
|
7
|
-
docxml.xpath(
|
8
|
-
ns(@klass.bibliography_xpath)).each do |b|
|
9
|
-
preface_names(b)
|
10
|
-
end
|
11
|
-
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
12
|
-
reference_names(ref)
|
13
|
-
end
|
14
15
|
end
|
15
16
|
|
16
17
|
def initial_anchor_names(d)
|
17
18
|
d.xpath(ns("//preface/*")).each { |c| c.element? and preface_names(c) }
|
18
19
|
# potentially overridden in middle_section_asset_names()
|
19
20
|
sequential_asset_names(d.xpath(ns("//preface/*")))
|
20
|
-
n =
|
21
|
+
n = Counter.new
|
22
|
+
n = section_names(d.at(ns("//clause[@type = 'scope']")), n, 1)
|
21
23
|
n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
|
22
24
|
n = section_names(d.at(ns("//sections/terms | "\
|
23
25
|
"//sections/clause[descendant::terms]")), n, 1)
|
@@ -52,8 +54,7 @@ module IsoDoc::XrefGen
|
|
52
54
|
label = title || parent_title
|
53
55
|
@anchors[clause["id"]] =
|
54
56
|
{ label: nil, level: level, xref: label, type: "clause" }
|
55
|
-
clause.xpath(ns(SUBCLAUSES)).
|
56
|
-
each_with_index do |c, i|
|
57
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
57
58
|
preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i+1}",
|
58
59
|
level + 1)
|
59
60
|
end
|
@@ -67,21 +68,22 @@ module IsoDoc::XrefGen
|
|
67
68
|
sequential_asset_names(d.xpath(ns(middle_sections)))
|
68
69
|
end
|
69
70
|
|
70
|
-
def clause_names(docxml,
|
71
|
-
docxml.xpath(ns(@klass.middle_clause)).each_with_index do |c, i|
|
72
|
-
section_names(c,
|
71
|
+
def clause_names(docxml, n)
|
72
|
+
docxml.xpath(ns(@klass.middle_clause(docxml))).each_with_index do |c, i|
|
73
|
+
section_names(c, n, 1)
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
77
|
def section_names(clause, num, lvl)
|
77
78
|
return num if clause.nil?
|
78
|
-
num
|
79
|
+
num.increment(clause)
|
79
80
|
@anchors[clause["id"]] =
|
80
|
-
{ label: num.
|
81
|
+
{ label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"), level: lvl,
|
81
82
|
type: "clause" }
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
i = Counter.new
|
84
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
85
|
+
i.increment(c)
|
86
|
+
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
85
87
|
end
|
86
88
|
num
|
87
89
|
end
|
@@ -90,9 +92,10 @@ module IsoDoc::XrefGen
|
|
90
92
|
@anchors[clause["id"]] =
|
91
93
|
{ label: num, level: level, xref: l10n("#{@labels["clause"]} #{num}"),
|
92
94
|
type: "clause" }
|
93
|
-
|
94
|
-
|
95
|
-
|
95
|
+
i = Counter.new
|
96
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
97
|
+
i.increment(c)
|
98
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
96
99
|
end
|
97
100
|
end
|
98
101
|
|
@@ -118,8 +121,10 @@ module IsoDoc::XrefGen
|
|
118
121
|
if a = single_annex_special_section(clause)
|
119
122
|
annex_names1(a, "#{num}", 1)
|
120
123
|
else
|
121
|
-
|
122
|
-
|
124
|
+
i = Counter.new
|
125
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
126
|
+
i.increment(c)
|
127
|
+
annex_names1(c, "#{num}.#{i.print}", 2)
|
123
128
|
end
|
124
129
|
end
|
125
130
|
hierarchical_asset_names(clause, num)
|
@@ -128,8 +133,10 @@ module IsoDoc::XrefGen
|
|
128
133
|
def annex_names1(clause, num, level)
|
129
134
|
@anchors[clause["id"]] = { label: num, xref: "#{@labels["annex"]} #{num}",
|
130
135
|
level: level, type: "clause" }
|
131
|
-
|
132
|
-
|
136
|
+
i = Counter.new
|
137
|
+
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c|
|
138
|
+
i.increment(c)
|
139
|
+
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
133
140
|
end
|
134
141
|
end
|
135
142
|
|
data/spec/assets/html.scss
CHANGED
@@ -3,4 +3,18 @@
|
|
3
3
|
|
4
4
|
p {
|
5
5
|
font-family: $bodyfont;
|
6
|
+
font-size: $normalfontsize;
|
7
|
+
}
|
8
|
+
code {
|
9
|
+
font-family: $monospacefont;
|
10
|
+
font-size: $monospacefontsize;
|
11
|
+
}
|
12
|
+
aside {
|
13
|
+
font-size: $footnotefontsize;
|
14
|
+
}
|
15
|
+
h1 {
|
16
|
+
font-family: $headerfont;
|
17
|
+
}
|
18
|
+
p.note {
|
19
|
+
font-size: $smallerfontsize;
|
6
20
|
}
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -534,7 +534,7 @@ INPUT
|
|
534
534
|
<div>
|
535
535
|
<h1 class='ForewordTitle'>Foreword</h1>
|
536
536
|
<p id='A'>
|
537
|
-
ABC
|
537
|
+
ABC
|
538
538
|
<div id='B' class='Note'>
|
539
539
|
<p>
|
540
540
|
<span class='note_label'>NOTE 1</span>
|
@@ -611,8 +611,8 @@ INPUT
|
|
611
611
|
OUTPUT
|
612
612
|
end
|
613
613
|
|
614
|
-
it "processes figures
|
615
|
-
|
614
|
+
it "processes figures" do
|
615
|
+
input = <<~INPUT
|
616
616
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
617
617
|
<preface><foreword>
|
618
618
|
<figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
|
@@ -620,6 +620,7 @@ OUTPUT
|
|
620
620
|
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
|
621
621
|
<image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
|
622
622
|
<image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
|
623
|
+
<image src="data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="application/xml"/>
|
623
624
|
<fn reference="a">
|
624
625
|
<p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p>
|
625
626
|
</fn>
|
@@ -629,16 +630,18 @@ OUTPUT
|
|
629
630
|
</dl>
|
630
631
|
</figure>
|
631
632
|
<figure id="figure-B">
|
632
|
-
<pre alt="A B">A
|
633
|
+
<pre alt="A B">A <
|
633
634
|
B</pre>
|
634
635
|
</figure>
|
635
636
|
<figure id="figure-C" unnumbered="true">
|
636
|
-
<pre>A
|
637
|
+
<pre>A <
|
637
638
|
B</pre>
|
638
639
|
</figure>
|
639
640
|
</foreword></preface>
|
640
641
|
</iso-standard>
|
641
642
|
INPUT
|
643
|
+
|
644
|
+
presxml = <<~OUTPUT
|
642
645
|
<?xml version='1.0'?>
|
643
646
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
644
647
|
<preface><foreword>
|
@@ -647,6 +650,7 @@ B</pre>
|
|
647
650
|
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
|
648
651
|
<image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
|
649
652
|
<image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
|
653
|
+
<image src='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==' height='20' width='auto' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f2' mimetype='application/xml'/>
|
650
654
|
<fn reference="a">
|
651
655
|
<p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p>
|
652
656
|
</fn>
|
@@ -657,47 +661,18 @@ B</pre>
|
|
657
661
|
</figure>
|
658
662
|
<figure id="figure-B">
|
659
663
|
<name>Figure 2</name>
|
660
|
-
<pre alt="A B">A
|
664
|
+
<pre alt="A B">A <
|
661
665
|
B</pre>
|
662
666
|
</figure>
|
663
667
|
<figure id="figure-C" unnumbered="true">
|
664
|
-
<pre>A
|
668
|
+
<pre>A <
|
665
669
|
B</pre>
|
666
670
|
</figure>
|
667
671
|
</foreword></preface>
|
668
672
|
</iso-standard>
|
669
673
|
OUTPUT
|
670
|
-
end
|
671
674
|
|
672
|
-
|
673
|
-
expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
674
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
675
|
-
<preface><foreword>
|
676
|
-
<figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
|
677
|
-
<name>Figure 1 — Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
|
678
|
-
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
|
679
|
-
<image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
|
680
|
-
<image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
|
681
|
-
<fn reference="a">
|
682
|
-
<p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p>
|
683
|
-
</fn>
|
684
|
-
<dl>
|
685
|
-
<dt>A</dt>
|
686
|
-
<dd><p>B</p></dd>
|
687
|
-
</dl>
|
688
|
-
</figure>
|
689
|
-
<figure id="figure-B">
|
690
|
-
<name>Figure 2</name>
|
691
|
-
<pre alt="A B">A <
|
692
|
-
B</pre>
|
693
|
-
</figure>
|
694
|
-
<figure id="figure-C" unnumbered="true">
|
695
|
-
<pre>A <
|
696
|
-
B</pre>
|
697
|
-
</figure>
|
698
|
-
</foreword></preface>
|
699
|
-
</iso-standard>
|
700
|
-
INPUT
|
675
|
+
html = <<~OUTPUT
|
701
676
|
#{HTML_HDR}
|
702
677
|
<br/>
|
703
678
|
<div>
|
@@ -707,6 +682,7 @@ B</pre>
|
|
707
682
|
<img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletxt"/>
|
708
683
|
<img src="rice_images/rice_image1.png" height="20" width="auto"/>
|
709
684
|
<img src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto"/>
|
685
|
+
<img src='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==' height='20' width='auto'/>
|
710
686
|
<a href="#_" class="TableFootnoteRef">a</a><aside class="footnote"><div id="fn:_"><span><span id="_" class="TableFootnoteRef">a</span>  </span>
|
711
687
|
<p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
|
712
688
|
</div></aside>
|
@@ -717,12 +693,12 @@ B</pre>
|
|
717
693
|
</a>
|
718
694
|
</p></div>
|
719
695
|
<div class="figure" id="figure-B">
|
720
|
-
<pre>A
|
696
|
+
<pre>A <
|
721
697
|
B</pre>
|
722
698
|
<p class="FigureTitle" style="text-align:center;">Figure 2</p>
|
723
699
|
</div>
|
724
700
|
<div class="figure" id="figure-C">
|
725
|
-
<pre>A
|
701
|
+
<pre>A <
|
726
702
|
B</pre>
|
727
703
|
</div>
|
728
704
|
</div>
|
@@ -734,38 +710,8 @@ B</pre>
|
|
734
710
|
</body>
|
735
711
|
</html>
|
736
712
|
OUTPUT
|
737
|
-
end
|
738
713
|
|
739
|
-
|
740
|
-
FileUtils.rm_rf "spec/assets/odf1.emf"
|
741
|
-
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/['"][^'".]+\.gif['"]/, "'_.gif'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
742
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
743
|
-
<preface><foreword>
|
744
|
-
<figure id="figureA-1" keep-with-next="true" keep-lines-together="true">
|
745
|
-
<name>Figure 1 — Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
|
746
|
-
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
|
747
|
-
<image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
|
748
|
-
<image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
|
749
|
-
<fn reference="a">
|
750
|
-
<p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p>
|
751
|
-
</fn>
|
752
|
-
<dl>
|
753
|
-
<dt>A</dt>
|
754
|
-
<dd><p>B</p></dd>
|
755
|
-
</dl>
|
756
|
-
</figure>
|
757
|
-
<figure id="figure-B">
|
758
|
-
<name>Figure 2</name>
|
759
|
-
<pre alt="A B">A <
|
760
|
-
B</pre>
|
761
|
-
</figure>
|
762
|
-
<figure id="figure-C" unnumbered="true">
|
763
|
-
<pre>A <
|
764
|
-
B</pre>
|
765
|
-
</figure>
|
766
|
-
</foreword></preface>
|
767
|
-
</iso-standard>
|
768
|
-
INPUT
|
714
|
+
word = <<~OUTPUT
|
769
715
|
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
770
716
|
<head><style/></head>
|
771
717
|
<body lang="EN-US" link="blue" vlink="#954F72">
|
@@ -781,6 +727,7 @@ B</pre>
|
|
781
727
|
<img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletxt"/>
|
782
728
|
<img src="rice_images/rice_image1.png" height='20' width='auto'/>
|
783
729
|
<img src='_.gif' height='20' width='auto'/>
|
730
|
+
<img src='_.xml' height='20' width='auto'/>
|
784
731
|
<a href="#_" class="TableFootnoteRef">a</a><aside><div id="ftn_"><span><span id="_" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">  </span></span>
|
785
732
|
<p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
|
786
733
|
</div></aside>
|
@@ -795,12 +742,12 @@ B</pre>
|
|
795
742
|
</p>
|
796
743
|
</div>
|
797
744
|
<div class="figure" id="figure-B">
|
798
|
-
<pre>A
|
745
|
+
<pre>A <
|
799
746
|
B</pre>
|
800
747
|
<p class="FigureTitle" style="text-align:center;">Figure 2</p>
|
801
748
|
</div>
|
802
749
|
<div id='figure-C' class='figure'>
|
803
|
-
<pre>A
|
750
|
+
<pre>A < B</pre>
|
804
751
|
</div>
|
805
752
|
</div>
|
806
753
|
<p> </p>
|
@@ -815,17 +762,22 @@ B</pre>
|
|
815
762
|
</body>
|
816
763
|
</html>
|
817
764
|
OUTPUT
|
765
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).gsub(/\</, "<"))).to be_equivalent_to xmlpp(presxml)
|
766
|
+
expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
|
767
|
+
FileUtils.rm_rf "spec/assets/odf1.emf"
|
768
|
+
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", presxml, true).gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(word)
|
818
769
|
end
|
819
770
|
|
820
771
|
it "converts SVG (Word)" do
|
821
772
|
FileUtils.rm_rf "spec/assets/odf1.emf"
|
822
|
-
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
773
|
+
expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'").gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
823
774
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
824
775
|
<preface><foreword>
|
825
776
|
<figure id="figureA-1">
|
826
777
|
<image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
|
827
778
|
<image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
|
828
779
|
<image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
|
780
|
+
<image src="data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="application/xml"/>
|
829
781
|
</figure>
|
830
782
|
</foreword></preface>
|
831
783
|
</iso-standard>
|
@@ -852,6 +804,7 @@ B</pre>
|
|
852
804
|
<img src='spec/assets/odf.emf'/>
|
853
805
|
<img src='spec/assets/odf1.emf'/>
|
854
806
|
<img src='_.emf' height='auto' width='auto'/>
|
807
|
+
<img src='_.xml' height='20' width='auto'/>
|
855
808
|
</div>
|
856
809
|
</div>
|
857
810
|
<p> </p>
|
data/spec/isodoc/cleanup_spec.rb
CHANGED
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -43,14 +43,14 @@ INPUT
|
|
43
43
|
OUTPUT
|
44
44
|
end
|
45
45
|
|
46
|
-
it "processes inline formatting" do
|
46
|
+
it "processes inline formatting (HTML)" do
|
47
47
|
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
48
48
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
49
49
|
<preface><foreword>
|
50
50
|
<p>
|
51
51
|
<em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
52
52
|
<strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
|
53
|
-
<bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/>
|
53
|
+
<bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
|
54
54
|
</p>
|
55
55
|
</foreword></preface>
|
56
56
|
<sections>
|
@@ -64,6 +64,7 @@ OUTPUT
|
|
64
64
|
<i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
65
65
|
<s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
|
66
66
|
<a id="H"/> <br/> <br/>
|
67
|
+
<span style='text-decoration: underline;'>J</span>
|
67
68
|
</p>
|
68
69
|
</div>
|
69
70
|
<p class="zzSTDTitle1"/>
|
@@ -80,7 +81,7 @@ OUTPUT
|
|
80
81
|
<p>
|
81
82
|
<em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
82
83
|
<strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
|
83
|
-
<bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/>
|
84
|
+
<bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
|
84
85
|
</p>
|
85
86
|
</clause></sections>
|
86
87
|
</iso-standard>
|
@@ -107,6 +108,7 @@ OUTPUT
|
|
107
108
|
<p>
|
108
109
|
<br clear='all' class='section' orientation='landscape'/>
|
109
110
|
</p>
|
111
|
+
<u>J</u>
|
110
112
|
</p>
|
111
113
|
</div>
|
112
114
|
</div>
|
@@ -117,7 +119,7 @@ OUTPUT
|
|
117
119
|
end
|
118
120
|
|
119
121
|
it "ignores index entries" do
|
120
|
-
expect(xmlpp(IsoDoc::
|
122
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
121
123
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
122
124
|
<preface><foreword>
|
123
125
|
<p><index primary="A" secondary="B" tertiary="C"/></p>
|
@@ -125,16 +127,14 @@ OUTPUT
|
|
125
127
|
<sections>
|
126
128
|
</iso-standard>
|
127
129
|
INPUT
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
</body>
|
137
|
-
</html>
|
130
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
131
|
+
<preface>
|
132
|
+
<foreword>
|
133
|
+
<p/>
|
134
|
+
</foreword>
|
135
|
+
</preface>
|
136
|
+
<sections> </sections>
|
137
|
+
</iso-standard>
|
138
138
|
OUTPUT
|
139
139
|
end
|
140
140
|
|