metanorma-ogc 2.0.8 → 2.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -638,7 +638,7 @@
638
638
  </xsl:choose>
639
639
  </xsl:template>
640
640
 
641
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
641
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
642
642
  <xsl:call-template name="getLang"/>
643
643
  </xsl:variable><xsl:variable name="pageWidth_">
644
644
  215.9
@@ -2278,9 +2278,11 @@
2278
2278
  <xsl:with-param name="margin" select="$margin"/>
2279
2279
  </xsl:call-template>
2280
2280
 
2281
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2282
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2283
- <xsl:call-template name="add-zero-spaces-java"/>
2281
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2282
+
2283
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2284
+ <xsl:call-template name="add-zero-spaces-java"/>
2285
+
2284
2286
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2285
2287
 
2286
2288
  <xsl:variable name="table-preamble">
@@ -2401,16 +2403,9 @@
2401
2403
  </xsl:for-each>
2402
2404
  </xsl:when>
2403
2405
  <xsl:otherwise>
2404
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2405
- <xsl:choose>
2406
- <xsl:when test=". = 1 or . = 0">
2407
- <fo:table-column column-width="proportional-column-width(2)"/>
2408
- </xsl:when>
2409
- <xsl:otherwise>
2410
- <fo:table-column column-width="proportional-column-width({.})"/>
2411
- </xsl:otherwise>
2412
- </xsl:choose>
2413
- </xsl:for-each>
2406
+ <xsl:call-template name="insertTableColumnWidth">
2407
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2408
+ </xsl:call-template>
2414
2409
  </xsl:otherwise>
2415
2410
  </xsl:choose>
2416
2411
 
@@ -2617,6 +2612,12 @@
2617
2612
  <xsl:with-param name="table" select="$table"/>
2618
2613
  </xsl:call-template>
2619
2614
  </xsl:if>
2615
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
2616
+ <xsl:apply-templates mode="td_text"/>
2617
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
2618
+
2619
+ <xsl:value-of select="."/>
2620
+
2620
2621
  </xsl:template><xsl:template match="text()" mode="td_text">
2621
2622
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2622
2623
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -2718,16 +2719,9 @@
2718
2719
  </xsl:for-each>
2719
2720
  </xsl:when>
2720
2721
  <xsl:otherwise>
2721
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2722
- <xsl:choose>
2723
- <xsl:when test=". = 1 or . = 0">
2724
- <fo:table-column column-width="proportional-column-width(2)"/>
2725
- </xsl:when>
2726
- <xsl:otherwise>
2727
- <fo:table-column column-width="proportional-column-width({.})"/>
2728
- </xsl:otherwise>
2729
- </xsl:choose>
2730
- </xsl:for-each>
2722
+ <xsl:call-template name="insertTableColumnWidth">
2723
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2724
+ </xsl:call-template>
2731
2725
  </xsl:otherwise>
2732
2726
  </xsl:choose>
2733
2727
 
@@ -3377,9 +3371,15 @@
3377
3371
  <xsl:variable name="maxlength_dt">
3378
3372
  <xsl:call-template name="getMaxLength_dt"/>
3379
3373
  </xsl:variable>
3374
+ <xsl:variable name="isContainsExpressReference_">
3375
+ false
3376
+ </xsl:variable>
3377
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
3378
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3380
3379
  <xsl:call-template name="setColumnWidth_dl">
3381
3380
  <xsl:with-param name="colwidths" select="$colwidths"/>
3382
3381
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3382
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
3383
3383
  </xsl:call-template>
3384
3384
  <fo:table-body>
3385
3385
  <xsl:apply-templates>
@@ -3395,6 +3395,7 @@
3395
3395
  </xsl:template><xsl:template name="setColumnWidth_dl">
3396
3396
  <xsl:param name="colwidths"/>
3397
3397
  <xsl:param name="maxlength_dt"/>
3398
+ <xsl:param name="isContainsExpressReference"/>
3398
3399
  <xsl:choose>
3399
3400
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3400
3401
  <fo:table-column column-width="50%"/>
@@ -3402,6 +3403,11 @@
3402
3403
  </xsl:when>
3403
3404
  <xsl:otherwise>
