metanorma-iec 1.3.0 → 1.3.1

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: 896831ab7585bc0d95fa10bcef8ba276bc624f6b5b51534e136177f43c74723c
4
- data.tar.gz: 2dec389207942c399e02b6cb085541f6255715f3cbb0c6c1ee8dfe29204b618d
3
+ metadata.gz: bc0ee8f0d0923ed5a23f0e0b2b848f7638a3145b9bd5d76b164df2aa52d9c23c
4
+ data.tar.gz: a784c0a3ffa08411f53f7375cd1ff00b23bcd5e5170123a7c8fc7735b307ba25
5
5
  SHA512:
6
- metadata.gz: ca103b07a7421e67ec218b8a759fc51d997eab8185a11c0bff0fefa6f1b632ea4bd614e61028b1b94e6f372f3c73c8a7ea9a772a507cdff883d0a14d502a9717
7
- data.tar.gz: ffad29f88e9171b636abf4fb7d1b85fe5a6627fd71fdbadf53cb612cae032b6f1481a3bf3dc950ea3623f93bbd45a87a4c9467358022cc250daffeac25cec956
6
+ metadata.gz: 27986c3e678e1c211b1dead573d496997296f2c3e8226b5550dcf673a4149921d963e49551c91d1063d68655ddeb0015ed007e019bf93f5bc28501a1c4e6c7fe
7
+ data.tar.gz: b22477bc92a6b47a268400a5ced0c89b306cd8b9a8fbdfec73bcc32e51de1ee6c10d91e6ef968fc6cc904a158999815a36b1abe37017fb20fcbaebc0b826383a
@@ -6,7 +6,7 @@ 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, node, !node.attr("publisher")) }
9
+ c.organization { |a| organization(a, p, false, node, !node.attr("publisher")) }
10
10
  end
11
11
  end
12
12
  end
@@ -16,19 +16,21 @@ module Asciidoctor
16
16
  csv_split(publishers)&.each do |p|
17
17
  xml.contributor do |c|
18
18
  c.role **{ type: "publisher" }
19
- c.organization { |a| organization(a, p, node, !node.attr("publisher")) }
19
+ c.organization { |a| organization(a, p, true, node, !node.attr("publisher")) }
20
20
  end
21
21
  end
22
22
  end
23
23
 
24
24
  def metadata_copyright(node, xml)
25
- publishers = node.attr("copyright-holder") || node.attr("publisher") || "IEC"
25
+ publishers = node.attr("copyright-holder") || node.attr("publisher") ||
26
+ "IEC"
26
27
  csv_split(publishers)&.each do |p|
27
28
  xml.copyright do |c|
28
29
  c.from (node.attr("copyright-year") || Date.today.year)
29
30
  c.owner do |owner|
30
31
  owner.organization do |o|
31
- organization(o, p, node, !node.attr("copyright-holder") || node.attr("publisher"))
32
+ organization(o, p, true, node, !node.attr("copyright-holder") ||
33
+ node.attr("publisher"))
32
34
  end
33
35
  end
34
36
  end
@@ -37,6 +39,7 @@ module Asciidoctor
37
39
 
38
40
  def iso_id(node, xml)
39
41
  return unless node.attr("docnumber")
42
+
40
43
  part, subpart = node&.attr("partnumber")&.split(/-/)
41
44
  dn = add_id_parts(node.attr("docnumber"), part, subpart)
42
45
  dn = id_stage_prefix(dn, node, false)
@@ -111,6 +114,7 @@ module Asciidoctor
111
114
 
112
115
  def status_abbrev1(stage, substage, iter, doctype, draft)
113
116
  return "" unless stage
117
+
114
118
  abbr = STAGE_ABBRS.dig(stage, substage) || "??"
115
119
  if stage == "35" && substage == "92"
116
120
  iter = (iter.to_i + 1) % "02"
@@ -136,6 +140,7 @@ module Asciidoctor
136
140
 
137
141
  def stage_abbr(stage, substage)
138
142
  return "PPUB" if stage == "60"
