isodoc 1.8.1 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/isodoc.gemspec +1 -1
- data/lib/isodoc/class_utils.rb +1 -1
- data/lib/isodoc/function/cleanup.rb +1 -11
- data/lib/isodoc/function/inline.rb +3 -3
- data/lib/isodoc/function/terms.rb +0 -3
- data/lib/isodoc/function/utils.rb +10 -5
- data/lib/isodoc/i18n.rb +31 -10
- data/lib/isodoc/presentation_function/block.rb +2 -3
- data/lib/isodoc/presentation_function/image.rb +2 -2
- data/lib/isodoc/presentation_function/terms.rb +95 -30
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_gen.rb +10 -7
- data/lib/isodoc/xref/xref_gen_seq.rb +159 -148
- data/lib/isodoc/xref/xref_sect_gen.rb +5 -10
- data/lib/isodoc/xref.rb +2 -0
- data/lib/isodoc/xslfo_convert.rb +23 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +3 -0
- data/lib/isodoc-yaml/i18n-de.yaml +3 -0
- data/lib/isodoc-yaml/i18n-en.yaml +8 -5
- data/lib/isodoc-yaml/i18n-es.yaml +3 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +3 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +3 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +3 -0
- data/spec/isodoc/cleanup_spec.rb +0 -129
- data/spec/isodoc/i18n_spec.rb +53 -10
- data/spec/isodoc/inline_spec.rb +33 -43
- data/spec/isodoc/lists_spec.rb +64 -64
- data/spec/isodoc/postproc_spec.rb +0 -73
- data/spec/isodoc/section_spec.rb +12 -12
- data/spec/isodoc/terms_spec.rb +317 -303
- data/spec/isodoc/xref_spec.rb +80 -9
- data/spec/isodoc/xslfo_convert_spec.rb +35 -0
- data/spec/spec_helper.rb +1 -1
- metadata +8 -8
data/spec/isodoc/cleanup_spec.rb
CHANGED
@@ -1053,133 +1053,4 @@ RSpec.describe IsoDoc do
|
|
1053
1053
|
</html>
|
1054
1054
|
OUTPUT
|
1055
1055
|
end
|
1056
|
-
|
1057
|
-
it "cleans up term sources" do
|
1058
|
-
c = IsoDoc::HtmlConvert.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1059
|
-
c.i18n_init("en", "Latn")
|
1060
|
-
expect(xmlpp(c.textcleanup(<<~"INPUT").to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1061
|
-
#{HTML_HDR}
|
1062
|
-
<p class="zzSTDTitle1"/>
|
1063
|
-
<div id="_terms_and_definitions"><h1>1.  Terms and Definitions</h1><p>For the purposes of this document,
|
1064
|
-
the following terms and definitions apply.</p>
|
1065
|
-
<p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
1066
|
-
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
1067
|
-
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p class="example-title">EXAMPLE 1</p>
|
1068
|
-
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
1069
|
-
<ul>
|
1070
|
-
<li>A</li>
|
1071
|
-
</ul>
|
1072
|
-
</div>
|
1073
|
-
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p class="example-title">EXAMPLE 2</p>
|
1074
|
-
<ul>
|
1075
|
-
<li>A</li>
|
1076
|
-
</ul>
|
1077
|
-
</div>
|
1078
|
-
<p>[TERMREF]
|
1079
|
-
<a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
|
1080
|
-
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
1081
|
-
[/TERMREF]</p>
|
1082
|
-
<p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
|
1083
|
-
<p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION] [/TERMREF]</p>
|
1084
|
-
<p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
|
1085
|
-
<p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
|
1086
|
-
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
1087
|
-
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
1088
|
-
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
1089
|
-
<div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p class="example-title">EXAMPLE</p>
|
1090
|
-
<ul>
|
1091
|
-
<li>A</li>
|
1092
|
-
</ul>
|
1093
|
-
</div>
|
1094
|
-
<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>
|
1095
|
-
<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>
|
1096
|
-
<p>[TERMREF]
|
1097
|
-
<a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
|
1098
|
-
[/TERMREF]</p></div>
|
1099
|
-
</div>
|
1100
|
-
</body>
|
1101
|
-
</html>
|
1102
|
-
INPUT
|
1103
|
-
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
1104
|
-
<head/>
|
1105
|
-
<body lang='en'>
|
1106
|
-
<div class='title-section'>
|
1107
|
-
<p> </p>
|
1108
|
-
</div>
|
1109
|
-
<br/>
|
1110
|
-
<div class='prefatory-section'>
|
1111
|
-
<p> </p>
|
1112
|
-
</div>
|
1113
|
-
<br/>
|
1114
|
-
<div class='main-section'>
|
1115
|
-
<p class='zzSTDTitle1'/>
|
1116
|
-
<div id='_terms_and_definitions'>
|
1117
|
-
<h1>1.  Terms and Definitions</h1>
|
1118
|
-
<p>For the purposes of this document, the following terms and definitions apply.</p>
|
1119
|
-
<p class='TermNum' id='paddy1'>1.1.</p>
|
1120
|
-
<p class='Terms' style='text-align:left;'>paddy</p>
|
1121
|
-
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'><rice> rice retaining its husk after threshing</p>
|
1122
|
-
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
|
1123
|
-
<p class='example-title'>EXAMPLE 1</p>
|
1124
|
-
<p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
|
1125
|
-
<ul>
|
1126
|
-
<li>A</li>
|
1127
|
-
</ul>
|
1128
|
-
</div>
|
1129
|
-
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
|
1130
|
-
<p class='example-title'>EXAMPLE 2</p>
|
1131
|
-
<ul>
|
1132
|
-
<li>A</li>
|
1133
|
-
</ul>
|
1134
|
-
</div>
|
1135
|
-
<p>
|
1136
|
-
[SOURCE:
|
1137
|
-
<a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
|
1138
|
-
, modified — The term "cargo rice" is shown as deprecated, and
|
1139
|
-
Note 1 to entry is not included here; Termbase IEV, term ID xyz;
|
1140
|
-
Termbase IEV, term ID xyz, modified; Termbase IEV, term ID xyz,
|
1141
|
-
modified — with adjustments]
|
1142
|
-
</p>
|
1143
|
-
<p class='TermNum' id='paddy'>1.2.</p>
|
1144
|
-
<p class='Terms' style='text-align:left;'>paddy</p>
|
1145
|
-
<p class='AltTerms' style='text-align:left;'>paddy rice</p>
|
1146
|
-
<p class='AltTerms' style='text-align:left;'>rough rice</p>
|
1147
|
-
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
|
1148
|
-
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
1149
|
-
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
|
1150
|
-
<p class='example-title'>EXAMPLE</p>
|
1151
|
-
<ul>
|
1152
|
-
<li>A</li>
|
1153
|
-
</ul>
|
1154
|
-
</div>
|
1155
|
-
<div class='Note'>
|
1156
|
-
<p>
|
1157
|
-
Note 1 to entry: The starch of waxy rice consists almost entirely of
|
1158
|
-
amylopectin. The kernels have a tendency to stick together after
|
1159
|
-
cooking.
|
1160
|
-
</p>
|
1161
|
-
</div>
|
1162
|
-
<div class='Note'>
|
1163
|
-
<p>
|
1164
|
-
Note 2 to entry:
|
1165
|
-
<ul>
|
1166
|
-
<li>A</li>
|
1167
|
-
</ul>
|
1168
|
-
<p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
|
1169
|
-
The starch of waxy rice consists almost entirely of amylopectin.
|
1170
|
-
The kernels have a tendency to stick together after cooking.
|
1171
|
-
</p>
|
1172
|
-
</p>
|
1173
|
-
</div>
|
1174
|
-
<p>
|
1175
|
-
[SOURCE:
|
1176
|
-
<a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
|
1177
|
-
]
|
1178
|
-
</p>
|
1179
|
-
</div>
|
1180
|
-
</div>
|
1181
|
-
</body>
|
1182
|
-
</html>
|
1183
|
-
OUTPUT
|
1184
|
-
end
|
1185
1056
|
end
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -88,7 +88,7 @@ RSpec.describe IsoDoc do
|
|
88
88
|
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
89
89
|
<title depth="2">3.1.<tab/>Normal Terms</title>
|
90
90
|
<term id="J"><name>3.1.1.</name>
|
91
|
-
<preferred>Term2</preferred>
|
91
|
+
<preferred><strong>Term2</strong></preferred>
|
92
92
|
</term>
|
93
93
|
</terms>
|
94
94
|
<definitions id="K"><title>3.2.</title>
|
@@ -159,7 +159,7 @@ RSpec.describe IsoDoc do
|
|
159
159
|
<div id="I">
|
160
160
|
<h2>3.1.  Normal Terms</h2>
|
161
161
|
<p class="TermNum" id="J">3.1.1.</p>
|
162
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
162
|
+
<p class="Terms" style="text-align:left;"><b>Term2</b></p>
|
163
163
|
</div><div id="K"><h2>3.2.</h2>
|
164
164
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
165
165
|
</div></div>
|
@@ -211,7 +211,7 @@ RSpec.describe IsoDoc do
|
|
211
211
|
end
|
212
212
|
|
213
213
|
it "defaults to English" do
|
214
|
-
|
214
|
+
input = <<~INPUT
|
215
215
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
216
216
|
<bibdata>
|
217
217
|
<language>tlh</language>
|
@@ -275,6 +275,7 @@ RSpec.describe IsoDoc do
|
|
275
275
|
</bibliography>
|
276
276
|
</iso-standard>
|
277
277
|
INPUT
|
278
|
+
output = <<~OUTPUT
|
278
279
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
279
280
|
<bibdata>
|
280
281
|
<language current="true">tlh</language>
|
@@ -295,7 +296,7 @@ RSpec.describe IsoDoc do
|
|
295
296
|
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
296
297
|
<title depth="2">3.1.<tab/>Normal Terms</title>
|
297
298
|
<term id="J"><name>3.1.1.</name>
|
298
|
-
<preferred>Term2</preferred>
|
299
|
+
<preferred><strong>Term2</strong></preferred>
|
299
300
|
</term>
|
300
301
|
</terms>
|
301
302
|
<definitions id="K"><title>3.2.</title>
|
@@ -336,6 +337,10 @@ RSpec.describe IsoDoc do
|
|
336
337
|
</bibliography>
|
337
338
|
</iso-standard>
|
338
339
|
OUTPUT
|
340
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
341
|
+
.convert("test", input, true)
|
342
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
343
|
+
.to be_equivalent_to xmlpp(output)
|
339
344
|
end
|
340
345
|
|
341
346
|
it "processes French" do
|
@@ -425,7 +430,7 @@ RSpec.describe IsoDoc do
|
|
425
430
|
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
426
431
|
<title depth="2">3.1.<tab/>Normal Terms</title>
|
427
432
|
<term id="J"><name>3.1.1.</name>
|
428
|
-
<preferred>Term2</preferred>
|
433
|
+
<preferred><strong>Term2</strong></preferred>
|
429
434
|
</term>
|
430
435
|
</terms>
|
431
436
|
<definitions id="K"><title>3.2.</title>
|
@@ -496,7 +501,7 @@ RSpec.describe IsoDoc do
|
|
496
501
|
<div id="I">
|
497
502
|
<h2>3.1.  Normal Terms</h2>
|
498
503
|
<p class="TermNum" id="J">3.1.1.</p>
|
499
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
504
|
+
<p class="Terms" style="text-align:left;"><b>Term2</b></p>
|
500
505
|
</div><div id="K"><h2>3.2.</h2>
|
501
506
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
502
507
|
</div></div>
|
@@ -644,7 +649,7 @@ RSpec.describe IsoDoc do
|
|
644
649
|
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
645
650
|
<title depth="2">3.1.<tab/>Normal Terms</title>
|
646
651
|
<term id="J"><name>3.1.1.</name>
|
647
|
-
<preferred>Term2</preferred>
|
652
|
+
<preferred><strong>Term2</strong></preferred>
|
648
653
|
</term>
|
649
654
|
</terms>
|
650
655
|
<definitions id="K"><title>3.2.</title>
|
@@ -728,7 +733,7 @@ RSpec.describe IsoDoc do
|
|
728
733
|
<div id="I">
|
729
734
|
<h2>3.1. Normal Terms</h2>
|
730
735
|
<p class="TermNum" id="J">3.1.1.</p>
|
731
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
736
|
+
<p class="Terms" style="text-align:left;"><b>Term2</b></p>
|
732
737
|
</div><div id="K"><h2>3.2.</h2>
|
733
738
|
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
734
739
|
</div></div>
|
@@ -896,7 +901,7 @@ RSpec.describe IsoDoc do
|
|
896
901
|
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
897
902
|
<title depth="2">3.1.<tab/>Normal Terms</title>
|
898
903
|
<term id="J"><name>3.1.1.</name>
|
899
|
-
<preferred>Term2</preferred>
|
904
|
+
<preferred><strong>Term2</strong></preferred>
|
900
905
|
</term>
|
901
906
|
</terms>
|
902
907
|
<definitions id="K"><title>3.2.</title>
|
@@ -1002,7 +1007,7 @@ RSpec.describe IsoDoc do
|
|
1002
1007
|
<div id='I'>
|
1003
1008
|
<h2>3.1.  Normal Terms</h2>
|
1004
1009
|
<p class='TermNum' id='J'>3.1.1.</p>
|
1005
|
-
<p class='Terms' style='text-align:left;'>Term2</p>
|
1010
|
+
<p class='Terms' style='text-align:left;'><b>Term2</b></p>
|
1006
1011
|
</div>
|
1007
1012
|
<div id='K'>
|
1008
1013
|
<h2>3.2.</h2>
|
@@ -1077,6 +1082,44 @@ RSpec.describe IsoDoc do
|
|
1077
1082
|
.to be_equivalent_to xmlpp(output)
|
1078
1083
|
end
|
1079
1084
|
|
1085
|
+
it "processes LTR within RTL" do
|
1086
|
+
c = IsoDoc::Convert.new({})
|
1087
|
+
c.convert_init(<<~"INPUT", "test", false)
|
1088
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1089
|
+
<bibdata type="standard">
|
1090
|
+
<language>fa</language>
|
1091
|
+
<script>Arab</script>
|
1092
|
+
</bibdata>
|
1093
|
+
</iso-standard>
|
1094
|
+
INPUT
|
1095
|
+
expect(c.i18n.l10n("hello!", "en", "Latn")).to eq "‎hello!‎"
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
it "processes Hebrew RTL within LTR" do
|
1099
|
+
c = IsoDoc::Convert.new({})
|
1100
|
+
c.convert_init(<<~"INPUT", "test", false)
|
1101
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1102
|
+
<bibdata type="standard">
|
1103
|
+
<language>en</language>
|
1104
|
+
</bibdata>
|
1105
|
+
</iso-standard>
|
1106
|
+
INPUT
|
1107
|
+
expect(c.i18n.l10n("hello!", "he", "Hebr")).to eq "‏hello!‏"
|
1108
|
+
end
|
1109
|
+
|
1110
|
+
it "processes Arabic RTL within LTR" do
|
1111
|
+
c = IsoDoc::Convert.new({})
|
1112
|
+
c.convert_init(<<~"INPUT", "test", false)
|
1113
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1114
|
+
<bibdata type="standard">
|
1115
|
+
<language>en</language>
|
1116
|
+
</bibdata>
|
1117
|
+
</iso-standard>
|
1118
|
+
INPUT
|
1119
|
+
expect(c.i18n.l10n("hello!", "fa", "Arab")).to eq "؜hello!؜"
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
|
1080
1123
|
private
|
1081
1124
|
|
1082
1125
|
def mock_i18n
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -636,11 +636,10 @@ RSpec.describe IsoDoc do
|
|
636
636
|
<expression>
|
637
637
|
<name>Second Term</name>
|
638
638
|
</expression>
|
639
|
+
<field-of-application>Field</field-of-application>
|
640
|
+
<usage-info>Usage Info 1</usage-info>
|
639
641
|
</preferred>
|
640
|
-
<
|
641
|
-
<p id='B'>Usage Info 1.</p>
|
642
|
-
</usageinfo>
|
643
|
-
<definition><verbaldefinition>Definition 1</verbaldefinition></definition>
|
642
|
+
<definition><verbal-definition>Definition 1</verbal-definition></definition>
|
644
643
|
</term>
|
645
644
|
<term id="C">
|
646
645
|
<preferred language='fr' script='Latn' type='prefix'>
|
@@ -658,49 +657,40 @@ RSpec.describe IsoDoc do
|
|
658
657
|
</preferred>
|
659
658
|
<xref target='second'/>
|
660
659
|
</related>
|
661
|
-
<definition><
|
660
|
+
<definition><verbal-definition>Definition 2</verbal-definition></definition>
|
662
661
|
</term>
|
663
662
|
</terms>
|
664
663
|
</sections>
|
665
664
|
</iso-standard>
|
666
665
|
INPUT
|
667
666
|
output = <<~OUTPUT
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
(
|
693
|
-
<xref target='second'>Clause 1.1</xref>
|
694
|
-
)
|
695
|
-
</p>
|
696
|
-
<definition>Definition 2</definition>
|
697
|
-
</term>
|
698
|
-
</terms>
|
699
|
-
</sections>
|
700
|
-
</iso-standard>
|
667
|
+
<?xml version='1.0'?>
|
668
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
669
|
+
<sections>
|
670
|
+
<terms id='A' obligation='normative' displayorder='1'>
|
671
|
+
<title depth='1'>1.<tab/>Terms and definitions</title>
|
672
|
+
<term id='second'>
|
673
|
+
<name>1.1.</name>
|
674
|
+
<preferred><strong>Second Term</strong>, <Field, Usage Info 1></preferred>
|
675
|
+
<definition>Definition 1</definition>
|
676
|
+
</term>
|
677
|
+
<term id='C'>
|
678
|
+
<name>1.2.</name>
|
679
|
+
<preferred language='fr' script='Latn' type='prefix'><strong>First Designation</strong></preferred>
|
680
|
+
<p>
|
681
|
+
<strong>CONTRAST:</strong>
|
682
|
+
<em>
|
683
|
+
<preferred><strong>Fifth Designation</strong>, n</preferred>
|
684
|
+
</em> (<xref target='second'>Clause 1.1</xref>)
|
685
|
+
</p>
|
686
|
+
<definition>Definition 2</definition>
|
687
|
+
</term>
|
688
|
+
</terms>
|
689
|
+
</sections>
|
690
|
+
</iso-standard>
|
701
691
|
OUTPUT
|
702
|
-
|
703
|
-
|
692
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
693
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
704
694
|
end
|
705
695
|
|
706
696
|
it "processes embedded inline formatting" do
|
@@ -802,9 +792,9 @@ RSpec.describe IsoDoc do
|
|
802
792
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
803
793
|
<preface><foreword>
|
804
794
|
<p>
|
805
|
-
<link
|
806
|
-
<link
|
807
|
-
<link
|
795
|
+
<link update-type="true" target="http://example.com"/>
|
796
|
+
<link update-type="true" target="list.adoc">example</link>
|
797
|
+
<link update-type="true" target="list" alt="tip">example</link>
|
808
798
|
</p>
|
809
799
|
</foreword></preface>
|
810
800
|
<sections>
|
data/spec/isodoc/lists_spec.rb
CHANGED
@@ -397,70 +397,70 @@ RSpec.describe IsoDoc do
|
|
397
397
|
</iso-standard>
|
398
398
|
INPUT
|
399
399
|
output = <<~OUTPUT
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
400
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
401
|
+
<head>
|
402
|
+
<style>
|
403
|
+
</style>
|
404
|
+
</head>
|
405
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
406
|
+
<div class='WordSection1'>
|
407
|
+
<p> </p>
|
408
|
+
</div>
|
409
|
+
<p>
|
410
|
+
<br clear='all' class='section'/>
|
411
|
+
</p>
|
412
|
+
<div class='WordSection2'>
|
413
|
+
<p>
|
414
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
415
|
+
</p>
|
416
|
+
<div>
|
417
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
418
|
+
<table class='dl'>
|
419
|
+
<tr>
|
420
|
+
<td valign='top' align='left'>
|
421
|
+
<p align='left' style='margin-left:0pt;text-align:left;'>A Deflist</p>
|
422
|
+
</td>
|
423
|
+
<td valign='top'>
|
424
|
+
<dl id='_732d3f57-4f88-40bf-9ae9-633891edc395'>
|
425
|
+
<dt>
|
426
|
+
<p align='left' style='margin-left:0pt;text-align:left;'>W</p>
|
427
|
+
</dt>
|
428
|
+
<dd>
|
429
|
+
<p id='_05d81174-3a41-44af-94d8-c78b8d2e175d'>mass fraction of gelatinized kernels</p>
|
430
|
+
</dd>
|
431
|
+
</dl>
|
432
|
+
</td>
|
433
|
+
</tr>
|
434
|
+
</table>
|
435
|
+
<div align='center' class='table_container'>
|
436
|
+
<table id='_732d3f57-4f88-40bf-9ae9-633891edc396' class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
437
|
+
<tbody>
|
438
|
+
<tr>
|
439
|
+
<td style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>
|
440
|
+
<dl id='_732d3f57-4f88-40bf-9ae9-633891edc397'>
|
441
|
+
<dt>
|
442
|
+
<p align='left' style='margin-left:0pt;text-align:left;'>X</p>
|
443
|
+
</dt>
|
444
|
+
<dd>
|
445
|
+
<p id='_05d81174-3a41-44af-94d8-c78b8d2e175e'>expressed in per cent</p>
|
446
|
+
</dd>
|
447
|
+
</dl>
|
448
|
+
</td>
|
449
|
+
</tr>
|
450
|
+
</tbody>
|
451
|
+
</table>
|
452
|
+
</div>
|
453
|
+
</div>
|
454
|
+
<p> </p>
|
455
|
+
</div>
|
456
|
+
<p>
|
457
|
+
<br clear='all' class='section'/>
|
458
|
+
</p>
|
459
|
+
<div class='WordSection3'>
|
460
|
+
<p class='zzSTDTitle1'/>
|
461
|
+
</div>
|
462
|
+
</body>
|
463
|
+
</html>
|
464
464
|
OUTPUT
|
465
465
|
expect(xmlpp(IsoDoc::WordConvert.new({})
|
466
466
|
.convert("test", input, true)))
|
@@ -446,42 +446,6 @@ RSpec.describe IsoDoc do
|
|
446
446
|
OUTPUT
|
447
447
|
end
|
448
448
|
|
449
|
-
it "populates Word template with terms reference labels" do
|
450
|
-
FileUtils.rm_f "test.doc"
|
451
|
-
FileUtils.rm_f "test.html"
|
452
|
-
IsoDoc::WordConvert.new(
|
453
|
-
{ wordstylesheet: "spec/assets/word.css",
|
454
|
-
htmlstylesheet: "spec/assets/html.scss" },
|
455
|
-
).convert("test", <<~"INPUT", false)
|
456
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
457
|
-
<sections>
|
458
|
-
<terms id="_terms_and_definitions" obligation="normative"><title>1.<tab/>Terms and Definitions</title>
|
459
|
-
<term id="paddy1"><name>1.1.</name><preferred>paddy</preferred>
|
460
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
461
|
-
<termsource status="modified">
|
462
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">ISO 7301:2011, Clause 3.1</origin>
|
463
|
-
<modification>
|
464
|
-
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
465
|
-
</modification>
|
466
|
-
</termsource></term>
|
467
|
-
</terms>
|
468
|
-
</sections>
|
469
|
-
</iso-standard>
|
470
|
-
INPUT
|
471
|
-
word = File.read("test.doc")
|
472
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
473
|
-
.sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
|
474
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
475
|
-
<div class="WordSection3">
|
476
|
-
<p class="zzSTDTitle1"></p>
|
477
|
-
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
478
|
-
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
|
479
|
-
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
480
|
-
<p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
481
|
-
</div>
|
482
|
-
OUTPUT
|
483
|
-
end
|
484
|
-
|
485
449
|
it "populates Word header" do
|
486
450
|
FileUtils.rm_f "test.doc"
|
487
451
|
IsoDoc::WordConvert.new(
|
@@ -1220,43 +1184,6 @@ RSpec.describe IsoDoc do
|
|
1220
1184
|
expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2\.</h2>})
|
1221
1185
|
end
|
1222
1186
|
|
1223
|
-
it "processes empty term modifications" do
|
1224
|
-
FileUtils.rm_f "test.html"
|
1225
|
-
FileUtils.rm_f "test.doc"
|
1226
|
-
IsoDoc::HtmlConvert.new(options)
|
1227
|
-
.convert("test", <<~"INPUT", false)
|
1228
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1229
|
-
<sections>
|
1230
|
-
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
1231
|
-
<term id="paddy1"><preferred>paddy</preferred>
|
1232
|
-
<domain>rice</domain>
|
1233
|
-
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
1234
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
1235
|
-
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
1236
|
-
<ul>
|
1237
|
-
<li>A</li>
|
1238
|
-
</ul>
|
1239
|
-
</termexample>
|
1240
|
-
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
1241
|
-
<ul>
|
1242
|
-
<li>A</li>
|
1243
|
-
</ul>
|
1244
|
-
</termexample>
|
1245
|
-
<termsource status="modified">
|
1246
|
-
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">ISO 7301:2011, Clause 3.1</origin>
|
1247
|
-
<modification>
|
1248
|
-
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
|
1249
|
-
</modification>
|
1250
|
-
</termsource></term>
|
1251
|
-
</terms>
|
1252
|
-
</sections>
|
1253
|
-
</iso-standard>
|
1254
|
-
INPUT
|
1255
|
-
expect(File.exist?("test.html")).to be true
|
1256
|
-
html = File.read("test.html")
|
1257
|
-
expect(html).to include '[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified]'
|
1258
|
-
end
|
1259
|
-
|
1260
1187
|
it "creates continuation styles for multiparagraph list items in Word" do
|
1261
1188
|
FileUtils.rm_f "test.doc"
|
1262
1189
|
FileUtils.rm_f "test.html"
|