metanorma-ogc 2.5.3 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6000,7 +6000,8 @@
6000
6000
  </xsl:template>
6001
6001
 
6002
6002
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6003
- <xsl:variable name="text" select="normalize-space(.)"/>
6003
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6004
+ <xsl:variable name="text" select="."/>
6004
6005
  <fo:inline font-size="75%" role="SKIP">
6005
6006
  <xsl:if test="string-length($text) &gt; 0">
6006
6007
  <xsl:variable name="smallCapsText">
@@ -8143,16 +8144,44 @@
8143
8144
  </xsl:choose>
8144
8145
 
8145
8146
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8146
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8147
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
8147
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
8148
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
8149
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
8150
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
8151
+
8152
+ <!-- Example: -->
8148
8153
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
8149
8154
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
8150
8155
  <!-- effective height / width = 1.48, 1.4 - with title -->
8151
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
8156
+
8157
+ <xsl:variable name="scale_x">
8158
+ <xsl:choose>
8159
+ <xsl:when test="$svg_width &gt; $width_effective_px">
8160
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
8161
+ </xsl:when>
8162
+ <xsl:otherwise>1</xsl:otherwise>
8163
+ </xsl:choose>
8164
+ </xsl:variable>
8165
+ <xsl:variable name="scale_y">
8166
+ <xsl:choose>
8167
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
8168
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
8169
+ </xsl:when>
8170
+ <xsl:otherwise>1</xsl:otherwise>
8171
+ </xsl:choose>
8172
+ </xsl:variable>
8173
+
8174
+ <!-- for images with big height -->
8175
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
8152
8176
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
8153
8177
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
8154
- </xsl:if>
8178
+ </xsl:if> -->
8155
8179
  <xsl:attribute name="scaling">uniform</xsl:attribute>
8180
+
8181
+ <xsl:if test="$scale_y != 1">
8182
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
8183
+ </xsl:if>
8184
+
8156
8185
  <xsl:copy-of select="$svg_content"/>
8157
8186
  </fo:instream-foreign-object>
8158
8187
  <!-- </fo:block> -->
@@ -8190,8 +8219,12 @@
8190
8219
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
8191
8220
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
8192
8221
 
8222
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
8223
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
8224
+
8193
8225
  <xsl:attribute name="width">
8194
8226
  <xsl:choose>
8227
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8195
8228
  <xsl:when test="$width != ''">
8196
8229
  <xsl:value-of select="round($width)"/>
8197
8230
  </xsl:when>
@@ -8200,6 +8233,7 @@
8200
8233
  </xsl:attribute>
8201
8234
  <xsl:attribute name="height">
8202
8235
  <xsl:choose>
8236
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8203
8237
  <xsl:when test="$height != ''">
8204
8238
  <xsl:value-of select="round($height)"/>
8205
8239
  </xsl:when>
@@ -8211,6 +8245,28 @@
8211
8245
  </xsl:copy>
8212
8246
  </xsl:template>
8213
8247
 
8248
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
8249
+ <!-- image[@width]/svg -->
8250
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8251
+ <xsl:attribute name="width">
8252
+ <xsl:choose>
8253
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8254
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8255
+ </xsl:choose>
8256
+ </xsl:attribute>
8257
+ </xsl:template>
8258
+
8259
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
8260
+ <!-- image[@height]/svg -->
8261
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8262
+ <xsl:attribute name="height">
8263
+ <xsl:choose>
8264
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8265
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8266
+ </xsl:choose>
8267
+ </xsl:attribute>
8268
+ </xsl:template>
8269
+
8214
8270
  <!-- regex for 'display: inline-block;' -->
8215
8271
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
8216
8272
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -10331,7 +10387,9 @@
10331
10387
  </xsl:template> <!-- sections_element_style -->
10332
10388
 
10333
10389
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
10334
- <fo:block break-after="page"/>
10390
+
10391
+ <fo:block break-after="page"/>
10392
+
10335
10393
  <fo:block>
10336
10394
  <xsl:call-template name="setId"/>
10337
10395
  <xsl:apply-templates/>
@@ -10398,7 +10456,7 @@
10398
10456
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10399
10457
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10400
10458
  </xsl:when>
10401
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10459
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10402
10460
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10403
10461
  </xsl:when>
10404
10462
  </xsl:choose>
@@ -5037,7 +5037,8 @@
5037
5037
  </xsl:template>
5038
5038
 
5039
5039
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5040
- <xsl:variable name="text" select="normalize-space(.)"/>
5040
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5041
+ <xsl:variable name="text" select="."/>
5041
5042
  <fo:inline font-size="75%" role="SKIP">
5042
5043
  <xsl:if test="string-length($text) &gt; 0">
5043
5044
  <xsl:variable name="smallCapsText">
@@ -7174,16 +7175,44 @@
7174
7175
  </xsl:choose>
7175
7176
 
7176
7177
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7177
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7178
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7178
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7179
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7180
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7181
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7182
+
7183
+ <!-- Example: -->
7179
7184
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7180
7185
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7181
7186
  <!-- effective height / width = 1.48, 1.4 - with title -->