3404
3405
  <xsl:choose>
3406
+ <xsl:when test="$isContainsExpressReference">
3407
+ <xsl:call-template name="insertTableColumnWidth">
3408
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3409
+ </xsl:call-template>
3410
+ </xsl:when>
3405
3411
  <!-- to set width check most wide chars like `W` -->
3406
3412
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3407
3413
  <fo:table-column column-width="7%"/>
@@ -3432,20 +3438,25 @@
3432
3438
  <fo:table-column column-width="60%"/>
3433
3439
  </xsl:when>
3434
3440
  <xsl:otherwise>
3435
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3436
- <xsl:choose>
3437
- <xsl:when test=". = 1 or . = 0">
3438
- <fo:table-column column-width="proportional-column-width(2)"/>
3439
- </xsl:when>
3440
- <xsl:otherwise>
3441
- <fo:table-column column-width="proportional-column-width({.})"/>
3442
- </xsl:otherwise>
3443
- </xsl:choose>
3444
- </xsl:for-each>
3441
+ <xsl:call-template name="insertTableColumnWidth">
3442
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3443
+ </xsl:call-template>
3445
3444
  </xsl:otherwise>
3446
3445
  </xsl:choose>
3447
3446
  </xsl:otherwise>
3448
3447
  </xsl:choose>
3448
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3449
+ <xsl:param name="colwidths"/>
3450
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3451
+ <xsl:choose>
3452
+ <xsl:when test=". = 1 or . = 0">
3453
+ <fo:table-column column-width="proportional-column-width(2)"/>
3454
+ </xsl:when>
3455
+ <xsl:otherwise>
3456
+ <fo:table-column column-width="proportional-column-width({.})"/>
3457
+ </xsl:otherwise>
3458
+ </xsl:choose>
3459
+ </xsl:for-each>
3449
3460
  </xsl:template><xsl:template name="getMaxLength_dt">
3450
3461
  <xsl:variable name="lengths">
3451
3462
  <xsl:for-each select="*[local-name()='dt']">
@@ -4053,6 +4064,9 @@
4053
4064
  <xsl:variable name="isDeleted" select="@deleted"/>
4054
4065
 
4055
4066
  <fo:inline xsl:use-attribute-sets="mathml-style">
4067
+
4068
+
4069
+
4056
4070
 
4057
4071
 
4058
4072
  <xsl:call-template name="setTrackChangesStyles">
@@ -4060,48 +4074,80 @@
4060
4074
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4061
4075
  </xsl:call-template>
4062
4076
 
4077
+ <xsl:if test="$add_math_as_text = 'true'">
4078
+ <!-- insert helper tag -->
4079
+ <!-- set unique font-size (fiction) -->
4080
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4081
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
4082
+ </xsl:if>
4063
4083
 
4064
-
4065
- <xsl:variable name="mathml">
4066
- <xsl:apply-templates select="." mode="mathml"/>
4084
+ <xsl:variable name="mathml_content">
4085
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4067
4086
  </xsl:variable>
4068
- <fo:instream-foreign-object fox:alt-text="Math">
4069
4087
 
4088
+
4089
+ <xsl:call-template name="mathml_instream_object">
4090
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4091
+ </xsl:call-template>
4070
4092
 
4071
-
4072
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4073
- <xsl:variable name="comment_text_">
4074
- <xsl:choose>
4075
- <xsl:when test="normalize-space($comment_text_following) != ''">
4076
- <xsl:value-of select="$comment_text_following"/>
4077
- </xsl:when>
4078
- <xsl:otherwise>
4079
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4080
- </xsl:otherwise>
4081
- </xsl:choose>
4082
- </xsl:variable>
4083
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4084
-
4085
- <xsl:if test="normalize-space($comment_text) != ''">
4086
- <!-- put Mathin Alternate Text -->
4087
- <xsl:attribute name="fox:alt-text">
4088
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4089
- </xsl:attribute>
4090
- </xsl:if>
4091
-
4092
- <xsl:variable name="mathml_content">
4093
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4094
- </xsl:variable>
4095
- <!-- put MathML in Actual Text -->
4096
- <xsl:attribute name="fox:actual-text">
4097
- <xsl:value-of select="$mathml_content"/>
4098
- </xsl:attribute>
4099
-
4100
-
4101
-
4102
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4103
- </fo:instream-foreign-object>
4093
+
4104
4094
  </fo:inline>
