metanorma-iec 1.3.6 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8efe031009d849297cc1ca141ddd5c859f36e132411caca46580c4fe86a04169
4
- data.tar.gz: 46c36ffcc548f144d63b88408c69f0237e7f069322ce2b2f3933eed2ad96c4ab
3
+ metadata.gz: a5b9cbe5c402a7dbd3a2b074aefdc52fa620a62c515d8a8d32a904c2198d4c5e
4
+ data.tar.gz: 43958dfa8f657c760a67c35d10403123fde662527f0c94402a7f32ab2e582ad2
5
5
  SHA512:
6
- metadata.gz: 59f27b9c0b09b4810f917ceb37284ac86643282210d8b85f7e6461ef31092d74a430cdbeef211a1759dfe013b27605a88850c54ced016d0ea0ea35f06f674653
7
- data.tar.gz: 2d91c48a9f9dc1e8166af7c79816c98745a4b575de0d791d6728fd4ef17907f58fb198923a71bd58a1cb41d575abd835a13b21fcad5946c7e47aac3f4f72b78f
6
+ metadata.gz: 5fa2ca8ae28b7ae9d060a1900f72a362f2d3f64b7cfb36a3b7e537270720be9c01b7eb5df31ca86ce263cc59b3dc08556d517c8c7aab4f9d4170846261b0a197
7
+ data.tar.gz: dd32106b4774c119cdd10ce89944f116d146906f70e0ecb29e8094fe45340319c35e1dcc308ebf1f0c95699b6a398b4f970b5878e7730eee27e169d4360841ee
@@ -6,7 +6,9 @@ module Asciidoctor
6
6
  csv_split(publishers)&.each do |p|
7
7
  xml.contributor do |c|
8
8
  c.role **{ type: "author" }
9
- c.organization { |a| organization(a, p, false, node, !node.attr("publisher")) }
9
+ c.organization do |a|
10
+ organization(a, p, false, node, !node.attr("publisher"))
11
+ end
10
12
  end
11
13
  end
12
14
  end
@@ -16,7 +18,9 @@ module Asciidoctor
16
18
  csv_split(publishers)&.each do |p|
17
19
  xml.contributor do |c|
18
20
  c.role **{ type: "publisher" }
19
- c.organization { |a| organization(a, p, true, node, !node.attr("publisher")) }
21
+ c.organization do |a|
22
+ organization(a, p, true, node, !node.attr("publisher"))
23
+ end
20
24
  end
21
25
  end
22
26
  end
@@ -47,24 +51,29 @@ module Asciidoctor
47
51
  xml.docidentifier dn, **attr_code(type: "ISO")
48
52
  end
49
53
 
50
- def id_edition_suffix(dn, node)
54
+ def id_edition_suffix(docnum, node)
51
55
  ed = node.attr("edition") || 1
52
- dn += " ED #{ed}"
53
- dn
56
+ docnum += " ED #{ed}"
57
+ docnum
54
58
  end
55
59
 
56
60
  STAGE_CODES = {
57
- "PNW" => "1000", "ANW" => "2000", "CAN" => "2098", "ACD" => "2099", "CD" => "3020",
58
- "BWG" => "3092", "A2CD" => "3099", "2CD" => "3520", "3CD" => "3520", "4CD" => "3520",
59
- "5CD" => "3520", "6CD" => "3520", "7CD" => "3520", "8CD" => "3520", "9CD" => "3520",
60
- "CDM" => "3591", "A3CD" => "3592", "A4CD" => "3592", "A5CD" => "3592", "A6CD" => "3592",
61
- "A7CD" => "3592", "A8CD" => "3592", "A9CD" => "3592", "ACDV" => "3599", "CCDV" => "4020",
62
- "CDVM" => "4091", "NCDV" => "4092", "NADIS" => "4093", "ADIS" => "4099", "ADTR" => "4099",
63
- "ADTS" => "4099", "RDISH" => "5000", "RFDIS" => "5000", "CDISH" => "5020", "CDPAS" => "5020",
64
- "CDTR" => "5020", "CDTS" => "5020", "CFDIS" => "5020", "DTRM" => "5092", "DTSM" => "5092",
65
- "NDTR" => "5092", "NDTS" => "5092", "NFDIS" => "5092", "APUB" => "5099", "BPUB" => "6000",
66
- "PPUB" => "6060", "RR" => "9092", "AMW" => "9220", "WPUB" => "9599", "DELPUB" => "9960",
67
- "PWI" => "0000", "NWIP" => "1000", "WD" => "2000", "CDV" => "4000", "FDIS" => "5000",
61
+ "PNW" => "1000", "ANW" => "2000", "CAN" => "2098", "ACD" => "2099",
62
+ "CD" => "3020", "BWG" => "3092", "A2CD" => "3099", "2CD" => "3520",
63
+ "3CD" => "3520", "4CD" => "3520", "5CD" => "3520", "6CD" => "3520",
64
+ "7CD" => "3520", "8CD" => "3520", "9CD" => "3520", "CDM" => "3591",
65
+ "A3CD" => "3592", "A4CD" => "3592", "A5CD" => "3592", "A6CD" => "3592",
66
+ "A7CD" => "3592", "A8CD" => "3592", "A9CD" => "3592", "ACDV" => "3599",
67
+ "CCDV" => "4020", "CDVM" => "4091", "NCDV" => "4092",
68
+ "NADIS" => "4093", "ADIS" => "4099", "ADTR" => "4099",
69
+ "ADTS" => "4099", "RDISH" => "5000", "RFDIS" => "5000",
70
+ "CDISH" => "5020", "CDPAS" => "5020", "CDTR" => "5020",
71
+ "CDTS" => "5020", "CFDIS" => "5020", "DTRM" => "5092",
72
+ "DTSM" => "5092", "NDTR" => "5092", "NDTS" => "5092",
73
+ "NFDIS" => "5092", "APUB" => "5099", "BPUB" => "6000",
74
+ "PPUB" => "6060", "RR" => "9092", "AMW" => "9220", "WPUB" => "9599",
75
+ "DELPUB" => "9960", "PWI" => "0000", "NWIP" => "1000", "WD" => "2000",
76
+ "CDV" => "4000", "FDIS" => "5000"
68
77
  }.freeze
