metanorma-cc 1.7.5 → 1.7.6

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: 21d0ca9db55a0ac16cf9c7d2aa5e4d1e8d8e7d2934d067148284a2ff4e9dfb16
4
- data.tar.gz: c6e31128a7d2dd507b87b812b1b06aa26629d16c9264e73d58fb598e7dd80da1
3
+ metadata.gz: 9800409f83f05968a5bbc1b3fb23acc9b16b0791e97dd43897ec541c9f2309cd
4
+ data.tar.gz: fba0e90b9902ec515e4b61c337c1923bb7dd8377169739dbf8caa40fcf2d0eb0
5
5
  SHA512:
6
- metadata.gz: 59e27ecbc3c0e3b878b21a22a1fbc5663c79eea90efcf73368266a12abcd085db5aec3b168212b63eeec7f2494e9cca79595c29e325f43f24a9c93ea1460ac9e
7
- data.tar.gz: 6120464f8d63a52365519449d463fecc78140d8bc35d47eeed568c8a39abf0a35f7ceec453f13dbbf26f97946c1ca4cc918b9b120e67ba4c68d225248eb9cb84
6
+ metadata.gz: 1fca6f832f5332ac625d052864674a9a28d9d7485dab97f58e29a1a12ebffbc3bc83d52bd986dce067e0ea88d633912d52a8b9ae61e31ab819af6e20737d3e4d
7
+ data.tar.gz: 8aa8cd87c0d718a424de2787afdf58f7979d03cebe279df6e7f5f90608910ffdb8fd6b70978a90ff21e43a6756e743eb0f3fbdc835e6ecdae49342c71a39c724
@@ -16,7 +16,7 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  steps:
@@ -955,7 +955,24 @@
955
955
  <define name="concept">
956
956
  <element name="concept">
957
957
  <optional>
958
- <attribute name="term"/>
958
+ <element name="refterm">
959
+ <zeroOrMore>
960
+ <choice>
961
+ <ref name="PureTextElement"/>
962
+ <ref name="stem"/>
963
+ </choice>
964
+ </zeroOrMore>
965
+ </element>
966
+ </optional>
967
+ <optional>
968
+ <element name="renderterm">
969
+ <zeroOrMore>
970
+ <choice>
971
+ <ref name="PureTextElement"/>
972
+ <ref name="stem"/>
973
+ </choice>
974
+ </zeroOrMore>
975
+ </element>
959
976
  </optional>
960
977
  <choice>
961
978
  <ref name="eref"/>
@@ -7,8 +7,13 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
- <xsl:variable name="pageWidth" select="'210mm'"/>
11
- <xsl:variable name="pageHeight" select="'297mm'"/>
10
+ <xsl:variable name="pageWidth" select="210"/>
11
+ <xsl:variable name="pageHeight" select="297"/>
12
+ <xsl:variable name="marginLeftRight1" select="19"/>
13
+ <xsl:variable name="marginLeftRight2" select="19"/>
14
+ <xsl:variable name="marginTop" select="20.2"/>
15
+ <xsl:variable name="marginBottom" select="20.3"/>
16
+
12
17
 
13
18
 
14
19
 
@@ -42,7 +47,7 @@
42
47
  <fo:root font-family="Source Sans Pro, STIX Two Math, Source Han Sans" font-size="10.5pt" xml:lang="{$lang}">
43
48
  <fo:layout-master-set>
44
49
  <!-- Cover page -->
45
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
50
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
46
51
  <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
47
52
  <fo:region-before region-name="cover-page-header" extent="23.5mm"/>
48
53
  <fo:region-after extent="10mm"/>
@@ -53,27 +58,27 @@
53
58
  <!-- Document pages -->
54
59
 
55
60
  <!-- Preface odd pages -->
56
- <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
57
- <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
61
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
62
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
58
63
  <fo:region-before region-name="header-odd" extent="17mm"/>
59
64
  <fo:region-after region-name="footer-odd" extent="10mm"/>
60
- <fo:region-start region-name="left-region" extent="19mm"/>
61
- <fo:region-end region-name="right-region" extent="19mm"/>
65
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
66
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
62
67
  </fo:simple-page-master>