143
+
139
144
  DOC_STAGE[stage.to_sym] || "??"
140
145
  end
141
146
 
@@ -188,7 +193,8 @@ module Asciidoctor
188
193
 
189
194
  def metadata_ext(node, xml)
190
195
  super
191
- a = node.attr("accessibility-color-inside") and xml.accessibility_color_inside a
196
+ a = node.attr("accessibility-color-inside") and
197
+ xml.accessibility_color_inside a
192
198
  a = node.attr("price-code") and xml.price_code a
193
199
  a = node.attr("cen-processing") and xml.cen_processing a
194
200
  a = node.attr("secretary") and xml.secretary a
@@ -2636,6 +2636,7 @@
2636
2636
  </xsl:choose>
2637
2637
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
2638
2638
 
2639
+
2639
2640
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2640
2641
 
2641
2642
 
@@ -2966,13 +2967,25 @@
2966
2967
 
2967
2968
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2968
2969
 
2969
- </xsl:attribute-set><xsl:attribute-set name="add-style">
2970
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2971
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2972
+ </xsl:variable><xsl:attribute-set name="add-style">
2970
2973
  <xsl:attribute name="color">red</xsl:attribute>
2971
2974
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2972
- </xsl:attribute-set><xsl:attribute-set name="del-style">
2973
- <xsl:attribute name="color">red</xsl:attribute>
2975
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2976
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2977
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2978
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2979
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2980
+ <xsl:text>red</xsl:text>
2981
+ </xsl:variable><xsl:attribute-set name="del-style">
2982
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2974
2983
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2975
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2984
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2985
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2986
+
2987
+
2988
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2976
2989
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2977
2990
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2978
2991
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3017,16 +3030,17 @@
3017
3030
  <xsl:call-template name="add-zero-spaces-java"/>
3018
3031
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3019
3032
 
3033
+ <xsl:variable name="table-preamble">
3034
+
3035
+
3036
+ </xsl:variable>
3037
+
3020
3038
  <xsl:variable name="table">
3021
3039
 
3022
3040
  <xsl:variable name="simple-table">
3023
3041
  <xsl:call-template name="getSimpleTable"/>
3024
3042
  </xsl:variable>
3025
3043
 
3026
-
3027
-
3028
-
3029
-
3030
3044
  <!-- <xsl:if test="$namespace = 'bipm'">
3031
3045
  <fo:block>&#xA0;</fo:block>
3032
3046
  </xsl:if> -->
@@ -3041,7 +3055,7 @@
3041
3055
 
3042
3056
 
3043
3057
 
3044
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3058
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3045
3059
 
3046
3060
  <!-- <xsl:variable name="cols-count">
3047
3061
  <xsl:choose>
@@ -3060,8 +3074,6 @@
3060
3074
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3061
3075
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3062
3076
 
3063
-
3064
-
3065
3077
  <xsl:variable name="colwidths">
3066
3078
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3067
3079
  <xsl:call-template name="calculate-column-widths">
@@ -3089,6 +3101,7 @@
3089
3101
  </xsl:choose>
3090
3102
  </xsl:variable>
3091
3103
 
3104
+
3092
3105
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3093
3106
 
3094
3107
 
@@ -3124,6 +3137,7 @@
3124
3137
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3125
3138
 
3126
3139
 
3140
+
3127
3141
  <attribute name="border">0.5pt solid black</attribute>
3128
3142
 
3129
3143
 
@@ -3217,7 +3231,8 @@
3217
3231
  </fo:block-container>
3218
3232
  </xsl:variable>
3219
3233
 
3220
-
3234
+ <xsl:variable name="isAdded" select="@added"/>
3235
+ <xsl:variable name="isDeleted" select="@deleted"/>
3221
3236
 
3222
3237
  <xsl:choose>
3223
3238
  <xsl:when test="@width">
@@ -3231,7 +3246,14 @@
3231
3246
  <fo:table-body>
3232
3247
  <fo:table-row>
3233
3248
  <fo:table-cell column-number="2">