69
78
 
70
79
  DOC_STAGE = {
@@ -82,19 +91,23 @@ module Asciidoctor
82
91
  }.freeze
83
92
 
84
93
  STAGE_ABBRS = {
85
- "00" => {"00" => "PWI"},
86
- "10" => {"00" => "PNW"},
87
- "20" => {"00" => "ANW", "98" => "CAN", "99" => "ACD"},
88
- "30" => {"00" => "CD", "20" => "CD", "92" => "BWG", "97" => "MERGED", "98" => "DREJ", "99" => "A2CD"},
89
- "35" => {"00" => "CD", "20" => "CD", "91" => "CDM", "92" => "ACD", "99" => "ACDV"},
90
- "40" => {"00" => "CCDV", "20" => "CCDV", "91" => "CDVM", "92" => "NCDV", "93" => "NADIS",
91
- "95" => "ADISSB", "99" => "ADIS"},
92
- "50" => {"00" => "RFDIS", "20" => "CFDIS", "92" => "NFDIS", "95" => "APUBSB", "99" => "APUB"},
93
- "60" => {"00" => "BPUB", "60" => "PPUB"},
94
- "90" => {"00" => "RR", "92" => "RR"},
95
- "92" => {"00" => "AMW", "20" => "AMW"},
96
- "95" => {"00" => "WPUB", "99" => "WPUB"},
97
- "99" => {"00" => "DELPUB", "60" => "DELPUB"},
94
+ "00" => { "00" => "PWI" },
95
+ "10" => { "00" => "PNW" },
96
+ "20" => { "00" => "ANW", "98" => "CAN", "99" => "ACD" },
97
+ "30" => { "00" => "CD", "20" => "CD", "92" => "BWG", "97" => "MERGED",
98
+ "98" => "DREJ", "99" => "A2CD" },
99
+ "35" => { "00" => "CD", "20" => "CD", "91" => "CDM", "92" => "ACD",
100
+ "99" => "ACDV" },
101
+ "40" => { "00" => "CCDV", "20" => "CCDV", "91" => "CDVM",
102
+ "92" => "NCDV", "93" => "NADIS",
103
+ "95" => "ADISSB", "99" => "ADIS" },
104
+ "50" => { "00" => "RFDIS", "20" => "CFDIS", "92" => "NFDIS",
105
+ "95" => "APUBSB", "99" => "APUB" },
106
+ "60" => { "00" => "BPUB", "60" => "PPUB" },
107
+ "90" => { "00" => "RR", "92" => "RR" },
108
+ "92" => { "00" => "AMW", "20" => "AMW" },
109
+ "95" => { "00" => "WPUB", "99" => "WPUB" },
110
+ "99" => { "00" => "DELPUB", "60" => "DELPUB" },
98
111
  }.freeze
99
112
 
100
113
  STAGE_NAMES = {
@@ -112,7 +125,7 @@ module Asciidoctor
112
125
  "99": "Deleted",
113
126
  }.freeze
114
127
 
115
- def status_abbrev1(stage, substage, iter, doctype, draft)
128
+ def status_abbrev1(stage, substage, iter, doctype, _draft)
116
129
  return "" unless stage
117
130
 
118
131
  abbr = STAGE_ABBRS.dig(stage, substage) || "??"
@@ -121,30 +134,30 @@ module Asciidoctor
121
134
  end
122
135
  case doctype
123
136
  when "technical-report"
124
- stage = "ADTR" if stage == "40" && substage == "99"
125
- stage = "CDTR" if stage == "50" && substage == "20"
126
- stage = "DTRM" if stage == "50" && substage == "92"
137
+ abbr = "ADTR" if stage == "40" && substage == "99"
138
+ abbr = "CDTR" if stage == "50" && substage == "20"
139
+ abbr = "DTRM" if stage == "50" && substage == "92"
127
140
  when "technical-specification"
128
- stage = "ADTS" if stage == "40" && substage == "99"
129
- stage = "CDTS" if stage == "50" && substage == "20"
130
- stage = "DTSM" if stage == "50" && substage == "92"
141
+ abbr = "ADTS" if stage == "40" && substage == "99"
142
+ abbr = "CDTS" if stage == "50" && substage == "20"
143
+ abbr = "DTSM" if stage == "50" && substage == "92"
131
144
  when "interpretation-sheet"
132
- stage = "RDISH" if stage == "50" && substage == "00"
133
- stage = "CDISH" if stage == "50" && substage == "20"
145
+ abbr = "RDISH" if stage == "50" && substage == "00"
146
+ abbr = "CDISH" if stage == "50" && substage == "20"
134
147
  when "publicly-available-specification"
135
- stage = "CDPAS" if stage == "50" && substage == "20"
148
+ abbr = "CDPAS" if stage == "50" && substage == "20"
136
149
  end
137
150
  abbr = abbr.sub(/CD$/, "#{iter}CD") if iter
138
151
  abbr
139
152
  end
140
153
 
