metanorma-iso 2.1.4 → 2.1.5
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/lib/isodoc/iso/html/isodoc-dis.css +1 -10
- data/lib/isodoc/iso/html/isodoc-dis.scss +1 -13
- data/lib/isodoc/iso/html/isodoc.css +4 -11
- data/lib/isodoc/iso/html/isodoc.scss +5 -15
- data/lib/isodoc/iso/i18n-en.yaml +1 -1
- data/lib/isodoc/iso/iso.amendment.xsl +12 -2
- data/lib/isodoc/iso/iso.international-standard.xsl +12 -2
- data/lib/isodoc/iso/presentation_xml_convert.rb +4 -0
- data/lib/isodoc/iso/word_cleanup.rb +40 -6
- data/lib/isodoc/iso/word_dis_cleanup.rb +2 -14
- data/lib/metanorma/iso/isodoc.rng +10 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/isodoc/postproc_spec.rb +2 -62
- data/spec/isodoc/terms_spec.rb +62 -0
- data/spec/isodoc/word_dis_spec.rb +125 -3
- data/spec/metanorma/base_spec.rb +6 -3
- data/spec/metanorma/cleanup_spec.rb +5 -5
- data/spec/metanorma/refs_spec.rb +5 -3
- data/spec/metanorma/section_spec.rb +6 -6
- data/spec/spec_helper.rb +1 -1
- data/spec/vcr_cassettes/withdrawn_iso.yml +34 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3629dd32172e9b6df3f58715579377d8cf71e989c27b54200f1f562a9892b3d
|
4
|
+
data.tar.gz: 5645a46a5e59c5a55543469064124582250ef5b676ced7627d839c120b5f6da2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6cdedb8c9ebfd573277b5a757a9599687f3818c3be99cd50e835866b2306846c8d93c4df0fde2a0f29575832f56af3a17f4fb31fc98734df918626a21d9a035
|
7
|
+
data.tar.gz: bf939763b17cd5db3c55cfc3f870be2de3892727849073d33785439a113561300fe81941ee4d8ffe02a2cb5712b11b172a7347f5b9209d956f8755dbc4a694ef
|
@@ -76,7 +76,7 @@ p.NormRef, li.NormRef, div.NormRef {
|
|
76
76
|
mso-ansi-language: EN-GB; }
|
77
77
|
|
78
78
|
p.FigureTitle, li.FigureTitle, div.FigureTitle {
|
79
|
-
mso-style-name:
|
79
|
+
mso-style-name: "Figure Title";
|
80
80
|
mso-style-unhide: no;
|
81
81
|
mso-style-qformat: yes;
|
82
82
|
mso-style-parent: "";
|
@@ -1691,12 +1691,6 @@ div.Example, td.Example {
|
|
1691
1691
|
margin: 0in;
|
1692
1692
|
margin-bottom: 6.0pt; }
|
1693
1693
|
|
1694
|
-
td.Example p.MsoListParagraph {
|
1695
|
-
font-size: {{smallerfontsize}}; }
|
1696
|
-
|
1697
|
-
div.Example p.MsoListParagraph {
|
1698
|
-
font-size: {{smallerfontsize}}; }
|
1699
|
-
|
1700
1694
|
p.Example, li.Example, div.Example {
|
1701
1695
|
mso-style-unhide: no;
|
1702
1696
|
mso-style-qformat: yes;
|
@@ -4483,9 +4477,6 @@ span.SpellE {
|
|
4483
4477
|
mso-style-name: "";
|
4484
4478
|
mso-spl-e: yes; }
|
4485
4479
|
|
4486
|
-
div.Note p.MsoListParagraph {
|
4487
|
-
font-size: {{smallerfontsize}}; }
|
4488
|
-
|
4489
4480
|
div.Note span.stem {
|
4490
4481
|
font-size: {{smallerfontsize}}; }
|
4491
4482
|
|
@@ -71,7 +71,7 @@ p.NormRef, li.NormRef, div.NormRef
|
|
71
71
|
mso-bidi-font-family:$bodyfont;
|
72
72
|
mso-ansi-language:EN-GB;}
|
73
73
|
p.FigureTitle, li.FigureTitle, div.FigureTitle
|
74
|
-
{mso-style-name:
|
74
|
+
{mso-style-name:"Figure Title";
|
75
75
|
mso-style-unhide:no;
|
76
76
|
mso-style-qformat:yes;
|
77
77
|
mso-style-parent:"";
|
@@ -1626,14 +1626,6 @@ div.Example, td.Example {
|
|
1626
1626
|
margin-bottom:6.0pt;
|
1627
1627
|
}
|
1628
1628
|
|
1629
|
-
td.Example p.MsoListParagraph {
|
1630
|
-
font-size: $smallerfontsize;
|
1631
|
-
}
|
1632
|
-
|
1633
|
-
div.Example p.MsoListParagraph {
|
1634
|
-
font-size: $smallerfontsize;
|
1635
|
-
}
|
1636
|
-
|
1637
1629
|
p.Example, li.Example, div.Example
|
1638
1630
|
{
|
1639
1631
|
mso-style-unhide:no;
|
@@ -4308,10 +4300,6 @@ span.SpellE
|
|
4308
4300
|
mso-spl-e:yes;}
|
4309
4301
|
|
4310
4302
|
|
4311
|
-
div.Note p.MsoListParagraph {
|
4312
|
-
font-size: $smallerfontsize;
|
4313
|
-
}
|
4314
|
-
|
4315
4303
|
div.Note span.stem {
|
4316
4304
|
font-size: $smallerfontsize; }
|
4317
4305
|
|
@@ -376,6 +376,7 @@ p.SourceTitle {
|
|
376
376
|
mso-ansi-language: EN-GB; }
|
377
377
|
|
378
378
|
p.Tabletitle, li.Tabletitle, div.Tabletitle, p.ListTitle {
|
379
|
+
mso-style-name: "Table title";
|
379
380
|
mso-style-unhide: no;
|
380
381
|
mso-style-qformat: yes;
|
381
382
|
mso-style-parent: "";
|
@@ -510,6 +511,7 @@ span.AnnexFigureTitleChar {
|
|
510
511
|
|
511
512
|
p.Note, div.Note, li.Note, p.TableFootnote, div.TableFootnote, li.TableFootnote {
|
512
513
|
mso-style-unhide: no;
|
514
|
+
mso-style-name: "Note";
|
513
515
|
mso-style-qformat: yes;
|
514
516
|
mso-style-parent: "";
|
515
517
|
margin-top: 0cm;
|
@@ -1277,7 +1279,7 @@ aside {
|
|
1277
1279
|
font-size: {{footnotefontsize}}; }
|
1278
1280
|
|
1279
1281
|
/*
|
1280
|
-
div.
|
1282
|
+
div.Example {
|
1281
1283
|
border:solid black .25pt;
|
1282
1284
|
mso-border-alt:solid black .25pt;
|
1283
1285
|
padding:10pt;
|
@@ -1287,7 +1289,7 @@ div.example {
|
|
1287
1289
|
}
|
1288
1290
|
*/
|
1289
1291
|
/*
|
1290
|
-
div.
|
1292
|
+
div.Example {
|
1291
1293
|
margin-left:70.9pt;
|
1292
1294
|
text-indent:-70.9pt;
|
1293
1295
|
}
|
@@ -1305,12 +1307,6 @@ div.Example, td.Example {
|
|
1305
1307
|
margin: 0in;
|
1306
1308
|
margin-bottom: 6.0pt; }
|
1307
1309
|
|
1308
|
-
td.Example p.MsoListParagraph {
|
1309
|
-
font-size: {{smallerfontsize}}; }
|
1310
|
-
|
1311
|
-
div.Example p.MsoListParagraph {
|
1312
|
-
font-size: {{smallerfontsize}}; }
|
1313
|
-
|
1314
1310
|
p.Example, li.Example, div.Example {
|
1315
1311
|
mso-style-unhide: no;
|
1316
1312
|
mso-style-qformat: yes;
|
@@ -1334,9 +1330,6 @@ span.ExampleChar {
|
|
1334
1330
|
mso-style-link: Example;
|
1335
1331
|
mso-ansi-language: EN-GB; }
|
1336
1332
|
|
1337
|
-
div.Note p.MsoListParagraph {
|
1338
|
-
font-size: {{smallerfontsize}}; }
|
1339
|
-
|
1340
1333
|
div.Note span.stem {
|
1341
1334
|
font-size: {{smallerfontsize}}; }
|
1342
1335
|
|
@@ -358,7 +358,8 @@ p.SourceTitle
|
|
358
358
|
mso-bidi-font-family:$bodyfont;
|
359
359
|
mso-ansi-language:EN-GB;}
|
360
360
|
p.Tabletitle, li.Tabletitle, div.Tabletitle, p.ListTitle
|
361
|
-
{mso-style-
|
361
|
+
{mso-style-name:"Table title";
|
362
|
+
mso-style-unhide:no;
|
362
363
|
mso-style-qformat:yes;
|
363
364
|
mso-style-parent:"";
|
364
365
|
margin-top:0cm;
|
@@ -485,6 +486,7 @@ span.AnnexFigureTitleChar
|
|
485
486
|
font-weight:bold;}
|
486
487
|
p.Note, div.Note, li.Note, p.TableFootnote, div.TableFootnote, li.TableFootnote
|
487
488
|
{mso-style-unhide:no;
|
489
|
+
mso-style-name:"Note";
|
488
490
|
mso-style-qformat:yes;
|
489
491
|
mso-style-parent:"";
|
490
492
|
margin-top:0cm;
|
@@ -1234,7 +1236,7 @@ aside {
|
|
1234
1236
|
}
|
1235
1237
|
|
1236
1238
|
/*
|
1237
|
-
div.
|
1239
|
+
div.Example {
|
1238
1240
|
border:solid black .25pt;
|
1239
1241
|
mso-border-alt:solid black .25pt;
|
1240
1242
|
padding:10pt;
|
@@ -1246,7 +1248,7 @@ div.example {
|
|
1246
1248
|
|
1247
1249
|
|
1248
1250
|
/*
|
1249
|
-
div.
|
1251
|
+
div.Example {
|
1250
1252
|
margin-left:70.9pt;
|
1251
1253
|
text-indent:-70.9pt;
|
1252
1254
|
}
|
@@ -1267,14 +1269,6 @@ div.Example, td.Example {
|
|
1267
1269
|
margin-bottom:6.0pt;
|
1268
1270
|
}
|
1269
1271
|
|
1270
|
-
td.Example p.MsoListParagraph {
|
1271
|
-
font-size: $smallerfontsize;
|
1272
|
-
}
|
1273
|
-
|
1274
|
-
div.Example p.MsoListParagraph {
|
1275
|
-
font-size: $smallerfontsize;
|
1276
|
-
}
|
1277
|
-
|
1278
1272
|
p.Example, li.Example, div.Example
|
1279
1273
|
{
|
1280
1274
|
mso-style-unhide:no;
|
@@ -1300,10 +1294,6 @@ span.ExampleChar
|
|
1300
1294
|
|
1301
1295
|
|
1302
1296
|
|
1303
|
-
div.Note p.MsoListParagraph {
|
1304
|
-
font-size: $smallerfontsize;
|
1305
|
-
}
|
1306
|
-
|
1307
1297
|
div.Note span.stem {
|
1308
1298
|
font-size: $smallerfontsize; }
|
1309
1299
|
|
data/lib/isodoc/iso/i18n-en.yaml
CHANGED
@@ -3445,10 +3445,12 @@
|
|
3445
3445
|
</xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
|
3446
3446
|
|
3447
3447
|
|
3448
|
+
|
3448
3449
|
</xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-list-body-style">
|
3449
3450
|
|
3450
3451
|
|
3451
3452
|
|
3453
|
+
|
3452
3454
|
</xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-style">
|
3453
3455
|
<xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
|
3454
3456
|
<xsl:attribute name="font-size">65%</xsl:attribute>
|
@@ -4086,6 +4088,14 @@
|
|
4086
4088
|
|
4087
4089
|
|
4088
4090
|
|
4091
|
+
<xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
|
4092
|
+
<fo:block keep-with-previous="always" line-height="0.1">
|
4093
|
+
<xsl:for-each select="*[local-name()='bookmark']">
|
4094
|
+
<xsl:call-template name="bookmark"/>
|
4095
|
+
</xsl:for-each>
|
4096
|
+
</fo:block>
|
4097
|
+
</xsl:if>
|
4098
|
+
|
4089
4099
|
</fo:block-container>
|
4090
4100
|
</xsl:variable>
|
4091
4101
|
|
@@ -7976,7 +7986,7 @@
|
|
7976
7986
|
|
7977
7987
|
|
7978
7988
|
<!-- <xsl:if test="$namespace = 'ieee'">
|
7979
|
-
<xsl:if test="$
|
7989
|
+
<xsl:if test="$current_template = 'standard'">8</xsl:if>
|
7980
7990
|
</xsl:if> -->
|
7981
7991
|
|
7982
7992
|
|
@@ -9305,7 +9315,7 @@
|
|
9305
9315
|
</xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
|
9306
9316
|
<!-- to split by '_' and other chars -->
|
9307
9317
|
<xsl:call-template name="add-zero-spaces-java"/>
|
9308
|
-
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
9318
|
+
</xsl:template><xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
9309
9319
|
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
9310
9320
|
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
9311
9321
|
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
@@ -3445,10 +3445,12 @@
|
|
3445
3445
|
</xsl:attribute-set><xsl:attribute-set name="bibitem-normative-list-body-style">
|
3446
3446
|
|
3447
3447
|
|
3448
|
+
|
3448
3449
|
</xsl:attribute-set><xsl:attribute-set name="bibitem-non-normative-list-body-style">
|
3449
3450
|
|
3450
3451
|
|
3451
3452
|
|
3453
|
+
|
3452
3454
|
</xsl:attribute-set><xsl:attribute-set name="bibitem-note-fn-style">
|
3453
3455
|
<xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
|
3454
3456
|
<xsl:attribute name="font-size">65%</xsl:attribute>
|
@@ -4086,6 +4088,14 @@
|
|
4086
4088
|
|
4087
4089
|
|
4088
4090
|
|
4091
|
+
<xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
|
4092
|
+
<fo:block keep-with-previous="always" line-height="0.1">
|
4093
|
+
<xsl:for-each select="*[local-name()='bookmark']">
|
4094
|
+
<xsl:call-template name="bookmark"/>
|
4095
|
+
</xsl:for-each>
|
4096
|
+
</fo:block>
|
4097
|
+
</xsl:if>
|
4098
|
+
|
4089
4099
|
</fo:block-container>
|
4090
4100
|
</xsl:variable>
|
4091
4101
|
|
@@ -7976,7 +7986,7 @@
|
|
7976
7986
|
|
7977
7987
|
|
7978
7988
|
<!-- <xsl:if test="$namespace = 'ieee'">
|
7979
|
-
<xsl:if test="$
|
7989
|
+
<xsl:if test="$current_template = 'standard'">8</xsl:if>
|
7980
7990
|
</xsl:if> -->
|
7981
7991
|
|
7982
7992
|
|
@@ -9305,7 +9315,7 @@
|
|
9305
9315
|
</xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
|
9306
9316
|
<!-- to split by '_' and other chars -->
|
9307
9317
|
<xsl:call-template name="add-zero-spaces-java"/>
|
9308
|
-
</xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
9318
|
+
</xsl:template><xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
|
9309
9319
|
<!-- <fo:inline id="{@id}" font-size="1pt"/> -->
|
9310
9320
|
<fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
|
9311
9321
|
<!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
|
@@ -11,11 +11,10 @@ module IsoDoc
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# force Annex h2 down to be p.h2Annex, so it is not picked up by ToC
|
15
14
|
def word_annex_cleanup1(docxml, lvl)
|
16
15
|
docxml.xpath("//h#{lvl}[ancestor::*[@class = 'Section3']]").each do |h2|
|
17
16
|
h2.name = "p"
|
18
|
-
h2["class"] = "
|
17
|
+
h2["class"] = "a#{lvl}"
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -37,16 +36,51 @@ module IsoDoc
|
|
37
36
|
|
38
37
|
def style_cleanup(docxml)
|
39
38
|
word_annex_cleanup_h1(docxml)
|
40
|
-
|
39
|
+
figure_style(docxml)
|
40
|
+
new_styles(docxml)
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
docxml.xpath("
|
45
|
-
|
43
|
+
def figure_style(docxml)
|
44
|
+
docxml.xpath("//div[@class = 'figure']").each do |f|
|
45
|
+
f["style"] ||= ""
|
46
|
+
f["style"] += "text-align:center;"
|
46
47
|
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def quote_style(docxml)
|
51
|
+
docxml.xpath("//div[@class = 'Quote' or @class = 'Note' or "\
|
52
|
+
"@class = 'Example' or @class = 'Admonition']").each do |d|
|
53
|
+
quote_style1(d)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def quote_style1(div)
|
58
|
+
div.xpath(".//li").each do |p|
|
59
|
+
p["style"] ||= ""
|
60
|
+
p["style"] += "font-size:#{default_fonts({})[:smallerfontsize]};"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
STYLESMAP = {
|
65
|
+
example: "Example",
|
66
|
+
note: "Note",
|
67
|
+
Sourcecode: "Code",
|
68
|
+
tabletitle: "Tabletitle",
|
69
|
+
Biblio: "MsoNormal",
|
70
|
+
figure: "MsoNormal",
|
71
|
+
SourceTitle: "FigureTitle",
|
72
|
+
}.freeze
|
73
|
+
|
74
|
+
def new_styles(docxml)
|
75
|
+
STYLESMAP.each do |k, v|
|
76
|
+
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
77
|
+
end
|
78
|
+
docxml.xpath("//div[@class = 'Section3']//p[@class = 'Tabletitle']")
|
79
|
+
.each { |t| t["class"] = "AnnexTableTitle" }
|
47
80
|
docxml.xpath("//*[@class = 'zzHelp']/p[not(@class)]").each do |p|
|
48
81
|
p["class"] = "zzHelp"
|
49
82
|
end
|
83
|
+
quote_style(docxml)
|
50
84
|
end
|
51
85
|
|
52
86
|
def authority_hdr_cleanup(docxml)
|
@@ -1,11 +1,6 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Iso
|
3
3
|
class WordDISConvert < WordConvert
|
4
|
-
def style_cleanup(docxml)
|
5
|
-
super
|
6
|
-
dis_styles(docxml)
|
7
|
-
end
|
8
|
-
|
9
4
|
STYLESMAP = {
|
10
5
|
AltTerms: "AdmittedTerm",
|
11
6
|
TableFootnote: "Tablefootnote",
|
@@ -30,7 +25,7 @@ module IsoDoc
|
|
30
25
|
zzCopyright1: "zzCopyright",
|
31
26
|
}.freeze
|
32
27
|
|
33
|
-
def
|
28
|
+
def new_styles(docxml)
|
34
29
|
STYLESMAP.each do |k, v|
|
35
30
|
docxml.xpath("//*[@class = '#{k}']").each { |s| s["class"] = v }
|
36
31
|
end
|
@@ -46,8 +41,8 @@ module IsoDoc
|
|
46
41
|
figure_style(docxml)
|
47
42
|
note_style(docxml)
|
48
43
|
example_style(docxml)
|
49
|
-
quote_style(docxml)
|
50
44
|
dis_style_interactions(docxml)
|
45
|
+
quote_style(docxml)
|
51
46
|
end
|
52
47
|
|
53
48
|
def dis_style_interactions(docxml)
|
@@ -68,13 +63,6 @@ module IsoDoc
|
|
68
63
|
end
|
69
64
|
end
|
70
65
|
|
71
|
-
def quote_style(docxml)
|
72
|
-
docxml.xpath("//div[@class = 'Quote' or @class = 'Note' or "\
|
73
|
-
"@class = 'Example' or @class = 'Admonition']").each do |d|
|
74
|
-
quote_style1(d)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
66
|
def para_style_change(div, class1, class2)
|
79
67
|
s = class1 ? "@class = '#{class1}'" : "not(@class)"
|
80
68
|
div.xpath(".//p[#{s}]").each do |p|
|
@@ -2504,6 +2504,16 @@
|
|
2504
2504
|
<text/>
|
2505
2505
|
</element>
|
2506
2506
|
</optional>
|
2507
|
+
<optional>
|
2508
|
+
<element name="amendment">
|
2509
|
+
<text/>
|
2510
|
+
</element>
|
2511
|
+
</optional>
|
2512
|
+
<optional>
|
2513
|
+
<element name="corrigendum">
|
2514
|
+
<text/>
|
2515
|
+
</element>
|
2516
|
+
</optional>
|
2507
2517
|
<optional>
|
2508
2518
|
<element name="language">
|
2509
2519
|
<text/>
|
@@ -126,66 +126,6 @@ RSpec.describe IsoDoc do
|
|
126
126
|
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
127
127
|
end
|
128
128
|
|
129
|
-
it "converts annex subheadings to h2Annex class for Word" do
|
130
|
-
IsoDoc::Iso::WordConvert
|
131
|
-
.new(WORD_HTML_CSS.dup)
|
132
|
-
.convert("test", <<~"INPUT", false)
|
133
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
134
|
-
<annex id="P" inline-header="false" obligation="normative">
|
135
|
-
<title>Annex</title>
|
136
|
-
<clause id="Q" inline-header="false" obligation="normative">
|
137
|
-
<title>A.1
|
138
|
-
<tab/>
|
139
|
-
Annex A.1</title>
|
140
|
-
</clause>
|
141
|
-
<appendix id="Q2" inline-header="false" obligation="normative">
|
142
|
-
<title>Appendix 1
|
143
|
-
<tab/>
|
144
|
-
An Appendix</title>
|
145
|
-
</appendix>
|
146
|
-
</annex>
|
147
|
-
<bibliography>
|
148
|
-
<references id="R" normative="false"><title>Bibliography</title></references>
|
149
|
-
</bibliography>
|
150
|
-
</iso-standard>
|
151
|
-
INPUT
|
152
|
-
|
153
|
-
word = File.read("test.doc", encoding: "UTF-8")
|
154
|
-
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
155
|
-
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
156
|
-
|
157
|
-
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
158
|
-
<div class="WordSection3">
|
159
|
-
<p class="zzSTDTitle1"/>
|
160
|
-
<p class="MsoNormal">
|
161
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
162
|
-
</p>
|
163
|
-
<div class="Section3">
|
164
|
-
<a id="P" name="P"/>
|
165
|
-
<p class="ANNEX">Annex</p>
|
166
|
-
<div>
|
167
|
-
<a id="Q" name="Q"/>
|
168
|
-
<p class="h2Annex">A.1
|
169
|
-
<span style="mso-tab-count:1"> </span>
|
170
|
-
Annex A.1</p>
|
171
|
-
</div>
|
172
|
-
<div>
|
173
|
-
<a id="Q2" name="Q2"/>
|
174
|
-
<p class="h2Annex">Appendix 1
|
175
|
-
<span style="mso-tab-count:1"> </span>
|
176
|
-
An Appendix</p>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
<p class='MsoNormal'>
|
180
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
181
|
-
</p>
|
182
|
-
<div>
|
183
|
-
<p class='BiblioTitle'>Bibliography</p>
|
184
|
-
</div>
|
185
|
-
</div>
|
186
|
-
OUTPUT
|
187
|
-
end
|
188
|
-
|
189
129
|
it "populates Word template with terms reference labels" do
|
190
130
|
IsoDoc::Iso::WordConvert
|
191
131
|
.new(WORD_HTML_CSS.dup)
|
@@ -817,7 +757,7 @@ RSpec.describe IsoDoc do
|
|
817
757
|
</p>
|
818
758
|
<div class="Section3">
|
819
759
|
<a id="P" name="P"/>
|
820
|
-
<div class="
|
760
|
+
<div class="MsoNormal" style='text-align:center;'>
|
821
761
|
<a id="samplecode" name="samplecode"/>
|
822
762
|
<p class="MsoNormal">Hello</p>
|
823
763
|
<p class="MsoNormal">Key</p>
|
@@ -864,7 +804,7 @@ RSpec.describe IsoDoc do
|
|
864
804
|
.sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
|
865
805
|
.sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
866
806
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
867
|
-
|
807
|
+
<div class='WordSection3'>
|
868
808
|
<p class='zzSTDTitle1'/>
|
869
809
|
<p class='MsoNormal'>
|
870
810
|
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -249,4 +249,66 @@ RSpec.describe IsoDoc do
|
|
249
249
|
.sub(%r{</div>\s*<br.*$}m, "")))
|
250
250
|
.to be_equivalent_to xmlpp(word)
|
251
251
|
end
|
252
|
+
|
253
|
+
it "processes related terms" do
|
254
|
+
input = <<~INPUT
|
255
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
256
|
+
<sections>
|
257
|
+
<terms id='A' obligation='normative'>
|
258
|
+
<title>Terms and definitions</title>
|
259
|
+
<term id='second'>
|
260
|
+
<preferred>
|
261
|
+
<expression>
|
262
|
+
<name>Second Term</name>
|
263
|
+
</expression>
|
264
|
+
<field-of-application>Field</field-of-application>
|
265
|
+
<usage-info>Usage Info 1</usage-info>
|
266
|
+
</preferred>
|
267
|
+
<definition><verbal-definition>Definition 1</verbal-definition></definition>
|
268
|
+
</term>
|
269
|
+
<term id="C">
|
270
|
+
<preferred language='fr' script='Latn' type='prefix'>
|
271
|
+
<expression>
|
272
|
+
<name>First Designation</name>
|
273
|
+
</expression></preferred>
|
274
|
+
<related type='contrast'>
|
275
|
+
<preferred>
|
276
|
+
<expression>
|
277
|
+
<name>Fifth Designation</name>
|
278
|
+
<grammar>
|
279
|
+
<gender>neuter</gender>
|
280
|
+
</grammar>
|
281
|
+
</expression>
|
282
|
+
</preferred>
|
283
|
+
<xref target='second'/>
|
284
|
+
</related>
|
285
|
+
<definition><verbal-definition>Definition 2</verbal-definition></definition>
|
286
|
+
</term>
|
287
|
+
</terms>
|
288
|
+
</sections>
|
289
|
+
</iso-standard>
|
290
|
+
INPUT
|
291
|
+
output = <<~OUTPUT
|
292
|
+
<?xml version='1.0'?>
|
293
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
294
|
+
<sections>
|
295
|
+
<terms id='A' obligation='normative' displayorder='1'>
|
296
|
+
<title depth='1'>1<tab/>Terms and definitions</title>
|
297
|
+
<term id='second'>
|
298
|
+
<name>1.1</name>
|
299
|
+
<preferred><strong>Second Term</strong>, <Field, Usage Info 1></preferred>
|
300
|
+
<definition>Definition 1</definition>
|
301
|
+
</term>
|
302
|
+
<term id='C'>
|
303
|
+
<name>1.2</name>
|
304
|
+
<preferred language='fr' script='Latn' type='prefix'><strong>First Designation</strong></preferred>
|
305
|
+
<definition>Definition 2</definition>
|
306
|
+
</term>
|
307
|
+
</terms>
|
308
|
+
</sections>
|
309
|
+
</iso-standard>
|
310
|
+
OUTPUT
|
311
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
312
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
313
|
+
end
|
252
314
|
end
|