3234
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3249
+ <xsl:copy-of select="$table-preamble"/>
3250
+ <fo:block>
3251
+ <xsl:call-template name="setTrackChangesStyles">
3252
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3253
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3254
+ </xsl:call-template>
3255
+ <xsl:copy-of select="$table"/>
3256
+ </fo:block>
3235
3257
  </fo:table-cell>
3236
3258
  </fo:table-row>
3237
3259
  </fo:table-body>
@@ -3242,7 +3264,22 @@
3242
3264
 
3243
3265
  </xsl:when>
3244
3266
  <xsl:otherwise>
3245
- <xsl:copy-of select="$table"/>
3267
+ <xsl:choose>
3268
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3269
+ <xsl:copy-of select="$table-preamble"/>
3270
+ <fo:block>
3271
+ <xsl:call-template name="setTrackChangesStyles">
3272
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3273
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3274
+ </xsl:call-template>
3275
+ <xsl:copy-of select="$table"/>
3276
+ </fo:block>
3277
+ </xsl:when>
3278
+ <xsl:otherwise>
3279
+ <xsl:copy-of select="$table-preamble"/>
3280
+ <xsl:copy-of select="$table"/>
3281
+ </xsl:otherwise>
3282
+ </xsl:choose>
3246
3283
  </xsl:otherwise>
3247
3284
  </xsl:choose>
3248
3285
 
@@ -3303,7 +3340,7 @@
3303
3340
  </xsl:for-each>
3304
3341
  </xsl:when>
3305
3342
  <xsl:otherwise>
3306
- <xsl:for-each select="xalan:nodeset($table)//tr">
3343
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3307
3344
  <xsl:variable name="td_text">
3308
3345
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3309
3346
 
@@ -3673,7 +3710,8 @@
3673
3710
  <xsl:attribute name="text-align">
3674
3711
  <xsl:choose>
3675
3712
  <xsl:when test="@align">
3676
- <xsl:value-of select="@align"/>
3713
+ <xsl:call-template name="setAlignment"/>
3714
+ <!-- <xsl:value-of select="@align"/> -->
3677
3715
  </xsl:when>
3678
3716
  <xsl:otherwise>center</xsl:otherwise>
3679
3717
  </xsl:choose>
@@ -3697,6 +3735,9 @@
3697
3735
 
3698
3736
 
3699
3737
 
3738
+ <xsl:if test="$lang = 'ar'">
3739
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3740
+ </xsl:if>
3700
3741
  <xsl:if test="@colspan">
3701
3742
  <xsl:attribute name="number-columns-spanned">
3702
3743
  <xsl:value-of select="@colspan"/>
@@ -3728,11 +3769,15 @@
3728
3769
  <xsl:attribute name="text-align">
3729
3770
  <xsl:choose>
3730
3771
  <xsl:when test="@align">
3731
- <xsl:value-of select="@align"/>
3772
+ <xsl:call-template name="setAlignment"/>
3773
+ <!-- <xsl:value-of select="@align"/> -->
3732
3774
  </xsl:when>
3733
3775
  <xsl:otherwise>left</xsl:otherwise>
3734
3776
  </xsl:choose>
3735
3777
  </xsl:attribute>
3778
+ <xsl:if test="$lang = 'ar'">
3779
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3780
+ </xsl:if>
3736
3781
  <!-- and ancestor::*[local-name() = 'thead'] -->
3737
3782
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3738
3783
 
@@ -3755,6 +3800,9 @@
3755
3800
 
3756
3801
 
3757
3802
 
3803
+ <xsl:if test=".//*[local-name() = 'table']">
3804
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3805
+ </xsl:if>
3758
3806
  <xsl:if test="@colspan">
3759
3807
  <xsl:attribute name="number-columns-spanned">
3760
3808
  <xsl:value-of select="@colspan"/>
@@ -3891,13 +3939,13 @@
3891
3939
  </xsl:choose>
3892
3940
  </xsl:variable>
3893
3941
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3894
- <xsl:element name="{$ns}:table">
3942
+ <!-- <xsl:element name="{$ns}:table"> -->
3895
3943
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3896
3944
  <tbody>