141
- def stage_abbr(stage, substage)
154
+ def stage_abbr(stage, _substage)
142
155
  return "PPUB" if stage == "60"
143
156
 
144
157
  DOC_STAGE[stage.to_sym] || "??"
145
158
  end
146
159
 
147
- def stage_name(stage, substage, _doctype, _iteration)
160
+ def stage_name(stage, _substage, _doctype, _iteration)
148
161
  STAGE_NAMES[stage.to_sym]
149
162
  end
150
163
 
@@ -159,11 +172,16 @@ module Asciidoctor
159
172
  st = node.attr("status") || node.attr("docstage")
160
173
  stage = get_stage(node)
161
174
  node.attr("docsubstage") ||
162
- ( stage == "60" ? "60" : STAGE_CODES[st] ? STAGE_CODES[st][2..3] : "00" )
175
+ (if stage == "60"
176
+ "60"
177
+ else
178
+ STAGE_CODES[st] ? STAGE_CODES[st][2..3] : "00"
179
+ end)
163
180
  end
164
181
 
165
- def id_stage_abbr(stage, substage, node)
182
+ def id_stage_abbr(stage, _substage, node)
166
183
  return "" if stage == "60"
184
+
167
185
  abbr = DOC_STAGE[stage.to_sym] || ""
168
186
  abbr = node.attr("iteration") + abbr if node.attr("iteration")
169
187
  abbr
@@ -174,9 +192,9 @@ module Asciidoctor
174
192
  substage = get_substage(node)
175
193
  xml.status do |s|
176
194
  s.stage stage, **attr_code(abbreviation: stage_abbr(stage, substage))
177
- s.substage substage,
178
- **attr_code(abbreviation: status_abbrev1(stage, substage, node.attr("iteration"),
179
- doctype(node),node.attr("draft")))
195
+ subst = status_abbrev1(stage, substage, node.attr("iteration"),
196
+ doctype(node), node.attr("draft"))
197
+ s.substage substage, **attr_code(abbreviation: subst)
180
198
  node.attr("iteration") && (s.iteration node.attr("iteration"))
181
199
  end
182
200
  end
@@ -204,6 +204,18 @@
204
204
  </zeroOrMore>
205
205
  </element>
206
206
  </define>
207
+ <define name="dt">
208
+ <element name="dt">
209
+ <optional>
210
+ <attribute name="id">
211
+ <data type="ID"/>
212
+ </attribute>
213
+ </optional>
214
+ <zeroOrMore>
215
+ <ref name="TextElement"/>
216
+ </zeroOrMore>
217
+ </element>
218
+ </define>
207
219
  <define name="example">
208
220
  <element name="example">
209
221
  <attribute name="id">
@@ -899,7 +911,7 @@
899
911
  </include>
900
912
  <!-- end overrides -->
901
913
  <define name="docsubtype">
902
- <element name="docsubtype">
914
+ <element name="subdoctype">
903
915
  <ref name="DocumentSubtype"/>
904
916
  </element>
905
917
  </define>
@@ -954,6 +966,16 @@
954
966
  </define>
955
967
  <define name="concept">
956
968
  <element name="concept">
969
+ <optional>
970
+ <attribute name="ital">
971
+ <data type="boolean"/>
972
+ </attribute>
973
+ </optional>
974
+ <optional>
975
+ <attribute name="ref">
976
+ <data type="boolean"/>
977
+ </attribute>
978
+ </optional>
957
979
  <optional>
958
980
  <element name="refterm">
959
981
  <zeroOrMore>
@@ -998,6 +1020,9 @@
998
1020
  </attribute>
999
1021
  <attribute name="name"/>
1000
1022
  <attribute name="action"/>
1023
+ <optional>
1024
+ <attribute name="class"/>
1025
+ </optional>
1001
1026
  <zeroOrMore>
1002
1027
  <choice>
1003
1028
  <ref name="TextElement"/>
@@ -1490,26 +1515,26 @@
1490
1515
  <optional>
1491
1516
  <ref name="section-title"/>
1492
1517
  </optional>
1493
- <group>
1518
+ <choice>
1494
1519
  <choice>
1495
1520
  <group>
1496
- <zeroOrMore>
1521
+ <oneOrMore>
1497
1522
  <ref name="BasicBlock"/>
1498
- </zeroOrMore>
1523
+ </oneOrMore>
1499
1524
  <zeroOrMore>
1500
1525
  <ref name="note"/>
1501
1526
  </zeroOrMore>
1502
1527
  </group>
1503
1528
  <ref name="amend"/>
1504
1529
  </choice>
1505
- <zeroOrMore>
1530
+ <oneOrMore>
1506
1531
  <choice>
1507
1532
  <ref name="clause-subsection"/>
1508
1533
  <ref name="terms"/>
1509
1534
  <ref name="definitions"/>
1510
1535
  </choice>
1511
- </zeroOrMore>
1512
- </group>
1536
+ </oneOrMore>
1537
+ </choice>
1513
1538
  </define>
1514
1539
  <define name="Annex-Section">
1515
1540
  <optional>
@@ -101,7 +101,11 @@
101
101
  <ref name="definitions"/>
102
102
  </optional>
103
103
  <oneOrMore>
104
- <ref name="clause"/>
104
+ <choice>
105
+ <ref name="clause"/>
106
+ <ref name="term-clause"/>
107
+ <ref name="terms"/>
108
+ </choice>
105
109
  </oneOrMore>
106
110
  </element>
107
111
  </define>
@@ -136,7 +140,7 @@
136
140
  <optional>
137
141
  <ref name="section-title"/>
138
142
  </optional>