63
68
  <!-- Preface even pages -->
64
- <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
65
- <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
69
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
70
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
66
71
  <fo:region-before region-name="header-even" extent="17mm"/>
67
72
  <fo:region-after region-name="footer-even" extent="10mm"/>
68
- <fo:region-start region-name="left-region" extent="19mm"/>
69
- <fo:region-end region-name="right-region" extent="19mm"/>
73
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
70
75
  </fo:simple-page-master>
71
- <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
72
- <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
76
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
73
78
  <fo:region-before region-name="header" extent="17mm"/>
74
79
  <fo:region-after region-name="footer" extent="10mm"/>
75
- <fo:region-start region-name="left" extent="19mm"/>
76
- <fo:region-end region-name="right" extent="19mm"/>
80
+ <fo:region-start region-name="left" extent="{$marginLeftRight1}mm"/>
81
+ <fo:region-end region-name="right" extent="{$marginLeftRight2}mm"/>
77
82
  </fo:simple-page-master>
78
83
  <fo:page-sequence-master master-name="preface">
79
84
  <fo:repeatable-page-master-alternatives>
@@ -84,20 +89,20 @@
84
89
  </fo:page-sequence-master>
85
90
 
86
91
  <!-- Document odd pages -->
87
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
88
- <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
89
- <fo:region-before region-name="header-odd" extent="20.2mm"/>
90
- <fo:region-after region-name="footer-odd" extent="20.3mm"/>
91
- <fo:region-start region-name="left-region" extent="19mm"/>
92
- <fo:region-end region-name="right-region" extent="19mm"/>
92
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
93
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
94
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
95
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
96
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
97
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
93
98
  </fo:simple-page-master>
94
99
  <!-- Preface even pages -->
95
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
96
- <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
97
- <fo:region-before region-name="header-even" extent="20.2mm"/>
98
- <fo:region-after region-name="footer-even" extent="20.3mm"/>
99
- <fo:region-start region-name="left-region" extent="19mm"/>
100
- <fo:region-end region-name="right-region" extent="19mm"/>
100
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
101
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
102
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
103
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
104
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
105
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
101
106
  </fo:simple-page-master>
102
107
  <fo:page-sequence-master master-name="document">
103
108
  <fo:repeatable-page-master-alternatives>
@@ -1134,6 +1139,7 @@
1134
1139
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1135
1140
 
1136
1141
 
1142
+
1137
1143
  <xsl:attribute name="color">blue</xsl:attribute>
1138
1144
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1139
1145
 
@@ -1352,14 +1358,15 @@
1352
1358
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1353
1359
 
1354
1360
  <!-- Normative references -->
1355
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1361
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
1356
1362
  <!-- Terms and definitions -->
1357
1363
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
1358
1364
  <!-- Another main sections -->
1359
1365
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
1360
1366
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1361
1367
  <!-- Bibliography -->
1362
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1368
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1369
+
1363
1370
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1364
1371
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1365
1372
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2133,6 +2140,7 @@
2133
2140
 
2134
2141
 
2135
2142
 
2143
+
2136
2144
  <xsl:if test=".//*[local-name() = 'table']">
2137
2145
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2138
2146
  </xsl:if>
@@ -2162,6 +2170,7 @@
2162
2170
 
2163
2171
 
2164
2172
 
2173
+
2165
2174
  <fo:inline padding-right="2mm">
2166
2175
 
2167
2176
 
@@ -2205,6 +2214,7 @@
2205
2214
 
2206
2215
 
2207
2216
 
2217
+
2208
2218
  <xsl:value-of select="@reference"/>
2209
2219
 
2210
2220
 
@@ -2349,6 +2359,9 @@
2349
2359
 
2350
2360
 
2351
2361
 
2362
+
2363
+
2364
+
2352
2365
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2353
2366
 
2354
2367
 
@@ -3250,6 +3263,7 @@
3250
3263
  <fo:inline xsl:use-attribute-sets="link-style">
3251
3264
 
3252
3265
 
3266
+
3253
3267
  <xsl:choose>
3254
3268
  <xsl:when test="$target_text = ''">
3255
3269
  <xsl:apply-templates/>