7182
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7187
+
7188
+ <xsl:variable name="scale_x">
7189
+ <xsl:choose>
7190
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7191
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7192
+ </xsl:when>
7193
+ <xsl:otherwise>1</xsl:otherwise>
7194
+ </xsl:choose>
7195
+ </xsl:variable>
7196
+ <xsl:variable name="scale_y">
7197
+ <xsl:choose>
7198
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7199
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7200
+ </xsl:when>
7201
+ <xsl:otherwise>1</xsl:otherwise>
7202
+ </xsl:choose>
7203
+ </xsl:variable>
7204
+
7205
+ <!-- for images with big height -->
7206
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7183
7207
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7184
7208
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7185
- </xsl:if>
7209
+ </xsl:if> -->
7186
7210
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7211
+
7212
+ <xsl:if test="$scale_y != 1">
7213
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7214
+ </xsl:if>
7215
+
7187
7216
  <xsl:copy-of select="$svg_content"/>
7188
7217
  </fo:instream-foreign-object>
7189
7218
  <!-- </fo:block> -->
@@ -7221,8 +7250,12 @@
7221
7250
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7222
7251
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7223
7252
 
7253
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7254
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7255
+
7224
7256
  <xsl:attribute name="width">
7225
7257
  <xsl:choose>
7258
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7226
7259
  <xsl:when test="$width != ''">
7227
7260
  <xsl:value-of select="round($width)"/>
7228
7261
  </xsl:when>
@@ -7231,6 +7264,7 @@
7231
7264
  </xsl:attribute>
7232
7265
  <xsl:attribute name="height">
7233
7266
  <xsl:choose>
7267
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7234
7268
  <xsl:when test="$height != ''">
7235
7269
  <xsl:value-of select="round($height)"/>
7236
7270
  </xsl:when>
@@ -7242,6 +7276,28 @@
7242
7276
  </xsl:copy>
7243
7277
  </xsl:template>
7244
7278
 
7279
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7280
+ <!-- image[@width]/svg -->
7281
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7282
+ <xsl:attribute name="width">
7283
+ <xsl:choose>
7284
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7285
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7286
+ </xsl:choose>
7287
+ </xsl:attribute>
7288
+ </xsl:template>
7289
+
7290
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7291
+ <!-- image[@height]/svg -->
7292
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7293
+ <xsl:attribute name="height">
7294
+ <xsl:choose>
7295
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7296
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7297
+ </xsl:choose>
7298
+ </xsl:attribute>
7299
+ </xsl:template>
7300
+
7245
7301
  <!-- regex for 'display: inline-block;' -->
7246
7302
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7247
7303
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9343,7 +9399,9 @@
9343
9399
  </xsl:template> <!-- sections_element_style -->
9344
9400
 
9345
9401
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9346
- <fo:block break-after="page"/>
9402
+
9403
+ <fo:block break-after="page"/>
9404
+
9347
9405
  <fo:block>
9348
9406
  <xsl:call-template name="setId"/>
9349
9407
  <xsl:apply-templates/>
@@ -9410,7 +9468,7 @@
9410
9468
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9411
9469
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9412
9470
  </xsl:when>
9413
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9471
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9414
9472
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9415
9473
  </xsl:when>
9416
9474
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.5.3".freeze
3
+ VERSION = "2.5.4".freeze
4
4
  end
5
5
  end
@@ -1,8 +1,11 @@
1
1
  module Relaton
2
2
  module Render
3
- class Date
4
- def render
5
- @date&.sub(/-.*$/, "")
3
+ module Ogc
4
+ class Date < ::Relaton::Render::Date
5
+ def render
6
+ @type == "accessed" or @date&.sub(/-.*$/, "")
7
+ @date
8
+ end
6
9
  end
7
10
  end
8
11
  end
@@ -1,5 +1,3 @@
1
- require_relative "date"
2
-
3
1
  module Relaton
4
2
  module Render
5
3
  module Ogc
@@ -1,6 +1,7 @@
1
1
  require "relaton-render"
2
2
  require_relative "parse"
3
3
  require_relative "fields"
4
+ require_relative "date"
4
5
 
5
6
  module Relaton
6
7
  module Render
@@ -11,12 +12,9 @@ module Relaton
11
12
  end
12
13
 
13
14
  def klass_initialize(_options)
14
- @nametemplateklass = Relaton::Render::Template::Name
15
- @seriestemplateklass = Relaton::Render::Template::Series
16
- @extenttemplateklass = Relaton::Render::Template::Extent
17
- @sizetemplateklass = Relaton::Render::Template::Size
18
- @generaltemplateklass = Relaton::Render::Template::General
15
+ super
19
16
  @fieldsklass = Relaton::Render::Ogc::Fields
17
+ @dateklass = Relaton::Render::Ogc::Date
20
18
  @parseklass = Relaton::Render::Ogc::Parse
21
19
  end
22
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-04 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639