139
- <group>
143
+ <choice>
140
144
  <choice>
141
145
  <group>
142
146
  <oneOrMore>
@@ -151,7 +155,7 @@
151
155
  <oneOrMore>
152
156
  <ref name="clause-subsection"/>
153
157
  </oneOrMore>
154
- </group>
158
+ </choice>
155
159
  </define>
156
160
  <define name="term">
157
161
  <element name="term">
@@ -3643,6 +3643,7 @@
3643
3643
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3644
3644
 
3645
3645
 
3646
+
3646
3647
  <xsl:attribute name="border">solid black 0.5pt</xsl:attribute>
3647
3648
 
3648
3649
 
@@ -3658,6 +3659,10 @@
3658
3659
 
3659
3660
 
3660
3661
 
3662
+
3663
+ <!-- for BSI (not PAS) display Notes before footnotes -->
3664
+
3665
+
3661
3666
  <!-- except gb -->
3662
3667
 
3663
3668
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -3689,6 +3694,10 @@
3689
3694
  <!-- fn processing -->
3690
3695
  <xsl:call-template name="fn_display"/>
3691
3696
 
3697
+
3698
+ <!-- for PAS display Notes after footnotes -->
3699
+
3700
+
3692
3701
  </fo:table-cell>
3693
3702
  </fo:table-row>
3694
3703
  </fo:table-body>
@@ -3749,6 +3758,7 @@
3749
3758
  <xsl:if test="$parent-name = 'tfoot'">
3750
3759
 
3751
3760
 
3761
+
3752
3762
  <xsl:attribute name="border-left">solid black 0.5pt</xsl:attribute>
3753
3763
  <xsl:attribute name="border-right">solid black 0.5pt</xsl:attribute>
3754
3764
 
@@ -3895,6 +3905,7 @@
3895
3905
 
3896
3906
 
3897
3907
 
3908
+
3898
3909
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3899
3910
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3900
3911
 
@@ -3902,8 +3913,12 @@
3902
3913
 
3903
3914
 
3904
3915
 
3916
+ <!-- Table's note name (NOTE, for example) -->
3917
+
3905
3918
  <fo:inline padding-right="2mm">
3906
3919
 
3920
+
3921
+
3907
3922
 
3908
3923
 
3909
3924
 
@@ -3911,6 +3926,8 @@
3911
3926
 
3912
3927
  </fo:inline>
3913
3928
 
3929
+
3930
+
3914
3931
  <xsl:apply-templates mode="process"/>
3915
3932
  </fo:block>
3916
3933
 
@@ -3930,6 +3947,8 @@
3930
3947
  <xsl:variable name="reference" select="@reference"/>
3931
3948
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3932
3949
  <fo:block margin-bottom="12pt">
3950
+
3951
+
3933
3952
 
3934
3953
 
3935
3954
 
@@ -3955,6 +3974,7 @@
3955
3974
  <xsl:value-of select="@reference"/>
3956
3975
 
3957
3976
 
3977
+
3958
3978
  </fo:inline>
3959
3979
  <fo:inline>
3960
3980
 
@@ -4119,6 +4139,7 @@
4119
4139
 
4120
4140
  <xsl:value-of select="@reference"/>
4121
4141
 
4142
+
4122
4143
  </fo:basic-link>
4123
4144
  </fo:inline>
4124
4145
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -5146,6 +5167,7 @@
5146
5167
 
5147
5168
 
5148
5169
 
5170
+
5149
5171
  <fo:block-container margin-left="0mm">
5150
5172
 
5151
5173
 
@@ -6350,9 +6372,10 @@
6350
6372
 
6351
6373
 
6352
6374
  </xsl:if>
6353
-
6375
+
6376
+
6377
+
6354
6378
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6355
-
6356
6379
  <xsl:if test="normalize-space(@citeas) = ''">
6357
6380
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6358
6381
  </xsl:if>
@@ -6360,6 +6383,7 @@
6360
6383
 
6361
6384
 
6362
6385
 
6386
+
6363
6387
  </xsl:if>
6364
6388
 
6365
6389
  <xsl:apply-templates/>
@@ -7275,4 +7299,100 @@
7275
7299
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7276
7300
  </xsl:choose>
7277
7301
  </xsl:attribute>