@@ -3598,6 +3612,234 @@
3598
3612
  <xsl:param name="height"/>
3599
3613
  <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; "/>
3600
3614
  <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; "/>
3615
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
3616
+ <xsl:param name="name"/>
3617
+
3618
+ <xsl:variable name="svg_content">
3619
+ <xsl:apply-templates select="." mode="svg_update"/>
3620
+ </xsl:variable>
3621
+
3622
+ <xsl:variable name="alt-text">
3623
+ <xsl:choose>
3624
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3625
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3626
+ </xsl:when>
3627
+ <xsl:when test="normalize-space($name) != ''">
3628
+ <xsl:value-of select="$name"/>
3629
+ </xsl:when>
3630
+ <xsl:otherwise>Figure</xsl:otherwise>
3631
+ </xsl:choose>
3632
+ </xsl:variable>
3633
+
3634
+ <xsl:choose>
3635
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3636
+ <fo:block>
3637
+ <xsl:variable name="width" select="@width"/>
3638
+ <xsl:variable name="height" select="@height"/>
3639
+
3640
+ <xsl:variable name="scale_x">
3641
+ <xsl:choose>
3642
+ <xsl:when test="$width &gt; $width_effective_px">
3643
+ <xsl:value-of select="$width_effective_px div $width"/>
3644
+ </xsl:when>
3645
+ <xsl:otherwise>1</xsl:otherwise>
3646
+ </xsl:choose>
3647
+ </xsl:variable>
3648
+
3649
+ <xsl:variable name="scale_y">
3650
+ <xsl:choose>
3651
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3652
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3653
+ </xsl:when>
3654
+ <xsl:otherwise>1</xsl:otherwise>
3655
+ </xsl:choose>
3656
+ </xsl:variable>
3657
+
3658
+ <xsl:variable name="scale">
3659
+ <xsl:choose>
3660
+ <xsl:when test="$scale_y != 1">
3661
+ <xsl:value-of select="$scale_x * $scale_y"/>
3662
+ </xsl:when>
3663
+ <xsl:otherwise>
3664
+ <xsl:value-of select="$scale_x"/>
3665
+ </xsl:otherwise>
3666
+ </xsl:choose>
3667
+ </xsl:variable>
3668
+
3669
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3670
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3671
+
3672
+ <fo:table table-layout="fixed" width="100%">
3673
+ <fo:table-column column-width="proportional-column-width(1)"/>
3674
+ <fo:table-column column-width="{$width_scale}px"/>
3675
+ <fo:table-column column-width="proportional-column-width(1)"/>
3676
+ <fo:table-body>
3677
+ <fo:table-row>
3678
+ <fo:table-cell column-number="2">
3679
+ <fo:block>
3680
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3681
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3682
+ <fo:block line-height="0" font-size="0">
3683
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3684
+ <xsl:call-template name="bookmark"/>
3685
+ </xsl:for-each>
3686
+ </fo:block>
3687
+ </xsl:if>
3688
+ <fo:block text-depth="0" line-height="0" font-size="0">
3689
+
3690
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3691
+ <xsl:attribute name="width">100%</xsl:attribute>
3692
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3693
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3694
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3695
+
3696
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3697
+ </fo:instream-foreign-object>
3698
+ </fo:block>
3699
+
3700
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
3701
+ <xsl:with-param name="scale" select="$scale"/>
3702
+ </xsl:apply-templates>
3703
+ </fo:block-container>
3704
+ </fo:block>
3705
+ </fo:table-cell>
3706
+ </fo:table-row>
3707
+ </fo:table-body>
3708
+ </fo:table>
3709
+ </fo:block>
3710
+
3711
+ </xsl:when>
3712
+ <xsl:otherwise>
3713
+ <fo:block xsl:use-attribute-sets="image-style">
3714
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3715
+ <xsl:attribute name="width">100%</xsl:attribute>
3716
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3717
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3718
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3719
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3720
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3721
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3722
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3723
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3724
+ </xsl:if>
3725
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3726
+ <xsl:copy-of select="$svg_content"/>
3727
+ </fo:instream-foreign-object>
3728
+ </fo:block>
3729
+ </xsl:otherwise>
3730
+ </xsl:choose>
3731
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3732
+ <xsl:copy>
3733
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3734
+ </xsl:copy>
3735
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3736
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3737
+ <xsl:value-of select="."/>
3738
+ </xsl:attribute>
3739
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3740
+ <xsl:variable name="svg_content" select="document(@src)"/>
3741
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3742
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3743
+ <xsl:call-template name="image_svg">
3744
+ <xsl:with-param name="name" select="$name"/>
3745
+ </xsl:call-template>
3746
+ </xsl:for-each>
3747
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3748
+ <xsl:copy>
3749
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3750
+ </xsl:copy>
3751
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3752
+ <xsl:apply-templates mode="svg_remove_a"/>
3753
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3754
+ <xsl:param name="scale"/>
3755
+ <xsl:variable name="dest">
3756
+ <xsl:choose>
3757
+ <xsl:when test="starts-with(@href, '#')">
3758
+ <xsl:value-of select="substring-after(@href, '#')"/>
3759
+ </xsl:when>
3760
+ <xsl:otherwise>
3761
+ <xsl:value-of select="@href"/>
3762
+ </xsl:otherwise>
3763
+ </xsl:choose>
3764
+ </xsl:variable>
3765
+ <xsl:for-each select="./*[local-name() = 'rect']">
3766
+ <xsl:call-template name="insertSVGMapLink">
3767
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3768
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3769
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3770
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3771
+ <xsl:with-param name="dest" select="$dest"/>
3772
+ </xsl:call-template>
3773
+ </xsl:for-each>
3774
+
3775
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3776
+ <xsl:variable name="points">
3777
+ <xsl:call-template name="split">
3778
+ <xsl:with-param name="pText" select="@points"/>
3779
+ </xsl:call-template>
3780
+ </xsl:variable>
3781
+ <xsl:variable name="x_coords">
3782
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3783
+ <xsl:sort select="." data-type="number"/>
3784
+ <x><xsl:value-of select="."/></x>
3785
+ </xsl:for-each>
3786
+ </xsl:variable>
3787
+ <xsl:variable name="y_coords">
3788
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3789
+ <xsl:sort select="." data-type="number"/>
3790
+ <y><xsl:value-of select="."/></y>
3791
+ </xsl:for-each>
3792
+ </xsl:variable>
3793
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3794
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3795
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3796
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3797
+ <xsl:call-template name="insertSVGMapLink">
3798
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
3799
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
3800
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
3801
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
3802
+ <xsl:with-param name="dest" select="$dest"/>
3803
+ </xsl:call-template>
3804
+ </xsl:for-each>
3805
+
3806
+ <xsl:for-each select="./*[local-name() = 'circle']">
3807
+ <xsl:call-template name="insertSVGMapLink">
3808
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
3809
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
3810
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
3811
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
3812
+ <xsl:with-param name="dest" select="$dest"/>
3813
+ </xsl:call-template>
3814
+ </xsl:for-each>
3815
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
3816
+ <xsl:call-template name="insertSVGMapLink">
3817
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
3818
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
3819
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
3820
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
3821
+ <xsl:with-param name="dest" select="$dest"/>
3822
+ </xsl:call-template>
3823
+ </xsl:for-each>
3824
+ </xsl:template><xsl:template name="insertSVGMapLink">
3825
+ <xsl:param name="left"/>
3826
+ <xsl:param name="top"/>
3827
+ <xsl:param name="width"/>
3828
+ <xsl:param name="height"/>
3829
+ <xsl:param name="dest"/>
3830
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
3831
+ <fo:block font-size="1pt">
3832
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
3833
+ <fo:inline-container inline-progression-dimension="100%">
3834
+ <fo:block-container height="{$height - 1}px" width="100%">
3835
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
3836
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
3837
+ </xsl:if> -->
3838
+ <fo:block> </fo:block></fo:block-container>
3839
+ </fo:inline-container>
3840
+ </fo:basic-link>
3841
+ </fo:block>
3842
+ </fo:block-container>
3601
3843
  </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">
3602
3844
  <xsl:apply-templates mode="contents"/>
3603
3845
  <xsl:text> </xsl:text>
@@ -3626,28 +3868,39 @@
3626
3868
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3627
3869
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3628
3870
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3871
+ <xsl:if test="@bundle = 'true'">
3872
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
3873
+ </xsl:if>
3629
3874
  <fo:bookmark-title>
3630
- <xsl:variable name="bookmark-title_">
3631
- <xsl:call-template name="getLangVersion">
3632
- <xsl:with-param name="lang" select="@lang"/>
3633
- <xsl:with-param name="doctype" select="@doctype"/>
3634
- <xsl:with-param name="title" select="@title-part"/>
3635
- </xsl:call-template>
3636
- </xsl:variable>
3637
3875
  <xsl:choose>
3638
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3639
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3640
- </xsl:when>
3641
- <xsl:otherwise>
3876
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
3877
+ <xsl:variable name="bookmark-title_">
3878
+ <xsl:call-template name="getLangVersion">
3879
+ <xsl:with-param name="lang" select="@lang"/>
3880
+ <xsl:with-param name="doctype" select="@doctype"/>
3881
+ <xsl:with-param name="title" select="@title-part"/>
3882
+ </xsl:call-template>
3883
+ </xsl:variable>
3642
3884
  <xsl:choose>
3643
- <xsl:when test="@lang = 'en'">English</xsl:when>
3644
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3645
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3646
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3885
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3886
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3887
+ </xsl:when>
3888
+ <xsl:otherwise>
3889
+ <xsl:choose>
3890
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3891
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3892
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3893
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3894
+ </xsl:choose>
3895
+ </xsl:otherwise>
3647
3896
  </xsl:choose>
3897
+ </xsl:when>
3898
+ <xsl:otherwise>
3899
+ <xsl:value-of select="@title-part"/>
3648
3900
  </xsl:otherwise>
3649
3901
  </xsl:choose>
3650
3902
  </fo:bookmark-title>
3903
+
3651
3904
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3652
3905
 
3653
3906
  <xsl:call-template name="insertFigureBookmarks">
@@ -3746,16 +3999,23 @@
3746
3999
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3747
4000
  </xsl:choose>
3748
4001
  </xsl:template><xsl:template match="item" mode="bookmark">
3749
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3750
- <fo:bookmark-title>
3751
- <xsl:if test="@section != ''">
3752
- <xsl:value-of select="@section"/>
3753
- <xsl:text> </xsl:text>
3754
- </xsl:if>
3755
- <xsl:value-of select="normalize-space(title)"/>
3756
- </fo:bookmark-title>
3757
- <xsl:apply-templates mode="bookmark"/>
3758
- </fo:bookmark>
4002
+ <xsl:choose>
4003
+ <xsl:when test="@id != ''">
4004
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4005
+ <fo:bookmark-title>
4006
+ <xsl:if test="@section != ''">
4007
+ <xsl:value-of select="@section"/>
4008
+ <xsl:text> </xsl:text>
4009
+ </xsl:if>
4010
+ <xsl:value-of select="normalize-space(title)"/>
4011
+ </fo:bookmark-title>
4012
+ <xsl:apply-templates mode="bookmark"/>
4013
+ </fo:bookmark>
4014
+ </xsl:when>
4015
+ <xsl:otherwise>
4016
+ <xsl:apply-templates mode="bookmark"/>
4017
+ </xsl:otherwise>
4018
+ </xsl:choose>
3759
4019
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3760
4020
  <xsl:if test="normalize-space() != ''">
3761
4021
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -4316,6 +4576,7 @@
4316
4576
  </xsl:if>
4317
4577
 
4318
4578
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4579
+
4319
4580
  <xsl:if test="normalize-space(@citeas) = ''">
4320
4581
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4321
4582
  </xsl:if>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "1.7.5".freeze
3
+ VERSION = "1.7.6".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
- spec.add_dependency "metanorma-generic", "~> 1.10.0"
31
+ spec.add_dependency "metanorma-generic", "~> 1.10.2"
32
32
 
33
33
  spec.add_development_dependency "byebug", "~> 9.1"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.6
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-06-21 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.10.0
19
+ version: 1.10.2
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.10.0
26
+ version: 1.10.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement