metanorma-ieee 1.2.5 → 1.2.7

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: ab37b771354bffc19e7080b500920d2d06903584f58de70dd5c2f0ba2ad0ed65
4
- data.tar.gz: e5d1cb8d760b5ef370bf8902fb22e09fd59423a6957af2f8ebb8cfab28cc875b
3
+ metadata.gz: 710f4bee007f0e7159c0d4fb92069b38e4f5626d3d34d1399b013d92db862bcb
4
+ data.tar.gz: ea510070d80ec5b32961ccdc3d03f274d4368296f0cc4e4375d4a4e5686255d8
5
5
  SHA512:
6
- metadata.gz: 246ea4c06c6ec1086b1d27b75cf1e9a877d804d5328205d6f0701db0a19afffef5cf8a2dc63d749138541cbba28c589acd8e2546ebe6a510360701dacf1acac8
7
- data.tar.gz: f0bbae74c7dea1bf820cd1fa1aabd3cac46ea0985814c76d14e81b2ff6762749e3710bab4f75fe504f5a6d61746fc2fd62908bc6dcc90fefff75f0eb2141d8a3
6
+ metadata.gz: 6faa187ccecea80276a1584f607f80a54e550ec836cca69699a8bb4335107d3ccc56aec1d1659eb99b531475cf4ddf5916efcb6c9cefe3082daaf59998011e0b
7
+ data.tar.gz: 367816ece10ffea1106d3515276c0215820fc7b06b500ee97da72149a16720d00d3d770f12ac97e988298918be063286d8e7dcedf6745b66595b05eaf7515451
@@ -3811,17 +3811,30 @@
3811
3811
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
3812
3812
 
3813
3813
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
3814
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3814
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3815
3815
  <!-- Example: <tables>
3816
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3817
- <tbody>
3818
- <tr>
3819
- <td id="tab-symdu_1_1">
3820
- <p_len>6</p_len>
3821
- <p_len>100</p_len> for 2nd paragraph
3822
- <word_len>6</word_len>
3823
- <word_len>20</word_len>
3824
- ...
3816
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
3817
+ <column width_max="39354" width_min="39354"/>
3818
+ <column width_max="75394" width_min="75394"/>
3819
+ <column width_max="108813" width_min="108813"/>
3820
+ <tbody>
3821
+ <tr>
3822
+ <td width_max="39354" width_min="39354">
3823
+ <p_len>39354</p_len>
3824
+ <word_len>39354</word_len>
3825
+ </td>
3826
+
3827
+ OLD:
3828
+ <tables>
3829
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3830
+ <tbody>
3831
+ <tr>
3832
+ <td id="tab-symdu_1_1">
3833
+ <p_len>6</p_len>
3834
+ <p_len>100</p_len> for 2nd paragraph
3835
+ <word_len>6</word_len>
3836
+ <word_len>20</word_len>
3837
+ ...
3825
3838
  -->
3826
3839
 
3827
3840
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -4040,6 +4053,10 @@
4040
4053
  <xsl:variable name="zero_width_space">​</xsl:variable>
4041
4054
  <xsl:variable name="hair_space"> </xsl:variable>
4042
4055
  <xsl:variable name="en_dash">–</xsl:variable>
4056
+ <xsl:variable name="em_dash">—</xsl:variable>
4057
+ <xsl:variable name="cr">&#13;</xsl:variable>
4058
+ <xsl:variable name="lf">
4059
+ </xsl:variable>
4043
4060
 
4044
4061
  <xsl:template name="getTitle">
4045
4062
  <xsl:param name="name"/>
@@ -4371,6 +4388,10 @@
4371
4388
 
4372
4389
  </xsl:attribute-set> <!-- example-name-style -->
4373
4390
 
4391
+ <xsl:template name="refine_example-name-style">
4392
+
4393
+ </xsl:template>
4394
+
4374
4395
  <xsl:attribute-set name="example-p-style">
4375
4396
 
4376
4397
  </xsl:attribute-set> <!-- example-p-style -->
@@ -4391,6 +4412,10 @@
4391
4412
 
4392
4413
  </xsl:attribute-set> <!-- termexample-name-style -->
4393
4414
 
4415
+ <xsl:template name="refine_termexample-name-style">
4416
+
4417
+ </xsl:template>
4418
+
4394
4419
  <!-- ========================== -->
4395
4420
  <!-- Table styles -->
4396
4421
  <!-- ========================== -->
@@ -4606,6 +4631,10 @@
4606
4631
 
4607
4632
  </xsl:attribute-set> <!-- table-fn-style -->
4608
4633
 
4634
+ <xsl:template name="refine_table-fn-style">
4635
+
4636
+ </xsl:template>
4637
+
4609
4638
  <xsl:attribute-set name="table-fn-number-style">
4610
4639
  <xsl:attribute name="font-size">80%</xsl:attribute>
4611
4640
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -4615,6 +4644,10 @@
4615
4644
 
4616
4645
  </xsl:attribute-set> <!-- table-fn-number-style -->
4617
4646
 
4647
+ <xsl:template name="refine_table-fn-number-style">
4648
+
4649
+ </xsl:template>
4650
+
4618
4651
  <xsl:attribute-set name="fn-container-body-style">
4619
4652
  <xsl:attribute name="text-indent">0</xsl:attribute>
4620
4653
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -5750,6 +5783,20 @@
5750
5783
  </xsl:for-each>