7302
+ </xsl:template><xsl:template name="number-to-words">
7303
+ <xsl:param name="number"/>
7304
+ <xsl:param name="first"/>
7305
+ <xsl:if test="$number != ''">
7306
+ <xsl:variable name="words">
7307
+ <words>
7308
+ <word cardinal="1">One-</word>
7309
+ <word ordinal="1">First </word>
7310
+ <word cardinal="2">Two-</word>
7311
+ <word ordinal="2">Second </word>
7312
+ <word cardinal="3">Three-</word>
7313
+ <word ordinal="3">Third </word>
7314
+ <word cardinal="4">Four-</word>
7315
+ <word ordinal="4">Fourth </word>
7316
+ <word cardinal="5">Five-</word>
7317
+ <word ordinal="5">Fifth </word>
7318
+ <word cardinal="6">Six-</word>
7319
+ <word ordinal="6">Sixth </word>
7320
+ <word cardinal="7">Seven-</word>
7321
+ <word ordinal="7">Seventh </word>
7322
+ <word cardinal="8">Eight-</word>
7323
+ <word ordinal="8">Eighth </word>
7324
+ <word cardinal="9">Nine-</word>
7325
+ <word ordinal="9">Ninth </word>
7326
+ <word ordinal="10">Tenth </word>
7327
+ <word ordinal="11">Eleventh </word>
7328
+ <word ordinal="12">Twelfth </word>
7329
+ <word ordinal="13">Thirteenth </word>
7330
+ <word ordinal="14">Fourteenth </word>
7331
+ <word ordinal="15">Fifteenth </word>
7332
+ <word ordinal="16">Sixteenth </word>
7333
+ <word ordinal="17">Seventeenth </word>
7334
+ <word ordinal="18">Eighteenth </word>
7335
+ <word ordinal="19">Nineteenth </word>
7336
+ <word cardinal="20">Twenty-</word>
7337
+ <word ordinal="20">Twentieth </word>
7338
+ <word cardinal="30">Thirty-</word>
7339
+ <word ordinal="30">Thirtieth </word>
7340
+ <word cardinal="40">Forty-</word>
7341
+ <word ordinal="40">Fortieth </word>
7342
+ <word cardinal="50">Fifty-</word>
7343
+ <word ordinal="50">Fiftieth </word>
7344
+ <word cardinal="60">Sixty-</word>
7345
+ <word ordinal="60">Sixtieth </word>
7346
+ <word cardinal="70">Seventy-</word>
7347
+ <word ordinal="70">Seventieth </word>
7348
+ <word cardinal="80">Eighty-</word>
7349
+ <word ordinal="80">Eightieth </word>
7350
+ <word cardinal="90">Ninety-</word>
7351
+ <word ordinal="90">Ninetieth </word>
7352
+ <word cardinal="100">Hundred-</word>
7353
+ <word ordinal="100">Hundredth </word>
7354
+ </words>
7355
+ </xsl:variable>
7356
+
7357
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
7358
+
7359
+ <xsl:variable name="value">
7360
+ <xsl:choose>
7361
+ <xsl:when test="$ordinal != ''">
7362
+ <xsl:value-of select="$ordinal"/>
7363
+ </xsl:when>
7364
+ <xsl:otherwise>
7365
+ <xsl:choose>
7366
+ <xsl:when test="$number &lt; 100">
7367
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
7368
+ <xsl:variable name="digit" select="substring($number,2)"/>
7369
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
7370
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
7371
+ </xsl:when>
7372
+ <xsl:otherwise>
7373
+ <!-- more 100 -->
7374
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
7375
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
7376
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
7377
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
7378
+ <xsl:call-template name="number-to-words">
7379
+ <xsl:with-param name="number" select="$digits"/>
7380
+ </xsl:call-template>
7381
+ </xsl:otherwise>
7382
+ </xsl:choose>
7383
+ </xsl:otherwise>
7384
+ </xsl:choose>
7385
+ </xsl:variable>
7386
+ <xsl:choose>
7387
+ <xsl:when test="$first = 'true'">
7388
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
7389
+ <xsl:call-template name="capitalize">
7390
+ <xsl:with-param name="str" select="$value_lc"/>
7391
+ </xsl:call-template>
7392
+ </xsl:when>
7393
+ <xsl:otherwise>
7394
+ <xsl:value-of select="$value"/>
7395
+ </xsl:otherwise>
7396
+ </xsl:choose>
7397
+ </xsl:if>
7278
7398
  </xsl:template></xsl:stylesheet>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "1.3.6".freeze
3
+ VERSION = "1.3.7".freeze
4
4
  end
5
5
  end
6
6
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
29
29
 
30
- spec.add_dependency "metanorma-iso", "~> 1.8.6"
30
+ spec.add_dependency "metanorma-iso", "~> 1.9.0"
31
31
  spec.add_dependency "ruby-jing"
32
32
 
33
33
  spec.add_development_dependency "byebug"
@@ -5,25 +5,29 @@ RSpec.describe IsoDoc do
5
5
  it "generates file based on string input" do
6
6
  FileUtils.rm_f "test.doc"
7
7
  FileUtils.rm_f "test.html"
8
- IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
9
- <iso-standard xmlns="http://riboseinc.com/isoxml">
10
- <bibdata>
11
- <title>
12
- <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
13
- <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
14
- <title type="title-part" language="en" format="text/plain">Rice</title>
15
- </title>
16
- </bibdata>
17
- <preface><foreword>
18
- <note>
19
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
20
- </note>
21
- </foreword></preface>
22
- </iso-standard>
8
+ input = <<~INPUT
9
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
10
+ <bibdata>
11
+ <title>
12
+ <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
13
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
14
+ <title type="title-part" language="en" format="text/plain">Rice</title>
15
+ </title>
16
+ </bibdata>
17
+ <preface><foreword>
18
+ <note>
19
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
20
+ </note>
21
+ </foreword></preface>
22
+ </iso-standard>
23
23
  INPUT
24
+ IsoDoc::Iec::HtmlConvert
25
+ .new({ wordstylesheet: "spec/assets/word.css",
26
+ htmlstylesheet: "spec/assets/html.css", filename: "test" })
27
+ .convert("test", input, false)
24
28
  expect(File.exist?("test.html")).to be true
25
29
  html = File.read("test.html", encoding: "UTF-8")
