metanorma-csa 1.8.0 → 1.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75fa817659b82aa49121c571ee10bc8f6ab4355bfcf11b8eb7b46b0af244325f
4
- data.tar.gz: 61beb5145d8d22388167fef4affe723f4830696aebfafc5ac6921422197428c5
3
+ metadata.gz: fd8619b12f45c11c2cab65e6aa78b6ad6749ba04c4be28c897a5c6120a54d4d7
4
+ data.tar.gz: 07d2d6395e4b820a5c14120e147a5091c1cf475f5aa5e6c9069ae974dbe87da7
5
5
  SHA512:
6
- metadata.gz: e5729981047494c14d9230ad4b799ce311b3cba25e7cbd927301922e01b87a19ac232b88592fb13736842cafb4efaa0e04b919c086cd11b3655323065715334c
7
- data.tar.gz: 888b045de483fd115d700b82140259693c46a5bd325095ab07c2589e2fba053ee5b4e04dc8e594810e58294b8a57fa86a8aa32aaed2689843f70ffa67053ba8d
6
+ metadata.gz: 720715e6a5614244a39936457a79dd311de41c6b6c904b4ba86d7cc9f56c07c81aa7705568fa07d2e8b6b7484ef7cf4b58708e7e1e1bd064997c7ef1eab0e6a7
7
+ data.tar.gz: 2b68d37f0dd18900cf3e5f012aa9579359e18ca4956aa7aaab80ae64aadc53bf9e250a80214ab7a55a1eb45e88fe228840d497f1699837fd97e1e81218fdecd7
@@ -1032,6 +1032,7 @@
1032
1032
  </xsl:choose>
1033
1033
  </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">
1034
1034
 
1035
+
1035
1036
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1036
1037
 
1037
1038
 
@@ -1367,13 +1368,25 @@
1367
1368
  <xsl:attribute name="space-after">6pt</xsl:attribute>
1368
1369
 
1369
1370
 
1370
- </xsl:attribute-set><xsl:attribute-set name="add-style">
1371
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1372
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1373
+ </xsl:variable><xsl:attribute-set name="add-style">
1371
1374
  <xsl:attribute name="color">red</xsl:attribute>
1372
1375
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1373
- </xsl:attribute-set><xsl:attribute-set name="del-style">
1374
- <xsl:attribute name="color">red</xsl:attribute>
1376
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1377
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1378
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1379
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1380
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1381
+ <xsl:text>red</xsl:text>
1382
+ </xsl:variable><xsl:attribute-set name="del-style">
1383
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1375
1384
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1376
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1385
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1386
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1387
+
1388
+
1389
+ </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">
1377
1390
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1378
1391
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1379
1392
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1418,16 +1431,17 @@
1418
1431
  <xsl:call-template name="add-zero-spaces-java"/>
1419
1432
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1420
1433
 
1434
+ <xsl:variable name="table-preamble">
1435
+
1436
+
1437
+ </xsl:variable>
1438
+
1421
1439
  <xsl:variable name="table">
1422
1440
 
1423
1441
  <xsl:variable name="simple-table">
1424
1442
  <xsl:call-template name="getSimpleTable"/>
1425
1443
  </xsl:variable>
1426
1444
 
1427
-
1428
-
1429
-
1430
-
1431
1445
  <!-- <xsl:if test="$namespace = 'bipm'">
1432
1446
  <fo:block>&#xA0;</fo:block>
1433
1447
  </xsl:if> -->
@@ -1440,7 +1454,7 @@
1440
1454
 
1441
1455
 
1442
1456
 
1443
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1457
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1444
1458
 
1445
1459
  <!-- <xsl:variable name="cols-count">
1446
1460
  <xsl:choose>
@@ -1459,8 +1473,6 @@
1459
1473
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1460
1474
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1461
1475
 
1462
-
1463
-
1464
1476
  <xsl:variable name="colwidths">
1465
1477
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1466
1478
  <xsl:call-template name="calculate-column-widths">
@@ -1488,6 +1500,7 @@
1488
1500
  </xsl:choose>
1489
1501
  </xsl:variable>
1490
1502
 
1503
+
1491
1504
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1492
1505
 
1493
1506
 
@@ -1519,6 +1532,7 @@
1519
1532
 