5751
5784
  </xsl:template>
5752
5785
 
5786
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
5787
+
5788
+ <xsl:template match="*[local-name()='table']" priority="2">
5789
+ <xsl:choose>
5790
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5791
+ <xsl:call-template name="table"/>
5792
+ </xsl:when>
5793
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5794
+ <xsl:otherwise>
5795
+ <xsl:call-template name="table"/>
5796
+ </xsl:otherwise>
5797
+ </xsl:choose>
5798
+ </xsl:template>
5799
+
5753
5800
  <xsl:template match="*[local-name()='table']" name="table">
5754
5801
 
5755
5802
  <xsl:variable name="table-preamble">
@@ -5759,9 +5806,11 @@
5759
5806
  <xsl:variable name="table">
5760
5807
 
5761
5808
  <xsl:variable name="simple-table">
5762
- <xsl:call-template name="getSimpleTable">
5763
- <xsl:with-param name="id" select="@id"/>
5764
- </xsl:call-template>
5809
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
5810
+ <xsl:call-template name="getSimpleTable">
5811
+ <xsl:with-param name="id" select="@id"/>
5812
+ </xsl:call-template>
5813
+ </xsl:if>
5765
5814
  </xsl:variable>
5766
5815
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
5767
5816
 
@@ -5862,9 +5911,9 @@
5862
5911
  </xsl:attribute>
5863
5912
  </xsl:for-each>
5864
5913
 
5865
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5914
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5866
5915
  <xsl:if test="$isNoteOrFnExist = 'true'">
5867
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5916
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5868
5917
  </xsl:if>
5869
5918
 
5870
5919
  <xsl:choose>
@@ -5992,6 +6041,17 @@
5992
6041
  </xsl:if>
5993
6042
  </xsl:template> <!-- table/name -->
5994
6043
 
6044
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
6045
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
6046
+ <xsl:choose>
6047
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
6048
+ <!-- remove CR or LF at start -->
6049
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
6050
+ </xsl:when>
6051
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6052
+ </xsl:choose>
6053
+ </xsl:template>
6054
+
5995
6055
  <!-- SOURCE: ... -->
5996
6056
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
5997
6057
  <xsl:call-template name="termsource"/>
@@ -6413,7 +6473,7 @@
6413
6473
  <xsl:param name="colwidths"/>
6414
6474
  <xsl:param name="colgroup"/>
6415
6475
 
6416
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6476
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6417
6477
 
6418
6478
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6419
6479
 
@@ -6485,7 +6545,7 @@
6485
6545
 
6486
6546
  <xsl:apply-templates select="../*[local-name()='p']"/>
6487
6547
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6488
- <xsl:apply-templates select="../*[local-name()='note']"/>
6548
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
6489
6549
  <xsl:apply-templates select="../*[local-name()='example']"/>
6490
6550
  <xsl:apply-templates select="../*[local-name()='source']"/>
6491
6551
 
@@ -6495,7 +6555,7 @@
6495
6555
 
6496
6556
  <!-- horizontal row separator -->
6497
6557
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6498
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6558
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6499
6559
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6500
6560
 
6501
6561
  <xsl:call-template name="setBordersTableArray"/>
@@ -7016,8 +7076,9 @@
7016
7076
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7017
7077
 
7018
7078
  <fo:block xsl:use-attribute-sets="table-fn-style">
7019
-
7079
+ <xsl:call-template name="refine_table-fn-style"/>
7020
7080
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
7081
+ <xsl:call-template name="refine_table-fn-number-style"/>
7021
7082
 
7022
7083
  <xsl:value-of select="@reference"/>
7023
7084
 
@@ -7201,7 +7262,20 @@
7201
7262
  <!-- Definition List -->
7202
7263
  <!-- ===================== -->
7203
7264
 
7204
- <xsl:template match="*[local-name()='dl']">
7265
+ <!-- for table auto-layout algorithm -->
7266
+ <xsl:template match="*[local-name()='dl']" priority="2">
7267
+ <xsl:choose>
7268
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
7269
+ <xsl:call-template name="dl"/>
7270
+ </xsl:when>
7271
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7272
+ <xsl:otherwise>
7273
+ <xsl:call-template name="dl"/>
7274
+ </xsl:otherwise>
7275
+ </xsl:choose>
7276
+ </xsl:template>
7277
+
7278
+ <xsl:template match="*[local-name()='dl']" name="dl">
7205
7279
  <xsl:variable name="isAdded" select="@added"/>
7206
7280
  <xsl:variable name="isDeleted" select="@deleted"/>
7207
7281
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -8155,11 +8229,16 @@
8155
8229
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8156
8230
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8157
8231
  <xsl:variable name="text" select="."/>
8158
- <fo:inline font-size="75%" role="SKIP">
8232
+ <xsl:variable name="ratio_">
8233
+ 0.75
8234
+ </xsl:variable>
8235
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
8236
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
8159
8237
  <xsl:if test="string-length($text) &gt; 0">
8160
8238
  <xsl:variable name="smallCapsText">
8161
8239
  <xsl:call-template name="recursiveSmallCaps">
8162
8240
  <xsl:with-param name="text" select="$text"/>
8241
+ <xsl:with-param name="ratio" select="$ratio"/>
8163
8242
  </xsl:call-template>
8164
8243
  </xsl:variable>
8165
8244
  <!-- merge neighboring fo:inline -->
@@ -8196,12 +8275,13 @@
8196
8275
 
8197
8276
  <xsl:template name="recursiveSmallCaps">
8198
8277
  <xsl:param name="text"/>
8278
+ <xsl:param name="ratio"/>
8199
8279
  <xsl:variable name="char" select="substring($text,1,1)"/>
8200
8280
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
8201
8281
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
8202
8282
  <xsl:choose>
8203
8283
  <xsl:when test="$char=$upperCase">
8204
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
8284
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
8205
8285
  <xsl:value-of select="$upperCase"/>
8206
8286
  </fo:inline>
8207
8287
  </xsl:when>
@@ -8212,6 +8292,7 @@
8212
8292
  <xsl:if test="string-length($text) &gt; 1">
8213
8293
  <xsl:call-template name="recursiveSmallCaps">
8214
8294
  <xsl:with-param name="text" select="substring($text,2)"/>
8295
+ <xsl:with-param name="ratio" select="$ratio"/>
8215
8296
  </xsl:call-template>
8216
8297
  </xsl:if>
8217
8298
  </xsl:template>
@@ -8248,6 +8329,9 @@
8248
8329
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
8249
8330
  <style name="{$key}"><xsl:value-of select="$value"/></style>
8250
8331
  </xsl:if>
8332
+ <xsl:if test="$key = 'text-indent'">
8333
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
8334
+ </xsl:if>
8251
8335
  </xsl:for-each>
8252
8336
  </xsl:variable>
8253
8337
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -9120,7 +9204,13 @@
9120
9204
  <xsl:value-of select="$language_current_2"/>
9121
9205
  </xsl:when>
9122
9206
  <xsl:otherwise>
9123
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
9207
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
9208
+ <xsl:choose>
9209
+ <xsl:when test="$language_current_3 != ''">
9210
+ <xsl:value-of select="$language_current_3"/>
9211
+ </xsl:when>
9212
+ <xsl:otherwise>en</xsl:otherwise>
9213
+ </xsl:choose>
9124
9214
  </xsl:otherwise>
9125
9215
  </xsl:choose>
9126
9216
  </xsl:otherwise>
@@ -9652,6 +9742,11 @@
9652
9742
  </xsl:call-template>
9653
9743
  </xsl:template>
9654
9744
 
9745
+ <!-- command between two xref points to non-standard bibitem -->
9746
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
9747
+ <xsl:value-of select="."/>
9748
+ </xsl:template>
9749
+
9655
9750
  <!-- ====== -->
9656
9751
  <!-- formula -->
9657
9752
  <!-- ====== -->
@@ -10022,7 +10117,7 @@
10022
10117
  </xsl:when>
10023
10118
  <xsl:otherwise>
10024
10119
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
10025
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
10120
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
10026
10121
 
10027
10122
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
10028
10123
  <xsl:attribute name="width">
@@ -10357,6 +10452,8 @@
10357
10452
  </xsl:attribute>
10358
10453
  </xsl:template>
10359
10454
 
10455
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
10456
+
10360
10457
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
10361
10458
  <xsl:copy>
10362
10459
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -10375,7 +10472,8 @@
10375
10472
 
10376
10473
  <xsl:attribute name="width">
10377
10474
  <xsl:choose>
10378
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10475
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10476
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10379
10477
  <xsl:when test="$width != ''">
10380
10478
  <xsl:value-of select="round($width)"/>
10381
10479
  </xsl:when>
@@ -10384,7 +10482,8 @@
10384
10482
  </xsl:attribute>
10385
10483
  <xsl:attribute name="height">
10386
10484
  <xsl:choose>
10387
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10485
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10486
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10388
10487
  <xsl:when test="$height != ''">
10389
10488
  <xsl:value-of select="round($height)"/>
10390
10489
  </xsl:when>
@@ -10401,7 +10500,7 @@
10401
10500
  <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10402
10501
  <xsl:attribute name="width">
10403
10502
  <xsl:choose>
10404
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10503
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10405
10504
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10406
10505
  </xsl:choose>
10407
10506
  </xsl:attribute>
@@ -10412,7 +10511,7 @@
10412
10511
  <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10413
10512
  <xsl:attribute name="height">
10414
10513
  <xsl:choose>
10415
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10514
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10416
10515
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10417
10516
  </xsl:choose>
10418
10517
  </xsl:attribute>
@@ -11873,6 +11972,7 @@
11873
11972
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
11874
11973
  <xsl:if test="normalize-space() != ''">
11875
11974
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11975
+ <xsl:call-template name="refine_termexample-name-style"/>
11876
11976
  <xsl:apply-templates/>:
11877
11977
  </fo:inline>
11878
11978
  </xsl:if>
@@ -12027,6 +12127,7 @@
12027
12127
  </xsl:when>
12028
12128
  <xsl:otherwise>
12029
12129
  <fo:inline xsl:use-attribute-sets="example-name-style">
12130
+ <xsl:call-template name="refine_example-name-style"/>
12030
12131
  <xsl:apply-templates/>:
12031
12132
  </fo:inline>
12032
12133
  </xsl:otherwise>
@@ -13231,6 +13332,7 @@
13231
13332
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
13232
13333
 
13233
13334
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
13335
+
13234
13336
  <xsl:call-template name="processBibitem"/>
13235
13337
  </fo:block>
13236
13338
 
@@ -13285,6 +13387,7 @@
13285
13387
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
13286
13388
  <xsl:otherwise>
13287
13389
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
13390
+
13288
13391
  <fo:list-item-label end-indent="label-end()">
13289
13392
  <fo:block role="SKIP">
13290
13393
  <fo:inline role="SKIP">
@@ -3811,17 +3811,30 @@
3811
3811
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
3812
3812
 
3813
3813
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
3814
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3814
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3815
3815
  <!-- Example: <tables>
3816
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3817
- <tbody>
3818
- <tr>
3819
- <td id="tab-symdu_1_1">
3820
- <p_len>6</p_len>
3821
- <p_len>100</p_len> for 2nd paragraph
3822
- <word_len>6</word_len>
3823
- <word_len>20</word_len>
3824
- ...
3816
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
3817
+ <column width_max="39354" width_min="39354"/>
3818
+ <column width_max="75394" width_min="75394"/>
3819
+ <column width_max="108813" width_min="108813"/>
3820
+ <tbody>
3821
+ <tr>
3822
+ <td width_max="39354" width_min="39354">
3823
+ <p_len>39354</p_len>
3824
+ <word_len>39354</word_len>
3825
+ </td>
3826
+
3827
+ OLD:
3828
+ <tables>
3829
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3830
+ <tbody>
3831
+ <tr>
3832
+ <td id="tab-symdu_1_1">
3833
+ <p_len>6</p_len>
3834
+ <p_len>100</p_len> for 2nd paragraph
3835
+ <word_len>6</word_len>
3836
+ <word_len>20</word_len>
3837
+ ...
3825
3838
  -->
3826
3839
 
3827
3840
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -4040,6 +4053,10 @@
4040
4053
  <xsl:variable name="zero_width_space">​</xsl:variable>
4041
4054
  <xsl:variable name="hair_space"> </xsl:variable>
4042
4055
  <xsl:variable name="en_dash">–</xsl:variable>
4056
+ <xsl:variable name="em_dash">—</xsl:variable>
4057
+ <xsl:variable name="cr">&#13;</xsl:variable>
4058
+ <xsl:variable name="lf">
4059
+ </xsl:variable>
4043
4060
 
4044
4061
  <xsl:template name="getTitle">
4045
4062
  <xsl:param name="name"/>
@@ -4371,6 +4388,10 @@
4371
4388
 
4372
4389
  </xsl:attribute-set> <!-- example-name-style -->
4373
4390
 
4391
+ <xsl:template name="refine_example-name-style">
4392
+
4393
+ </xsl:template>
4394
+
4374
4395
  <xsl:attribute-set name="example-p-style">
4375
4396
 
4376
4397
  </xsl:attribute-set> <!-- example-p-style -->
@@ -4391,6 +4412,10 @@
4391
4412
 
4392
4413
  </xsl:attribute-set> <!-- termexample-name-style -->
4393
4414
 
4415
+ <xsl:template name="refine_termexample-name-style">
4416
+
4417
+ </xsl:template>
4418
+
4394
4419
  <!-- ========================== -->
4395
4420
  <!-- Table styles -->
4396
4421
  <!-- ========================== -->
@@ -4606,6 +4631,10 @@
4606
4631
 
4607
4632
  </xsl:attribute-set> <!-- table-fn-style -->
4608
4633
 
4634
+ <xsl:template name="refine_table-fn-style">
4635
+
4636
+ </xsl:template>
4637
+
4609
4638
  <xsl:attribute-set name="table-fn-number-style">
4610
4639
  <xsl:attribute name="font-size">80%</xsl:attribute>
4611
4640
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -4615,6 +4644,10 @@
4615
4644
 
4616
4645
  </xsl:attribute-set> <!-- table-fn-number-style -->
4617
4646
 
4647
+ <xsl:template name="refine_table-fn-number-style">
4648
+
4649
+ </xsl:template>
4650
+
4618
4651
  <xsl:attribute-set name="fn-container-body-style">
4619
4652
  <xsl:attribute name="text-indent">0</xsl:attribute>
4620
4653
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -5750,6 +5783,20 @@
5750
5783
  </xsl:for-each>
5751
5784
  </xsl:template>
5752
5785
 
5786
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
5787
+
5788
+ <xsl:template match="*[local-name()='table']" priority="2">
5789
+ <xsl:choose>
5790
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5791
+ <xsl:call-template name="table"/>
5792
+ </xsl:when>
5793
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5794
+ <xsl:otherwise>
5795
+ <xsl:call-template name="table"/>
5796
+ </xsl:otherwise>
5797
+ </xsl:choose>
5798
+ </xsl:template>
5799
+
5753
5800
  <xsl:template match="*[local-name()='table']" name="table">
5754
5801
 
5755
5802
  <xsl:variable name="table-preamble">
@@ -5759,9 +5806,11 @@
5759
5806
  <xsl:variable name="table">
5760
5807
 
5761
5808
  <xsl:variable name="simple-table">
5762
- <xsl:call-template name="getSimpleTable">
5763
- <xsl:with-param name="id" select="@id"/>
5764
- </xsl:call-template>
5809
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
5810
+ <xsl:call-template name="getSimpleTable">
5811
+ <xsl:with-param name="id" select="@id"/>
5812
+ </xsl:call-template>
5813
+ </xsl:if>
5765
5814
  </xsl:variable>
5766
5815
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
5767
5816
 
@@ -5862,9 +5911,9 @@
5862
5911
  </xsl:attribute>