26
- expect(html).to match(%r{<title>Cereals and pulses\&#xA0;\&#x2014; Specifications and test methods\&#xA0;\&#x2014; Rice</title>})
30
+ expect(html).to match(%r{<title>Cereals and pulses&#xA0;&#x2014; Specifications and test methods&#xA0;&#x2014; Rice</title>})
27
31
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
28
32
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
29
33
  end
@@ -31,25 +35,29 @@ RSpec.describe IsoDoc do
31
35
  it "generates HTML output docs with null configuration" do
32
36
  FileUtils.rm_f "test.doc"
33
37
  FileUtils.rm_f "test.html"
34
- IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
35
- <iso-standard xmlns="http://riboseinc.com/isoxml">
36
- <bibdata>
37
- <title>
38
- <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
39
- <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
40
- <title type="title-part" language="en" format="text/plain">Rice</title>
41
- </title>
42
- </bibdata>
43
- <preface><foreword>
44
- <note>
45
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
46
- </note>
47
- </foreword></preface>
48
- </iso-standard>
38
+ input = <<~INPUT
39
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
40
+ <bibdata>
41
+ <title>
42
+ <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
43
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
44
+ <title type="title-part" language="en" format="text/plain">Rice</title>
45
+ </title>
46
+ </bibdata>
47
+ <preface><foreword>
48
+ <note>
49
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
50
+ </note>
51
+ </foreword></preface>
52
+ </iso-standard>
49
53
  INPUT
54
+ IsoDoc::Iec::HtmlConvert
55
+ .new({ wordstylesheet: "spec/assets/word.css",
56
+ htmlstylesheet: "spec/assets/html.css" })
57
+ .convert("test", input, false)
50
58
  expect(File.exist?("test.html")).to be true
51
59
  html = File.read("test.html", encoding: "UTF-8")
52
- expect(html).to match(%r{<title>Cereals and pulses\&#xA0;\&#x2014; Specifications and test methods\&#xA0;\&#x2014; Rice</title>})
60
+ expect(html).to match(%r{<title>Cereals and pulses&#xA0;&#x2014; Specifications and test methods&#xA0;&#x2014; Rice</title>})
53
61
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
54
62
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
55
63
  end
@@ -57,15 +65,19 @@ RSpec.describe IsoDoc do
57
65
  it "generates Word output docs with null configuration" do
58
66
  FileUtils.rm_f "test.doc"
59
67
  FileUtils.rm_f "test.html"
60
- IsoDoc::Iec::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
61
- <iso-standard xmlns="http://riboseinc.com/isoxml">
62
- <preface><foreword>
63
- <note>
64
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
65
- </note>
66
- </foreword></preface>
67
- </iso-standard>
68
+ input = <<~INPUT
69
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
70
+ <preface><foreword>
71
+ <note>
72
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
73
+ </note>
74
+ </foreword></preface>
75
+ </iso-standard>
68
76
  INPUT
77
+ IsoDoc::Iec::WordConvert
78
+ .new({ wordstylesheet: "spec/assets/word.css",
79
+ htmlstylesheet: "spec/assets/html.css" })
80
+ .convert("test", input, false)
69
81
  expect(File.exist?("test.doc")).to be true
70
82
  word = File.read("test.doc", encoding: "UTF-8")
71
83
  expect(word).to match(/<style>/)
@@ -74,7 +86,9 @@ RSpec.describe IsoDoc do
74
86
  it "generates HTML output docs with null configuration from file" do
75
87
  FileUtils.rm_f "spec/assets/iso.doc"
76
88
  FileUtils.rm_f "spec/assets/iso.html"
77
- IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "word.css", htmlstylesheet: "html.css"}).convert("spec/assets/iso.xml", nil, false)
89
+ IsoDoc::Iec::HtmlConvert
90
+ .new({ wordstylesheet: "word.css", htmlstylesheet: "html.css" })
91
+ .convert("spec/assets/iso.xml", nil, false)
78
92
  expect(File.exist?("spec/assets/iso.html")).to be true
79
93
  html = File.read("spec/assets/iso.html", encoding: "UTF-8")
80
94
  expect(html).to match(/<style>/)
@@ -84,198 +98,213 @@ RSpec.describe IsoDoc do
84
98
 
85
99
  it "generates Word output docs with null configuration from file" do
86
100
  FileUtils.rm_f "spec/assets/iso.doc"
87
- IsoDoc::Iec::WordConvert.new({wordstylesheet: "word.css", htmlstylesheet: "html.css"}).convert("spec/assets/iso.xml", nil, false)
101
+ IsoDoc::Iec::WordConvert
102
+ .new({ wordstylesheet: "word.css", htmlstylesheet: "html.css" })
103
+ .convert("spec/assets/iso.xml", nil, false)
88
104
  expect(File.exist?("spec/assets/iso.doc")).to be true
89
105
  word = File.read("spec/assets/iso.doc", encoding: "UTF-8")
90
106
  expect(word).to match(/<w:WordDocument>/)
91
107
  expect(word).to match(/<style>/)
92
108
  end
93
109
 
94
- it "generates Pdf output docs with null configuration from file" do
110
+ it "generates Pdf output docs with null configuration from file" do
95
111
  FileUtils.rm_f "spec/assets/iso.pdf"
96
- IsoDoc::Iec::PdfConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
112
+ IsoDoc::Iec::PdfConvert
113
+ .new({ wordstylesheet: "spec/assets/word.css",
114
+ htmlstylesheet: "spec/assets/html.css" })
115
+ .convert("spec/assets/iso.xml", nil, false)
97
116
  expect(File.exist?("spec/assets/iso.pdf")).to be true
98
117
  end
99
118
 
100
119
  it "populates Word template with terms reference labels" do
101
120
  FileUtils.rm_f "test.doc"
102
121
  FileUtils.rm_f "test.html"
103
- IsoDoc::Iec::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
104
- <iso-standard xmlns="http://riboseinc.com/isoxml">
105
- <sections>
106
- <terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
107
-
108
- <term id="paddy1">
109
- <name>1.1</name>
110
- <preferred>paddy</preferred>
111
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
112
- <termsource status="modified">
113
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
114
- <modification>
115
- <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>
116
- </modification>
117
- </termsource></term>
118
-
119
- </terms>
120
- </sections>
121
- </iso-standard>
122
-
122
+ input = <<~INPUT
123
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
124
+ <sections>
125
+ <terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
126
+ <term id="paddy1">
127
+ <name>1.1</name>
128
+ <preferred>paddy</preferred>
129
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
130
+ <termsource status="modified">
131
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
132
+ <modification>
133
+ <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>
134
+ </modification>
135
+ </termsource></term>
136
+ </terms>
137
+ </sections>
138
+ </iso-standard>
123
139
  INPUT
124
- word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
125
- sub(%r{<br.*$}m, "")
140
+ IsoDoc::Iec::WordConvert
141
+ .new({ wordstylesheet: "spec/assets/word.css",
142
+ htmlstylesheet: "spec/assets/html.css" })
143
+ .convert("test", input, false)
144
+ word = File.read("test.doc", encoding: "UTF-8")
145
+ .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
146
+ .sub(%r{<br.*$}m, "")
126
147
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
127
- <div class="WordSection3">
128
- #{IEC_TITLE1.gsub(/\&#160;/, "&#xA0;")}
129
- <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1 class="main">1<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1>
130
- <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
131
- <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
132
- <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified &#x2014; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
133
- </div>
148
+ <div class="WordSection3">
149
+ #{IEC_TITLE1.gsub(/&#160;/, '&#xA0;')}
150
+ <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1 class="main">1<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1>
151
+ <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
152
+ <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
153
+ <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified &#x2014; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
154
+ </div>
134
155
  OUTPUT
135
156
  end
136
157
 
137
158
  it "processes IsoXML terms for HTML" do
138
159
  FileUtils.rm_f "test.html"
139
160
  FileUtils.rm_f "test.doc"
140
- IsoDoc::Iec::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
141
- <iso-standard xmlns="http://riboseinc.com/isoxml">
142
- <sections>
143
- <terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
144
-
145
- <term id="paddy1">
146
- <name>1.1</name>
147
- <preferred>paddy</preferred>
148
- <domain>rice</domain>
149
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
150
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
151
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
152
- <ul>
153
- <li>A</li>
154
- </ul>
155
- </termexample>
156
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
157
- <ul>
158
- <li>A</li>
159
- </ul>
160
- </termexample>
161
-
162
- <termsource status="modified">
163
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
164
- <modification>
165
- <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>
166
- </modification>
167
- </termsource></term>
168
-
169
- <term id="paddy">
170
- <name>1.2</name>
171
- <preferred>paddy</preferred><admitted>paddy rice</admitted>
172
- <admitted>rough rice</admitted>
173
- <deprecates>cargo rice</deprecates>
174
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
175
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
176
- <ul>
177
- <li>A</li>
178
- </ul>
179
- </termexample>
180
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
181
- <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>
182
- </termnote>
183
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
184
- <ul><li>A</li></ul>
185
- <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>
186
- </termnote>
187
- <termsource status="identical">
188
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
189
- </termsource></term>
190
- </terms>
191
- </sections>
192
- </iso-standard>
161
+ input = <<~INPUT
162
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
163
+ <sections>
164
+ <terms id="_terms_and_definitions" obligation="normative"><title>1<tab/>Terms and Definitions</title>
165
+ <term id="paddy1">
166
+ <name>1.1</name>
167
+ <preferred>paddy</preferred>
168
+ <domain>rice</domain>
169
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
170
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
171
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
172
+ <ul>
173
+ <li>A</li>
174
+ </ul>
175
+ </termexample>
176
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
177
+ <ul>
178
+ <li>A</li>
179
+ </ul>
180
+ </termexample>
181
+ <termsource status="modified">
182
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
183
+ <modification>
184
+ <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>
185
+ </modification>
186
+ </termsource></term>
187
+ <term id="paddy">
188
+ <name>1.2</name>
189
+ <preferred>paddy</preferred><admitted>paddy rice</admitted>
190
+ <admitted>rough rice</admitted>
191
+ <deprecates>cargo rice</deprecates>
192
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
193
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
194
+ <ul>
195
+ <li>A</li>
196
+ </ul>
197
+ </termexample>
198
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
199
+ <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>
200
+ </termnote>
201
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
202
+ <ul><li>A</li></ul>
203
+ <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>
204
+ </termnote>
205
+ <termsource status="identical">
206
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
207
+ </termsource></term>
208
+ </terms>
209
+ </sections>
210
+ </iso-standard>
193
211
  INPUT
212
+ IsoDoc::Iec::HtmlConvert
213
+ .new({ wordstylesheet: "spec/assets/word.css",
214
+ htmlstylesheet: "spec/assets/html.css" })
215
+ .convert("test", input, false)
194
216
  expect(File.exist?("test.html")).to be true
195
217
  html = File.read("test.html", encoding: "UTF-8")
196
218
  expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
197
219
  expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2</h2>})
198
220
  end
199
221
 
200
- it "inserts default paragraph between two tables for Word" do
222
+ it "inserts default paragraph between two tables for Word" do
201
223
  FileUtils.rm_f "test.doc"
202
224
  FileUtils.rm_f "test.html"
203
- IsoDoc::Iec::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
204
- <iso-standard xmlns="http://riboseinc.com/isoxml">
205
- <annex id="P" inline-header="false" obligation="normative">
206
- <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
207
- <p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
208
- </example>
209
- <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
210
- <p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
211
- </example>
212
- </annex>
213
- </iso-standard>
225
+ input = <<~INPUT
226
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
227
+ <annex id="P" inline-header="false" obligation="normative">
228
+ <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
229
+ <p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
230
+ </example>
231
+ <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
232
+ <p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
233
+ </example>
234
+ </annex>
235
+ </iso-standard>
214
236
  INPUT
215
- word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
216
- sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
237
+ IsoDoc::Iec::WordConvert
238
+ .new({ wordstylesheet: "spec/assets/word.css",
239
+ htmlstylesheet: "spec/assets/html.css" })
240
+ .convert("test", input, false)
241
+ word = File.read("test.doc", encoding: "UTF-8")
242
+ .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
243
+ .sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
217
244
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
218
- <div class="WordSection3">
219
- #{IEC_TITLE1.gsub(/\&#160;/, "&#xA0;")}
220
- <p class="MsoNormal">
221
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
222
- </p>
223
- <div class="Section3"><a name="P" id="P"></a>
224
- <div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
225
- <p class="example"><span style="mso-tab-count:1">&#xA0; </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
226
- </div>
227
- <div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
228
- <p class="example"><span style="mso-tab-count:1">&#xA0; </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
245
+ <div class="WordSection3">
246
+ #{IEC_TITLE1.gsub(/&#160;/, '&#xA0;')}
247
+ <p class="MsoNormal">
248
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
249
+ </p>
250
+ <div class="Section3"><a name="P" id="P"></a>
251
+ <div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
252
+ <p class="example"><span style="mso-tab-count:1">&#xA0; </span>'1M', '01M', and '0001M' all describe the calendar month January.</p>
253
+ </div>
254
+ <div class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
255
+ <p class="example"><span style="mso-tab-count:1">&#xA0; </span>'2M', '02M', and '0002M' all describe the calendar month February.</p>
256
+ </div>
229
257
  </div>
230
258
  </div>
231
- </div>
232
259
  OUTPUT
233
260
  end
234
261
 
235
- it "processes source code in tables (Word)" do
236
- FileUtils.rm_f "test.doc"
262
+ it "processes source code in tables (Word)" do
263
+ FileUtils.rm_f "test.doc"
237
264
  FileUtils.rm_f "test.html"
238
- IsoDoc::Iec::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
239
- <iso-standard xmlns="http://riboseinc.com/isoxml">
240
- <annex id="P" inline-header="false" obligation="normative">
241
- <sourcecode lang="ruby" id="A">puts "Hello, world."</sourcecode>
242
- <table id="samplecode">
243
- <tbody>
244
- <tr><td>
245
- <sourcecode lang="ruby" id="B">puts "Hello, world."</sourcecode>
246
- </td></tr>
247
- </tbody>
248
- </table>
249
- </annex>
250
- </iso-standard>
265
+ input = <<~INPUT
266
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
267
+ <annex id="P" inline-header="false" obligation="normative">
268
+ <sourcecode lang="ruby" id="A">puts "Hello, world."</sourcecode>
269
+ <table id="samplecode">
270
+ <tbody>
271
+ <tr><td>
272
+ <sourcecode lang="ruby" id="B">puts "Hello, world."</sourcecode>
273
+ </td></tr>
274
+ </tbody>
275
+ </table>
276
+ </annex>
277
+ </iso-standard>
251
278
  INPUT
252
- word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
253
- sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
279
+ IsoDoc::Iec::WordConvert
280
+ .new({ wordstylesheet: "spec/assets/word.css",
281
+ htmlstylesheet: "spec/assets/html.css" })
282
+ .convert("test", input, false)
283
+ word = File.read("test.doc", encoding: "UTF-8")
284
+ .sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">')
285
+ .sub(%r{<br[^>]*>\s*<div class="colophon">.*$}m, "")
254
286
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
255
- <div class="WordSection3">
256
- #{IEC_TITLE1.gsub(/\&#160;/, "&#xA0;")}
257
- <p class="MsoNormal">
258
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
259
- </p>
260
- <div class="Section3"><a name="P" id="P"></a>
261
- <p class="Sourcecode"><a name="A" id="A"></a>puts "Hello, world."</p>
262
- <div align='center' class='table_container'>
263
- <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
264
- <a name='samplecode' id='samplecode'/>
265
- <tbody>
266
- <tr>
267
- <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;" class="TABLE-cell">
268
- <p class="CODE-TableCell"><a name="B" id="B"></a>puts "Hello, world."</p>
269
- </td>
270
- </tr>
271
- </tbody>
272
- </table>
287
+ <div class="WordSection3">
288
+ #{IEC_TITLE1.gsub(/&#160;/, '&#xA0;')}
289
+ <p class="MsoNormal">
290
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
291
+ </p>
292
+ <div class="Section3"><a name="P" id="P"></a>
293
+ <p class="Sourcecode"><a name="A" id="A"></a>puts "Hello, world."</p>
294
+ <div align='center' class='table_container'>
295
+ <table class='MsoISOTable' style='mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
296
+ <a name='samplecode' id='samplecode'/>
297
+ <tbody>
298
+ <tr>
299
+ <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;" class="TABLE-cell">
300
+ <p class="CODE-TableCell"><a name="B" id="B"></a>puts "Hello, world."</p>
301
+ </td>
302
+ </tr>
303
+ </tbody>
304
+ </table>
305
+ </div>
273
306
  </div>
274
307
  </div>
275
- </div>
276
308
  OUTPUT
277
- end
278
-
279
-
280
-
309
+ end
281
310
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-05 00:00:00.000000000 Z
11
+ date: 2021-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.8.6
19
+ version: 1.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.8.6
26
+ version: 1.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-jing
29
29
  requirement: !ruby/object:Gem::Requirement