1520
1533
 
1521
1534
 
1535
+
1522
1536
 
1523
1537
 
1524
1538
 
@@ -1608,7 +1622,8 @@
1608
1622
  </fo:block-container>
1609
1623
  </xsl:variable>
1610
1624
 
1611
-
1625
+ <xsl:variable name="isAdded" select="@added"/>
1626
+ <xsl:variable name="isDeleted" select="@deleted"/>
1612
1627
 
1613
1628
  <xsl:choose>
1614
1629
  <xsl:when test="@width">
@@ -1622,7 +1637,14 @@
1622
1637
  <fo:table-body>
1623
1638
  <fo:table-row>
1624
1639
  <fo:table-cell column-number="2">
1625
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1640
+ <xsl:copy-of select="$table-preamble"/>
1641
+ <fo:block>
1642
+ <xsl:call-template name="setTrackChangesStyles">
1643
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1644
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1645
+ </xsl:call-template>
1646
+ <xsl:copy-of select="$table"/>
1647
+ </fo:block>
1626
1648
  </fo:table-cell>
1627
1649
  </fo:table-row>
1628
1650
  </fo:table-body>
@@ -1633,7 +1655,22 @@
1633
1655
 
1634
1656
  </xsl:when>
1635
1657
  <xsl:otherwise>
1636
- <xsl:copy-of select="$table"/>
1658
+ <xsl:choose>
1659
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1660
+ <xsl:copy-of select="$table-preamble"/>
1661
+ <fo:block>
1662
+ <xsl:call-template name="setTrackChangesStyles">
1663
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1664
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1665
+ </xsl:call-template>
1666
+ <xsl:copy-of select="$table"/>
1667
+ </fo:block>
1668
+ </xsl:when>
1669
+ <xsl:otherwise>
1670
+ <xsl:copy-of select="$table-preamble"/>
1671
+ <xsl:copy-of select="$table"/>
1672
+ </xsl:otherwise>
1673
+ </xsl:choose>
1637
1674
  </xsl:otherwise>
1638
1675
  </xsl:choose>
1639
1676
 
@@ -1694,7 +1731,7 @@
1694
1731
  </xsl:for-each>
1695
1732
  </xsl:when>
1696
1733
  <xsl:otherwise>
1697
- <xsl:for-each select="xalan:nodeset($table)//tr">
1734
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1698
1735
  <xsl:variable name="td_text">
1699
1736
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1700
1737
 
@@ -2034,7 +2071,8 @@
2034
2071
  <xsl:attribute name="text-align">
2035
2072
  <xsl:choose>
2036
2073
  <xsl:when test="@align">
2037
- <xsl:value-of select="@align"/>
2074
+ <xsl:call-template name="setAlignment"/>
2075
+ <!-- <xsl:value-of select="@align"/> -->
2038
2076
  </xsl:when>
2039
2077
  <xsl:otherwise>center</xsl:otherwise>
2040
2078
  </xsl:choose>
@@ -2050,6 +2088,9 @@
2050
2088
 
2051
2089
 
2052
2090
 
2091
+ <xsl:if test="$lang = 'ar'">
2092
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2093
+ </xsl:if>
2053
2094
  <xsl:if test="@colspan">
2054
2095
  <xsl:attribute name="number-columns-spanned">
2055
2096
  <xsl:value-of select="@colspan"/>
@@ -2081,11 +2122,15 @@
2081
2122
  <xsl:attribute name="text-align">
2082
2123
  <xsl:choose>
2083
2124
  <xsl:when test="@align">
2084
- <xsl:value-of select="@align"/>
2125
+ <xsl:call-template name="setAlignment"/>
2126
+ <!-- <xsl:value-of select="@align"/> -->
2085
2127
  </xsl:when>
2086
2128
  <xsl:otherwise>left</xsl:otherwise>
2087
2129
  </xsl:choose>
2088
2130
  </xsl:attribute>
2131
+ <xsl:if test="$lang = 'ar'">
2132
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2133
+ </xsl:if>
2089
2134
 
2090
2135
 
2091
2136
 
@@ -2097,6 +2142,9 @@
2097
2142
 
2098
2143
 
2099
2144
 