5863
5912
  </xsl:for-each>
5864
5913
 
5865
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5914
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5866
5915
  <xsl:if test="$isNoteOrFnExist = 'true'">
5867
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5916
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5868
5917
  </xsl:if>
5869
5918
 
5870
5919
  <xsl:choose>
@@ -5992,6 +6041,17 @@
5992
6041
  </xsl:if>
5993
6042
  </xsl:template> <!-- table/name -->
5994
6043
 
6044
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
6045
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
6046
+ <xsl:choose>
6047
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
6048
+ <!-- remove CR or LF at start -->
6049
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
6050
+ </xsl:when>
6051
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6052
+ </xsl:choose>
6053
+ </xsl:template>
6054
+
5995
6055
  <!-- SOURCE: ... -->
5996
6056
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
5997
6057
  <xsl:call-template name="termsource"/>
@@ -6413,7 +6473,7 @@
6413
6473
  <xsl:param name="colwidths"/>
6414
6474
  <xsl:param name="colgroup"/>
6415
6475
 
6416
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6476
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
6417
6477
 
6418
6478
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6419
6479
 
@@ -6485,7 +6545,7 @@
6485
6545
 
6486
6546
  <xsl:apply-templates select="../*[local-name()='p']"/>
6487
6547
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6488
- <xsl:apply-templates select="../*[local-name()='note']"/>
6548
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
6489
6549
  <xsl:apply-templates select="../*[local-name()='example']"/>
6490
6550
  <xsl:apply-templates select="../*[local-name()='source']"/>
6491
6551
 
@@ -6495,7 +6555,7 @@
6495
6555
 
6496
6556
  <!-- horizontal row separator -->
6497
6557
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6498
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6558
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6499
6559
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6500
6560
 
6501
6561
  <xsl:call-template name="setBordersTableArray"/>
@@ -7016,8 +7076,9 @@
7016
7076
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7017
7077
 
7018
7078
  <fo:block xsl:use-attribute-sets="table-fn-style">
7019
-
7079
+ <xsl:call-template name="refine_table-fn-style"/>
7020
7080
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
7081
+ <xsl:call-template name="refine_table-fn-number-style"/>
7021
7082
 
7022
7083
  <xsl:value-of select="@reference"/>
7023
7084
 
@@ -7201,7 +7262,20 @@
7201
7262
  <!-- Definition List -->
7202
7263
  <!-- ===================== -->
7203
7264
 
7204
- <xsl:template match="*[local-name()='dl']">
7265
+ <!-- for table auto-layout algorithm -->
7266
+ <xsl:template match="*[local-name()='dl']" priority="2">
7267
+ <xsl:choose>
7268
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
7269
+ <xsl:call-template name="dl"/>
7270
+ </xsl:when>
7271
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7272
+ <xsl:otherwise>
7273
+ <xsl:call-template name="dl"/>
7274
+ </xsl:otherwise>
7275
+ </xsl:choose>
7276
+ </xsl:template>
7277
+
7278
+ <xsl:template match="*[local-name()='dl']" name="dl">
7205
7279
  <xsl:variable name="isAdded" select="@added"/>
7206
7280
  <xsl:variable name="isDeleted" select="@deleted"/>
7207
7281
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -8155,11 +8229,16 @@
8155
8229
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
8156
8230
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
8157
8231
  <xsl:variable name="text" select="."/>
8158
- <fo:inline font-size="75%" role="SKIP">
8232
+ <xsl:variable name="ratio_">
8233
+ 0.75
8234
+ </xsl:variable>
8235
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
8236
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
8159
8237
  <xsl:if test="string-length($text) &gt; 0">
8160
8238
  <xsl:variable name="smallCapsText">
8161
8239
  <xsl:call-template name="recursiveSmallCaps">
8162
8240
  <xsl:with-param name="text" select="$text"/>
8241
+ <xsl:with-param name="ratio" select="$ratio"/>
8163
8242
  </xsl:call-template>
8164
8243
  </xsl:variable>
8165
8244
  <!-- merge neighboring fo:inline -->
@@ -8196,12 +8275,13 @@
8196
8275
 
8197
8276
  <xsl:template name="recursiveSmallCaps">
8198
8277
  <xsl:param name="text"/>
8278
+ <xsl:param name="ratio"/>
8199
8279
  <xsl:variable name="char" select="substring($text,1,1)"/>
8200
8280
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
8201
8281
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
8202
8282
  <xsl:choose>
8203
8283
  <xsl:when test="$char=$upperCase">
8204
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
8284
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
8205
8285
  <xsl:value-of select="$upperCase"/>
8206
8286
  </fo:inline>
8207
8287
  </xsl:when>
@@ -8212,6 +8292,7 @@
8212
8292
  <xsl:if test="string-length($text) &gt; 1">
8213
8293
  <xsl:call-template name="recursiveSmallCaps">
8214
8294
  <xsl:with-param name="text" select="substring($text,2)"/>
8295
+ <xsl:with-param name="ratio" select="$ratio"/>
8215
8296
  </xsl:call-template>
8216
8297
  </xsl:if>
8217
8298
  </xsl:template>
@@ -8248,6 +8329,9 @@
8248
8329
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
8249
8330
  <style name="{$key}"><xsl:value-of select="$value"/></style>
8250
8331
  </xsl:if>
8332
+ <xsl:if test="$key = 'text-indent'">
8333
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
8334
+ </xsl:if>
8251
8335
  </xsl:for-each>
8252
8336
  </xsl:variable>
8253
8337
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -9120,7 +9204,13 @@
9120
9204
  <xsl:value-of select="$language_current_2"/>
9121
9205
  </xsl:when>
9122
9206
  <xsl:otherwise>
9123
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
9207
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
9208
+ <xsl:choose>
9209
+ <xsl:when test="$language_current_3 != ''">
9210
+ <xsl:value-of select="$language_current_3"/>
9211
+ </xsl:when>
9212
+ <xsl:otherwise>en</xsl:otherwise>
9213
+ </xsl:choose>
9124
9214
  </xsl:otherwise>
9125
9215
  </xsl:choose>
9126
9216
  </xsl:otherwise>
@@ -9652,6 +9742,11 @@
9652
9742
  </xsl:call-template>
9653
9743
  </xsl:template>
9654
9744
 
9745
+ <!-- command between two xref points to non-standard bibitem -->
9746
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
9747
+ <xsl:value-of select="."/>
9748
+ </xsl:template>
9749
+
9655
9750
  <!-- ====== -->
9656
9751
  <!-- formula -->
9657
9752
  <!-- ====== -->
@@ -10022,7 +10117,7 @@
10022
10117
  </xsl:when>
10023
10118
  <xsl:otherwise>
10024
10119
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
10025
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
10120
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
10026
10121
 
10027
10122
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
10028
10123
  <xsl:attribute name="width">
@@ -10357,6 +10452,8 @@
10357
10452
  </xsl:attribute>
10358
10453
  </xsl:template>
10359
10454
 
10455
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
10456
+
10360
10457
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
10361
10458
  <xsl:copy>
10362
10459
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -10375,7 +10472,8 @@
10375
10472
 
10376
10473
  <xsl:attribute name="width">
10377
10474
  <xsl:choose>
10378
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10475
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10476
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10379
10477
  <xsl:when test="$width != ''">
10380
10478
  <xsl:value-of select="round($width)"/>
10381
10479
  </xsl:when>
@@ -10384,7 +10482,8 @@
10384
10482
  </xsl:attribute>
10385
10483
  <xsl:attribute name="height">
10386
10484
  <xsl:choose>
10387
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10485
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
10486
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10388
10487
  <xsl:when test="$height != ''">
10389
10488
  <xsl:value-of select="round($height)"/>
10390
10489
  </xsl:when>
@@ -10401,7 +10500,7 @@
10401
10500
  <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
10402
10501
  <xsl:attribute name="width">
10403
10502
  <xsl:choose>
10404
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10503
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
10405
10504
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10406
10505
  </xsl:choose>
10407
10506
  </xsl:attribute>
@@ -10412,7 +10511,7 @@
10412
10511
  <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
10413
10512
  <xsl:attribute name="height">
10414
10513
  <xsl:choose>
10415
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10514
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
10416
10515
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10417
10516
  </xsl:choose>
10418
10517
  </xsl:attribute>
@@ -11873,6 +11972,7 @@
11873
11972
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
11874
11973
  <xsl:if test="normalize-space() != ''">
11875
11974
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
11975
+ <xsl:call-template name="refine_termexample-name-style"/>
11876
11976
  <xsl:apply-templates/>:
11877
11977
  </fo:inline>
11878
11978
  </xsl:if>
@@ -12027,6 +12127,7 @@
12027
12127
  </xsl:when>
12028
12128
  <xsl:otherwise>
12029
12129
  <fo:inline xsl:use-attribute-sets="example-name-style">
12130
+ <xsl:call-template name="refine_example-name-style"/>
12030
12131
  <xsl:apply-templates/>:
12031
12132
  </fo:inline>
12032
12133
  </xsl:otherwise>
@@ -13231,6 +13332,7 @@
13231
13332
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
13232
13333
 
13233
13334
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
13335
+
13234
13336
  <xsl:call-template name="processBibitem"/>
13235
13337
  </fo:block>
13236
13338
 
@@ -13285,6 +13387,7 @@
13285
13387
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
13286
13388
  <xsl:otherwise>
13287
13389
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
13390
+
13288
13391
  <fo:list-item-label end-indent="label-end()">
13289
13392
  <fo:block role="SKIP">
13290
13393
  <fo:inline role="SKIP">
@@ -15,8 +15,10 @@ module IsoDoc
15
15
  def biblio_anchor_linkend(node, bib)
16
16
  if %w(techreport standard).include?(bib[:type])
17
17
  [node["citeas"], bib[:ord]].compact.join(" ")
18
- else
18
+ elsif bib[:author]
19
19
  "#{bib[:author]} " + node["citeas"]
20
+ else
21
+ node["citeas"]
20
22
  end
21
23
  end
22
24
 
@@ -2,9 +2,6 @@ module IsoDoc
2
2
  module IEEE
3
3
  class WordConvert < IsoDoc::WordConvert
4
4
  def toWord(result, filename, dir, header)
5
- result = from_xhtml(word_cleanup(to_xhtml(result)))
6
- .gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
7
- @wordstylesheet = wordstylesheet_update
8
5
  ::Html2Doc::IEEE.new(
9
6
  filename: filename,
10
7
  imagedir: @localdir,
@@ -75,9 +75,6 @@ module IsoDoc
75
75
  end
76
76
 
77
77
  def toWord(result, filename, dir, header)
78
- result = from_xhtml(word_cleanup(to_xhtml(result)))
79
- .gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
80
- @wordstylesheet = wordstylesheet_update
81
78
  ::Html2Doc::IEEE_WP.new(
82
79
  filename: filename,
83
80
  imagedir: @localdir,
@@ -208,7 +208,9 @@
208
208
  </define>
209
209
  <define name="roledescription">
210
210
  <element name="description">
211
- <ref name="FormattedString"/>
211
+ <oneOrMore>
212
+ <ref name="TextElement"/>
213
+ </oneOrMore>
212
214
  </element>
213
215
  </define>
214
216
  <define name="person">
@@ -333,7 +335,9 @@
333
335
  </define>
334
336
  <define name="affiliationdescription">
335
337
  <element name="description">
336
- <ref name="FormattedString"/>
338
+ <oneOrMore>
339
+ <ref name="TextElement"/>
340
+ </oneOrMore>
337
341
  </element>
338
342
  </define>
339
343
  <define name="organization">
@@ -897,7 +901,9 @@
897
901
  </define>
898
902
  <define name="formattedref">
899
903
  <element name="formattedref">
900
- <ref name="FormattedString"/>
904
+ <oneOrMore>
905
+ <ref name="TextElement"/>
906
+ </oneOrMore>
901
907
  </element>
902
908
  </define>
903
909
  <define name="license">
@@ -942,7 +948,9 @@
942
948
  <optional>
943
949
  <attribute name="type"/>
944
950
  </optional>
945
- <ref name="FormattedString"/>
951
+ <zeroOrMore>
952
+ <ref name="TextElement"/>
953
+ </zeroOrMore>
946
954
  </define>
947
955
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
948
956
  <define name="TypedUri">
@@ -1042,7 +1050,9 @@
1042
1050
  <optional>
1043
1051
  <attribute name="script"/>
1044
1052
  </optional>
1045
- <text/>
1053
+ <oneOrMore>
1054
+ <ref name="TextElement"/>
1055
+ </oneOrMore>
1046
1056
  </element>
1047
1057
  </define>
1048
1058
  <define name="docnumber">
@@ -1267,12 +1277,16 @@
1267
1277
  <optional>
1268
1278
  <attribute name="type"/>
1269
1279
  </optional>
1270
- <ref name="FormattedString"/>
1280
+ <oneOrMore>
1281
+ <ref name="TextElement"/>
1282
+ </oneOrMore>
1271
1283
  </element>
1272
1284
  </define>
1273
1285
  <define name="bibabstract">
1274
1286
  <element name="abstract">
1275
- <ref name="FormattedString"/>
1287
+ <oneOrMore>
1288
+ <ref name="TextElement"/>
1289
+ </oneOrMore>
1276
1290
  </element>
1277
1291
  </define>
1278
1292
  <define name="copyright">
@@ -1377,7 +1391,9 @@
1377
1391
  </attribute>
1378
1392
  <optional>
1379
1393
  <element name="description">
1380
- <ref name="FormattedString"/>
1394
+ <oneOrMore>
1395
+ <ref name="TextElement"/>
1396
+ </oneOrMore>
1381
1397
  </element>
1382
1398
  </optional>
1383
1399
  <element name="bibitem">
@@ -36,7 +36,7 @@ module Metanorma
36
36
 
37
37
  def metadata_id(node, xml)
38
38
  if id = node.attr("docidentifier")
39
- xml.docidentifier id, **attr_code(type: "IEEE")
39
+ xml.docidentifier id, **attr_code(type: "IEEE", primary: "true")
40
40
  else ieee_id(node, xml)
41
41
  end
42
42
  id = node.attr("stdid-pdf") and
@@ -97,7 +97,7 @@ module Metanorma
97
97
 
98
98
  def ieee_id_out(xml, params)
99
99
  id = pubid_select(params).create(**params)
100
- xml.docidentifier id.to_s, type: "IEEE"
100
+ xml.docidentifier id.to_s, type: "IEEE", primary: "true"
101
101
  end
102
102
 
103
103
  def pubid_select(_params)
@@ -156,44 +156,7 @@
156
156
  </define>
157
157
  <define name="xref">
158
158
  <element name="xref">
159
- <attribute name="target">
160
- <data type="string">
161
- <param name="pattern">\i\c*|\c+#\c+</param>
162
- </data>
163
- </attribute>
164
- <optional>
165
- <attribute name="to">
166
- <data type="string">
167
- <param name="pattern">\i\c*|\c+#\c+</param>
168
- </data>
169
- </attribute>
170
- </optional>
171
- <optional>
172
- <attribute name="type">
173
- <ref name="ReferenceFormat"/>
174
- </attribute>
175
- </optional>
176
- <optional>
177
- <attribute name="alt"/>
178
- </optional>
179
- <optional>
180
- <attribute name="case">
181
- <choice>
182
- <value>capital</value>
183
- <value>lowercase</value>
184
- </choice>
185
- </attribute>
186
- </optional>
187
- <optional>
188
- <attribute name="droploc">
189
- <data type="boolean"/>
190
- </attribute>
191
- </optional>
192
- <optional>
193
- <attribute name="style">
194
- <ref name="XrefStyleType"/>
195
- </attribute>
196
- </optional>
159
+ <ref name="XrefAttributes"/>
197
160
  <ref name="XrefBody"/>
198
161
  </element>
199
162
  </define>
@@ -407,23 +370,7 @@
407
370
  </define>
408
371
  <define name="figure">
409
372
  <element name="figure">
410
- <attribute name="id">
411
- <data type="ID"/>
412
- </attribute>
413
- <optional>
414
- <attribute name="unnumbered">
415
- <data type="boolean"/>
416
- </attribute>
417
- </optional>
418
- <optional>
419
- <attribute name="number"/>
420
- </optional>
421
- <optional>
422
- <attribute name="subsequence"/>
423
- </optional>
424
- <optional>
425
- <attribute name="class"/>
426
- </optional>
373
+ <ref name="FigureAttributes"/>
427
374
  <ref name="BlockAttributes"/>
428
375
  <optional>
429
376
  <ref name="tname"/>
@@ -2450,6 +2397,49 @@
2450
2397
  </zeroOrMore>
2451
2398
  </element>
2452
2399
  </define>
2400
+ <define name="XrefAttributes">
2401
+ <attribute name="target">
2402
+ <data type="string">
2403
+ <param name="pattern">\i\c*|\c+#\c+</param>
2404
+ </data>
2405
+ </attribute>
2406
+ <optional>
2407
+ <attribute name="to">
2408
+ <data type="string">
2409
+ <param name="pattern">\i\c*|\c+#\c+</param>
2410
+ </data>
2411
+ </attribute>
2412
+ </optional>
2413
+ <optional>
2414
+ <attribute name="type">
2415
+ <ref name="ReferenceFormat"/>
2416
+ </attribute>
2417
+ </optional>
2418
+ <optional>
2419
+ <attribute name="alt"/>
2420
+ </optional>
2421
+ <optional>
2422
+ <attribute name="case">
2423
+ <choice>
2424
+ <value>capital</value>
2425
+ <value>lowercase</value>
2426
+ </choice>
2427
+ </attribute>
2428
+ </optional>
2429
+ <optional>
2430
+ <attribute name="droploc">
2431
+ <data type="boolean"/>
2432
+ </attribute>
2433
+ </optional>
2434
+ <optional>
2435
+ <attribute name="style">
2436
+ <ref name="XrefStyleType"/>
2437
+ </attribute>
2438
+ </optional>
2439
+ <optional>
2440
+ <attribute name="label"/>
2441
+ </optional>
2442
+ </define>
2453
2443
  <define name="XrefBody">
2454
2444
  <zeroOrMore>
2455
2445
  <ref name="XrefTarget"/>
@@ -2528,6 +2518,28 @@
2528
2518
  <attribute name="columns"/>
2529
2519
  </optional>
2530
2520
  </define>
2521
+ <define name="FigureAttributes">
2522
+ <attribute name="id">
2523
+ <data type="ID"/>
2524
+ </attribute>
2525
+ <optional>
2526
+ <attribute name="unnumbered">
2527
+ <data type="boolean"/>
2528
+ </attribute>
2529
+ </optional>
2530
+ <optional>
2531
+ <attribute name="number"/>
2532
+ </optional>
2533
+ <optional>
2534
+ <attribute name="subsequence"/>
2535
+ </optional>
2536
+ <optional>
2537
+ <attribute name="class"/>
2538
+ </optional>
2539
+ <optional>
2540
+ <attribute name="width"/>
2541
+ </optional>
2542
+ </define>
2531
2543
  <start>
2532
2544
  <ref name="standard-document"/>
2533
2545
  </start>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.2.5".freeze
3
+ VERSION = "1.2.7".freeze
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ template:
19
19
  inproceedings: "{{ creatornames }}, “{{ title }},” <em>{{host_title}}</em>, {{place}}, {{extent}}, {{date}}, {{ labels['viewed'] }}_{{date_accessed}}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %} ."
20
20
  inbook: "{{ creatornames }}, “{{ title }},” {{ labels['in'] }} {{ host_creatornames}} ({{ host_role}}) : <em>{{host_title}}</em>, {{place}}: {{publisher}}, {{date}}, {{extent}}, {{ labels['viewed'] }}_{{date_accessed}}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %} ."
21
21
  incollection: inbook
22
- thesis: "{{ creatornames }} , “{{ title }}.” {{ medium | capitalize }}, {{ publisher }}, {{ date }}, {{ labels['viewed'] }}_{{date_accessed}}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %} ."
22
+ thesis: "{{ creatornames }} , “{{ title }},” {{ medium | capitalize }}, {{ publisher }}, {{ date }}, {{ labels['viewed'] }}_{{date_accessed}}, {% if uri %}{{ uri }}{% else %}{% if doi %}DOI: {{ doi | join: ', ' }}{% endif %}{% endif %} ."
23
23
  unpublished: thesis
24
24
  misc: thesis
25
25
  website: thesis
@@ -27,9 +27,7 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_dependency "metanorma-standoc", "~> 2.8.4"
29
29
  spec.add_dependency "mnconvert", "~> 1.20"
30
- spec.add_dependency "pubid-ieee"
31
- #spec.add_dependency "pubid-iso", "~> 0.5.3"
32
- #spec.add_dependency "relaton-iso", "~> 1.15.4"
30
+ spec.add_dependency "pubid"
33
31
 
34
32
  spec.add_development_dependency "debug"
35
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.7
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-10 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.20'
41
41
  - !ruby/object:Gem::Dependency
42
- name: pubid-ieee
42
+ name: pubid
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="