4095
+ </xsl:template><xsl:template name="getMathml_comment_text">
4096
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4097
+ <xsl:variable name="comment_text_">
4098
+ <xsl:choose>
4099
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4100
+ <xsl:value-of select="$comment_text_following"/>
4101
+ </xsl:when>
4102
+ <xsl:otherwise>
4103
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4104
+ </xsl:otherwise>
4105
+ </xsl:choose>
4106
+ </xsl:variable>
4107
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4108
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4109
+ <xsl:value-of select="$comment_text"/>
4110
+ </xsl:template><xsl:template name="mathml_instream_object">
4111
+ <xsl:param name="comment_text"/>
4112
+ <xsl:param name="mathml_content"/>
4113
+
4114
+ <xsl:variable name="comment_text_">
4115
+ <xsl:choose>
4116
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4117
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4118
+ </xsl:choose>
4119
+ </xsl:variable>
4120
+
4121
+ <xsl:variable name="mathml">
4122
+ <xsl:apply-templates select="." mode="mathml"/>
4123
+ </xsl:variable>
4124
+
4125
+ <fo:instream-foreign-object fox:alt-text="Math">
4126
+
4127
+
4128
+
4129
+
4130
+
4131
+
4132
+
4133
+ <!-- put MathML in Actual Text -->
4134
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4135
+ <xsl:attribute name="fox:actual-text">
4136
+ <xsl:value-of select="$mathml_content"/>
4137
+ </xsl:attribute>
4138
+
4139
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4140
+ <xsl:if test="normalize-space($comment_text_) != ''">
4141
+ <!-- put Mathin Alternate Text -->
4142
+ <xsl:attribute name="fox:alt-text">
4143
+ <xsl:value-of select="$comment_text_"/>
4144
+ </xsl:attribute>
4145
+ </xsl:if>
4146
+ <!-- </xsl:if> -->
4147
+
4148
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4149
+
4150
+ </fo:instream-foreign-object>
4105
4151
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4106
4152
  <!-- <xsl:text>a+b</xsl:text> -->
4107
4153
  <xsl:text>&lt;</xsl:text>
@@ -4729,18 +4775,33 @@
4729
4775
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4730
4776
  <xsl:copy>
4731
4777
  <xsl:apply-templates select="@*" mode="svg_update"/>
4732
- <xsl:variable name="viewbox">
4778
+ <xsl:variable name="viewbox_">
4733
4779
  <xsl:call-template name="split">
4734
4780
  <xsl:with-param name="pText" select="@viewBox"/>
4735
4781
  <xsl:with-param name="sep" select="' '"/>
4736
4782
  </xsl:call-template>
4737
4783
  </xsl:variable>
4784
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
4785
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
4786
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
4787
+
4738
4788
  <xsl:attribute name="width">
4739
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4789
+ <xsl:choose>
4790
+ <xsl:when test="$width != ''">
4791
+ <xsl:value-of select="round($width)"/>
4792
+ </xsl:when>
4793
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
4794
+ </xsl:choose>
4740
4795
  </xsl:attribute>
4741
4796
  <xsl:attribute name="height">
4742
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4797
+ <xsl:choose>
4798
+ <xsl:when test="$height != ''">
4799
+ <xsl:value-of select="round($height)"/>
4800
+ </xsl:when>
4801
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
4802
+ </xsl:choose>
4743
4803
  </xsl:attribute>
4804
+
4744
4805
  <xsl:apply-templates mode="svg_update"/>
4745
4806
  </xsl:copy>
4746
4807
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -157,6 +157,7 @@ module IsoDoc
157
157
 
158
158
  def toWord(result, filename, dir, header)
159
159
  result = from_xhtml(word_cleanup(to_xhtml(result)))
160
+ .gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
160
161
  @wordstylesheet = wordstylesheet_update
161
162
  Html2Doc.process(
162
163
  result,
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.0.8".freeze
3
+ VERSION = "2.0.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-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.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: 2022-04-18 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639