2145
+ <xsl:if test=".//*[local-name() = 'table']">
2146
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2147
+ </xsl:if>
2100
2148
  <xsl:if test="@colspan">
2101
2149
  <xsl:attribute name="number-columns-spanned">
2102
2150
  <xsl:value-of select="@colspan"/>
@@ -2222,13 +2270,13 @@
2222
2270
  </xsl:choose>
2223
2271
  </xsl:variable>
2224
2272
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2225
- <xsl:element name="{$ns}:table">
2273
+ <!-- <xsl:element name="{$ns}:table"> -->
2226
2274
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2227
2275
  <tbody>
2228
2276
  <xsl:apply-templates mode="dl"/>
2229
2277
  </tbody>
2230
2278
  </xsl:for-each>
2231
- </xsl:element>
2279
+ <!-- </xsl:element> -->
2232
2280
  </xsl:variable>
2233
2281
 
2234
2282
  <xsl:call-template name="calculate-column-widths">
@@ -2319,6 +2367,8 @@
2319
2367
  <xsl:apply-templates/>
2320
2368
  </fo:inline>
2321
2369
  </xsl:template><xsl:template match="*[local-name()='dl']">
2370
+ <xsl:variable name="isAdded" select="@added"/>
2371
+ <xsl:variable name="isDeleted" select="@deleted"/>
2322
2372
  <fo:block-container>
2323
2373
 
2324
2374
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2335,6 +2385,12 @@
2335
2385
  </xsl:attribute>
2336
2386
 
2337
2387
  </xsl:if>
2388
+
2389
+ <xsl:call-template name="setTrackChangesStyles">
2390
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2391
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2392
+ </xsl:call-template>
2393
+
2338
2394
  <fo:block-container>
2339
2395
 
2340
2396
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2442,11 +2498,11 @@
2442
2498
  </xsl:choose>
2443
2499
  </xsl:variable>
2444
2500
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2445
- <xsl:element name="{$ns}:table">
2501
+ <!-- <xsl:element name="{$ns}:table"> -->
2446
2502
  <tbody>
2447
2503
  <xsl:apply-templates mode="dl"/>
2448
2504
  </tbody>
2449
- </xsl:element>
2505
+ <!-- </xsl:element> -->
2450
2506
  </xsl:variable>
2451
2507
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2452
2508
  <xsl:variable name="colwidths">
@@ -2714,9 +2770,71 @@
2714
2770
  <xsl:apply-templates/>
2715
2771
  </fo:inline>
2716
2772
  </xsl:template><xsl:template match="*[local-name()='add']">
2717
- <fo:inline xsl:use-attribute-sets="add-style">
2718
- <xsl:apply-templates/>
2719
- </fo:inline>
2773
+ <xsl:choose>
2774
+ <xsl:when test="@amendment">
2775
+ <fo:inline>
2776
+ <xsl:call-template name="insertTag">
2777
+ <xsl:with-param name="kind">A</xsl:with-param>
2778
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2779
+ </xsl:call-template>
2780
+ <xsl:apply-templates/>
2781
+ <xsl:call-template name="insertTag">
2782
+ <xsl:with-param name="type">closing</xsl:with-param>
2783
+ <xsl:with-param name="kind">A</xsl:with-param>
2784
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2785
+ </xsl:call-template>
2786
+ </fo:inline>
2787
+ </xsl:when>
2788
+ <xsl:when test="@corrigenda">
2789
+ <fo:inline>
2790
+ <xsl:call-template name="insertTag">
2791
+ <xsl:with-param name="kind">C</xsl:with-param>
2792
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2793
+ </xsl:call-template>
2794
+ <xsl:apply-templates/>
2795
+ <xsl:call-template name="insertTag">
2796
+ <xsl:with-param name="type">closing</xsl:with-param>
2797
+ <xsl:with-param name="kind">C</xsl:with-param>
2798
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2799
+ </xsl:call-template>
2800
+ </fo:inline>
2801
+ </xsl:when>
2802
+ <xsl:otherwise>
2803
+ <fo:inline xsl:use-attribute-sets="add-style">
2804
+ <xsl:apply-templates/>
2805
+ </fo:inline>
2806
+ </xsl:otherwise>
2807
+ </xsl:choose>
2808
+
2809
+ </xsl:template><xsl:template name="insertTag">
2810
+ <xsl:param name="type"/>
2811
+ <xsl:param name="kind"/>
2812
+ <xsl:param name="value"/>
2813
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2814
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2815
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2816
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2817
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2818
+ <xsl:attribute name="height">5mm</xsl:attribute>
2819
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2820
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2821
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2822
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2823
+ <g>
2824
+ <xsl:if test="$type = 'closing'">
2825
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2826
+ </xsl:if>
2827
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2828
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2829
+ </g>
2830
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2831
+ <xsl:if test="$type = 'closing'">
2832
+ <xsl:attribute name="x">25</xsl:attribute>
2833
+ </xsl:if>
2834
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2835
+ </text>
2836
+ </svg>
2837
+ </fo:instream-foreign-object>
2720
2838
  </xsl:template><xsl:template match="*[local-name()='del']">
2721
2839
  <fo:inline xsl:use-attribute-sets="del-style">
2722
2840
  <xsl:apply-templates/>
@@ -3059,13 +3177,23 @@
3059
3177
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3060
3178
  <xsl:value-of select="substring($str, 2)"/>
3061
3179
  </xsl:template><xsl:template match="mathml:math">
3062
- <fo:inline font-family="STIX Two Math"> <!-- -->
3180
+ <xsl:variable name="isAdded" select="@added"/>
3181
+ <xsl:variable name="isDeleted" select="@deleted"/>
3182
+
3183
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3184
+
3185
+
3186
+ <xsl:call-template name="setTrackChangesStyles">
3187
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3188
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3189
+ </xsl:call-template>
3063
3190
 
3064
3191
  <xsl:variable name="mathml">
3065
3192
  <xsl:apply-templates select="." mode="mathml"/>
3066
3193
  </xsl:variable>
3067
3194
  <fo:instream-foreign-object fox:alt-text="Math">
3068
3195
 
3196
+
3069
3197
  <!-- <xsl:copy-of select="."/> -->
3070
3198
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3071
3199
  </fo:instream-foreign-object>
@@ -3313,8 +3441,15 @@
3313
3441
  </fo:inline>
3314
3442
  </xsl:if>
3315
3443
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3444
+ <xsl:variable name="isAdded" select="@added"/>
3445
+ <xsl:variable name="isDeleted" select="@deleted"/>
3316
3446
  <fo:block-container id="{@id}">
3317
3447
 
3448
+ <xsl:call-template name="setTrackChangesStyles">
3449
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3450
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3451
+ </xsl:call-template>
3452
+
3318
3453
  <fo:block>
3319
3454
  <xsl:apply-templates/>
3320
3455
  </fo:block>
@@ -3334,6 +3469,8 @@
3334
3469
  <xsl:apply-templates/>
3335
3470
  </fo:block>
3336
3471
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3472
+ <xsl:variable name="isAdded" select="../@added"/>
3473
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3337
3474
  <xsl:choose>
3338
3475
  <xsl:when test="ancestor::*[local-name() = 'title']">
3339
3476
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -3349,7 +3486,26 @@
3349
3486
  <xsl:variable name="src">
3350
3487
  <xsl:call-template name="image_src"/>
3351
3488
  </xsl:variable>
3352
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3489
+
3490
+ <xsl:choose>
3491
+ <xsl:when test="$isDeleted = 'true'">
3492
+ <!-- enclose in svg -->
3493
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3494
+ <xsl:attribute name="width">100%</xsl:attribute>
3495
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3496
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3497
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3498
+
3499
+
3500
+ <xsl:apply-templates select="." mode="cross_image"/>
3501
+
3502
+ </fo:instream-foreign-object>
3503
+ </xsl:when>
3504
+ <xsl:otherwise>
3505
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3506
+ </xsl:otherwise>
3507
+ </xsl:choose>
3508
+
3353
3509
  </fo:block>
3354
3510
  </xsl:otherwise>
3355
3511
  </xsl:choose>
@@ -3365,6 +3521,55 @@
3365
3521
  <xsl:value-of select="@src"/>
3366
3522
  </xsl:otherwise>
3367
3523
  </xsl:choose>
3524
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3525
+ <xsl:choose>
3526
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3527
+ <xsl:variable name="src">
3528
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3529
+ </xsl:variable>
3530
+ <xsl:variable name="width" select="document($src)/@width"/>
3531
+ <xsl:variable name="height" select="document($src)/@height"/>
3532
+ <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">
3533
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3534
+ </svg>
3535
+ </xsl:when>
3536
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3537
+ <xsl:variable name="src">
3538
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3539
+ </xsl:variable>
3540
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3541
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3542
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3543
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3544
+ <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">
3545
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3546
+ </svg>
3547
+ </xsl:when>
3548
+ <xsl:otherwise>
3549
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3550
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3551
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3552
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3553
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3554
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3555
+ <!-- width=<xsl:value-of select="$width"/> -->
3556
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3557
+ <!-- height=<xsl:value-of select="$height"/> -->
3558
+ <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">
3559
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3560
+ <xsl:call-template name="svg_cross">
3561
+ <xsl:with-param name="width" select="$width"/>
3562
+ <xsl:with-param name="height" select="$height"/>
3563
+ </xsl:call-template>
3564
+ </svg>
3565
+ </xsl:otherwise>
3566
+ </xsl:choose>
3567
+
3568
+ </xsl:template><xsl:template name="svg_cross">
3569
+ <xsl:param name="width"/>
3570
+ <xsl:param name="height"/>
3571
+ <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; "/>
3572
+ <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; "/>
3368
3573
  </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">
3369
3574
  <xsl:apply-templates mode="contents"/>
3370
3575
  <xsl:text> </xsl:text>
@@ -3907,6 +4112,7 @@
3907
4112
  <xsl:variable name="element">
3908
4113
  block
3909
4114
 
4115
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3910
4116
  </xsl:variable>
3911
4117
  <xsl:choose>
3912
4118
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3914,7 +4120,7 @@
3914
4120
  <xsl:apply-templates/>
3915
4121
  </fo:inline>
3916
4122
  </xsl:when>
3917
- <xsl:when test="normalize-space($element) = 'block'">
4123
+ <xsl:when test="contains(normalize-space($element), 'block')">
3918
4124
  <fo:block xsl:use-attribute-sets="example-name-style">
3919
4125
  <xsl:apply-templates/>
3920
4126
  </fo:block>
@@ -4128,7 +4334,8 @@
4128
4334
  </fo:inline>
4129
4335
  </xsl:when>
4130
4336
  <xsl:otherwise>
4131
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4337
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4338
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4132
4339
  </xsl:otherwise>
4133
4340
  </xsl:choose>
4134
4341
 
@@ -4841,4 +5048,44 @@
4841
5048
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4842
5049
  </xsl:choose>
4843
5050
 
5051
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5052
+ <xsl:param name="isAdded"/>
5053
+ <xsl:param name="isDeleted"/>
5054
+ <xsl:choose>
5055
+ <xsl:when test="local-name() = 'math'">
5056
+ <xsl:if test="$isAdded = 'true'">
5057
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5058
+ </xsl:if>
5059
+ <xsl:if test="$isDeleted = 'true'">
5060
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5061
+ </xsl:if>
5062
+ </xsl:when>
5063
+ <xsl:otherwise>
5064
+ <xsl:if test="$isAdded = 'true'">
5065
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5066
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5067
+ </xsl:if>
5068
+ <xsl:if test="$isDeleted = 'true'">
5069
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5070
+ <xsl:if test="local-name() = 'table'">
5071
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5072
+ </xsl:if>
5073
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5074
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5075
+ </xsl:if>
5076
+ </xsl:otherwise>
5077
+ </xsl:choose>
5078
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5079
+ <xsl:if test="$lang = 'ar'">
5080
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5081
+ </xsl:if>
5082
+ </xsl:template><xsl:template name="setAlignment">
5083
+ <xsl:param name="align" select="normalize-space(@align)"/>
5084
+ <xsl:choose>
5085
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5086
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5087
+ <xsl:when test="$align != ''">
5088
+ <xsl:value-of select="$align"/>
5089
+ </xsl:when>
5090
+ </xsl:choose>
4844
5091
  </xsl:template></xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "1.8.0".freeze
3
+ VERSION = "1.8.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
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-generic