3897
3945
  <xsl:apply-templates mode="dl"/>
3898
3946
  </tbody>
3899
3947
  </xsl:for-each>
3900
- </xsl:element>
3948
+ <!-- </xsl:element> -->
3901
3949
  </xsl:variable>
3902
3950
 
3903
3951
  <xsl:call-template name="calculate-column-widths">
@@ -4003,6 +4051,8 @@
4003
4051
  <xsl:apply-templates/>
4004
4052
  </fo:inline>
4005
4053
  </xsl:template><xsl:template match="*[local-name()='dl']">
4054
+ <xsl:variable name="isAdded" select="@added"/>
4055
+ <xsl:variable name="isDeleted" select="@deleted"/>
4006
4056
  <fo:block-container>
4007
4057
 
4008
4058
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4019,6 +4069,12 @@
4019
4069
  </xsl:attribute>
4020
4070
 
4021
4071
  </xsl:if>
4072
+
4073
+ <xsl:call-template name="setTrackChangesStyles">
4074
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4075
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4076
+ </xsl:call-template>
4077
+
4022
4078
  <fo:block-container>
4023
4079
 
4024
4080
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4142,11 +4198,11 @@
4142
4198
  </xsl:choose>
4143
4199
  </xsl:variable>
4144
4200
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4145
- <xsl:element name="{$ns}:table">
4201
+ <!-- <xsl:element name="{$ns}:table"> -->
4146
4202
  <tbody>
4147
4203
  <xsl:apply-templates mode="dl"/>
4148
4204
  </tbody>
4149
- </xsl:element>
4205
+ <!-- </xsl:element> -->
4150
4206
  </xsl:variable>
4151
4207
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4152
4208
  <xsl:variable name="colwidths">
@@ -4418,9 +4474,71 @@
4418
4474
  <xsl:apply-templates/>
4419
4475
  </fo:inline>
4420
4476
  </xsl:template><xsl:template match="*[local-name()='add']">
4421
- <fo:inline xsl:use-attribute-sets="add-style">
4422
- <xsl:apply-templates/>
4423
- </fo:inline>
4477
+ <xsl:choose>
4478
+ <xsl:when test="@amendment">
4479
+ <fo:inline>
4480
+ <xsl:call-template name="insertTag">
4481
+ <xsl:with-param name="kind">A</xsl:with-param>
4482
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4483
+ </xsl:call-template>
4484
+ <xsl:apply-templates/>
4485
+ <xsl:call-template name="insertTag">
4486
+ <xsl:with-param name="type">closing</xsl:with-param>
4487
+ <xsl:with-param name="kind">A</xsl:with-param>
4488
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4489
+ </xsl:call-template>
4490
+ </fo:inline>
4491
+ </xsl:when>
4492
+ <xsl:when test="@corrigenda">
4493
+ <fo:inline>
4494
+ <xsl:call-template name="insertTag">
4495
+ <xsl:with-param name="kind">C</xsl:with-param>
4496
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4497
+ </xsl:call-template>
4498
+ <xsl:apply-templates/>
4499
+ <xsl:call-template name="insertTag">
4500
+ <xsl:with-param name="type">closing</xsl:with-param>
4501
+ <xsl:with-param name="kind">C</xsl:with-param>
4502
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4503
+ </xsl:call-template>
4504
+ </fo:inline>
4505
+ </xsl:when>
4506
+ <xsl:otherwise>
4507
+ <fo:inline xsl:use-attribute-sets="add-style">
4508
+ <xsl:apply-templates/>
4509
+ </fo:inline>
4510
+ </xsl:otherwise>
4511
+ </xsl:choose>
4512
+
4513
+ </xsl:template><xsl:template name="insertTag">
4514
+ <xsl:param name="type"/>
4515
+ <xsl:param name="kind"/>
4516
+ <xsl:param name="value"/>
4517
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4518
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4519
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4520
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4521
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4522
+ <xsl:attribute name="height">5mm</xsl:attribute>
4523
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4524
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4525
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4526
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4527
+ <g>
4528
+ <xsl:if test="$type = 'closing'">
4529
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4530
+ </xsl:if>
4531
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4532
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4533
+ </g>
4534
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4535
+ <xsl:if test="$type = 'closing'">
4536
+ <xsl:attribute name="x">25</xsl:attribute>
4537
+ </xsl:if>
4538
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4539
+ </text>
4540
+ </svg>
4541
+ </fo:instream-foreign-object>
4424
4542
  </xsl:template><xsl:template match="*[local-name()='del']">
4425
4543
  <fo:inline xsl:use-attribute-sets="del-style">
4426
4544
  <xsl:apply-templates/>
@@ -4763,13 +4881,23 @@
4763
4881
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4764
4882
  <xsl:value-of select="substring($str, 2)"/>
4765
4883
  </xsl:template><xsl:template match="mathml:math">
4766
- <fo:inline font-family="STIX Two Math"> <!-- -->
4884
+ <xsl:variable name="isAdded" select="@added"/>
4885
+ <xsl:variable name="isDeleted" select="@deleted"/>
4886
+
4887
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4888
+
4889
+
4890
+ <xsl:call-template name="setTrackChangesStyles">
4891
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4892
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4893
+ </xsl:call-template>
4767
4894
 
4768
4895
  <xsl:variable name="mathml">
4769
4896
  <xsl:apply-templates select="." mode="mathml"/>
4770
4897
  </xsl:variable>
4771
4898
  <fo:instream-foreign-object fox:alt-text="Math">
4772
4899
 
4900
+
4773
4901
  <!-- <xsl:copy-of select="."/> -->
4774
4902
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4775
4903
  </fo:instream-foreign-object>
@@ -5019,8 +5147,15 @@
5019
5147
  </fo:inline>
5020
5148
  </xsl:if>
5021
5149
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5150
+ <xsl:variable name="isAdded" select="@added"/>
5151
+ <xsl:variable name="isDeleted" select="@deleted"/>
5022
5152
  <fo:block-container id="{@id}">
5023
5153
 
5154
+ <xsl:call-template name="setTrackChangesStyles">
5155
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5156
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5157
+ </xsl:call-template>
5158
+
5024
5159
  <fo:block>
5025
5160
  <xsl:apply-templates/>
5026
5161
  </fo:block>
@@ -5040,6 +5175,8 @@
5040
5175
  <xsl:apply-templates/>
5041
5176
  </fo:block>
5042
5177
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5178
+ <xsl:variable name="isAdded" select="../@added"/>
5179
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5043
5180
  <xsl:choose>
5044
5181
  <xsl:when test="ancestor::*[local-name() = 'title']">
5045
5182
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -5055,7 +5192,26 @@
5055
5192
  <xsl:variable name="src">
5056
5193
  <xsl:call-template name="image_src"/>
5057
5194
  </xsl:variable>
5058
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5195
+
5196
+ <xsl:choose>
5197
+ <xsl:when test="$isDeleted = 'true'">
5198
+ <!-- enclose in svg -->
5199
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5200
+ <xsl:attribute name="width">100%</xsl:attribute>
5201
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5202
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5203
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5204
+
5205
+
5206
+ <xsl:apply-templates select="." mode="cross_image"/>
5207
+
5208
+ </fo:instream-foreign-object>
5209
+ </xsl:when>
5210
+ <xsl:otherwise>
5211
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5212
+ </xsl:otherwise>
5213
+ </xsl:choose>
5214
+
5059
5215
  </fo:block>
5060
5216
  </xsl:otherwise>
5061
5217
  </xsl:choose>
@@ -5071,6 +5227,55 @@
5071
5227
  <xsl:value-of select="@src"/>
5072
5228
  </xsl:otherwise>
5073
5229
  </xsl:choose>
5230
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5231
+ <xsl:choose>
5232
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5233
+ <xsl:variable name="src">
5234
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5235
+ </xsl:variable>
5236
+ <xsl:variable name="width" select="document($src)/@width"/>
5237
+ <xsl:variable name="height" select="document($src)/@height"/>
5238
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5239
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5240
+ </svg>
5241
+ </xsl:when>
5242
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5243
+ <xsl:variable name="src">
5244
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5245
+ </xsl:variable>
5246
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5247
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5248
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5249
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5250
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5251
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5252
+ </svg>
5253
+ </xsl:when>
5254
+ <xsl:otherwise>
5255
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5256
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5257
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5258
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5259
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5260
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5261
+ <!-- width=<xsl:value-of select="$width"/> -->
5262
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5263
+ <!-- height=<xsl:value-of select="$height"/> -->
5264
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5265
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5266
+ <xsl:call-template name="svg_cross">
5267
+ <xsl:with-param name="width" select="$width"/>
5268
+ <xsl:with-param name="height" select="$height"/>
5269
+ </xsl:call-template>
5270
+ </svg>
5271
+ </xsl:otherwise>
5272
+ </xsl:choose>
5273
+
5274
+ </xsl:template><xsl:template name="svg_cross">
5275
+ <xsl:param name="width"/>
5276
+ <xsl:param name="height"/>
5277
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5278
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5074
5279
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
5075
5280
  <xsl:apply-templates mode="contents"/>
5076
5281
  <xsl:text> </xsl:text>
@@ -5613,6 +5818,7 @@
5613
5818
  <xsl:variable name="element">
5614
5819
 
5615
5820
  inline
5821
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5616
5822
  </xsl:variable>
5617
5823
  <xsl:choose>
5618
5824
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5620,7 +5826,7 @@
5620
5826
  <xsl:apply-templates/>
5621
5827
  </fo:inline>
5622
5828
  </xsl:when>
5623
- <xsl:when test="normalize-space($element) = 'block'">
5829
+ <xsl:when test="contains(normalize-space($element), 'block')">
5624
5830
  <fo:block xsl:use-attribute-sets="example-name-style">
5625
5831
  <xsl:apply-templates/>
5626
5832
  </fo:block>
@@ -5841,7 +6047,8 @@
5841
6047
  </fo:inline>
5842
6048
  </xsl:when>
5843
6049
  <xsl:otherwise>
5844
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6050
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6051
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5845
6052
  </xsl:otherwise>
5846
6053
  </xsl:choose>
5847
6054
 
@@ -6549,4 +6756,44 @@
6549
6756
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6550
6757
  </xsl:choose>
6551
6758
 
6759
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6760
+ <xsl:param name="isAdded"/>
6761
+ <xsl:param name="isDeleted"/>
6762
+ <xsl:choose>
6763
+ <xsl:when test="local-name() = 'math'">
6764
+ <xsl:if test="$isAdded = 'true'">
6765
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6766
+ </xsl:if>
6767
+ <xsl:if test="$isDeleted = 'true'">
6768
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6769
+ </xsl:if>
6770
+ </xsl:when>
6771
+ <xsl:otherwise>
6772
+ <xsl:if test="$isAdded = 'true'">
6773
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6774
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6775
+ </xsl:if>
6776
+ <xsl:if test="$isDeleted = 'true'">
6777
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6778
+ <xsl:if test="local-name() = 'table'">
6779
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6780
+ </xsl:if>
6781
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6782
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6783
+ </xsl:if>
6784
+ </xsl:otherwise>
6785
+ </xsl:choose>
6786
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6787
+ <xsl:if test="$lang = 'ar'">
6788
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6789
+ </xsl:if>
6790
+ </xsl:template><xsl:template name="setAlignment">
6791
+ <xsl:param name="align" select="normalize-space(@align)"/>
6792
+ <xsl:choose>
6793
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6794
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6795
+ <xsl:when test="$align != ''">
6796
+ <xsl:value-of select="$align"/>
6797
+ </xsl:when>
6798
+ </xsl:choose>
6552
6799
  </xsl:template></xsl:stylesheet>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "1.3.0".freeze
3
+ VERSION = "1.3.1".freeze
4
4
  end
5
5
  end
6
6
 
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.0
4
+ version: 1.3.1
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-04-12 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso