metanorma-jis 0.2.4 → 0.2.6

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: c8dc64b7e2524636baafacbeb79db166d0de7fe32390f6863c2b424b43d6a236
4
- data.tar.gz: b81a5ab243c3cde8b604a0481f17875d8931c9af92a8bdd8303a8a405e409c62
3
+ metadata.gz: 3e535a59c279bcefe69819d283821225f8c751cec09a3c28d9362186fc6ad6d1
4
+ data.tar.gz: 0265fc5c6ad595bd5c4cab59b539cc2d8f33c8260e6e7f908419897296889554
5
5
  SHA512:
6
- metadata.gz: 320ca25a90e1fe5df1f2ff17c8dee46ad4a8a9ac3b9756e07cf149a5ba16ab842fafcae3f19a12bc550235dfa589950841ba3e742e48bd844e84dfe898446927
7
- data.tar.gz: 470d48f3536cf937d52a57cacf7890fff1d29aeb52f9c21581a38ef8019268fc71e8f51f1fe0913f393a3599eb4c4c8935b7d7b7366c50cadad72d1787c3c2cf
6
+ metadata.gz: 4426ffed2000345bf1150e89c336e22b43311af42d470aede5c894a156b1c6336766318cb07f54340e01d7ac0d230729a053673524b2fa4cde5cb896e9748e59
7
+ data.tar.gz: 6220cd22faaec6fdfedddf86c1b352c0796906e5fda536a7f31e95ea06fcbd337a289dbedd8ac9a22a796bddeea46d7f27ddaa4a0dd750e28ee2656ac8b1bf26
@@ -1583,6 +1583,9 @@
1583
1583
  <xsl:param name="copyrightText"/>
1584
1584
  <fo:static-content flow-name="footer">
1585
1585
  <fo:block-container height="24mm" display-align="after">
1586
+ <xsl:if test="$section = 'commentary'">
1587
+ <xsl:attribute name="height">24.5mm</xsl:attribute>
1588
+ </xsl:if>
1586
1589
  <xsl:if test="$section = 'preface'">
1587
1590
  <fo:block font-size="9pt" text-align="center" space-after="10pt">(<fo:inline font-family="Times New Roman"><fo:page-number/></fo:inline>)</fo:block>
1588
1591
  </xsl:if>
@@ -1627,17 +1630,30 @@
1627
1630
  <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 -->
1628
1631
 
1629
1632
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
1630
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
1633
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
1631
1634
  <!-- Example: <tables>
1632
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
1633
- <tbody>
1634
- <tr>
1635
- <td id="tab-symdu_1_1">
1636
- <p_len>6</p_len>
1637
- <p_len>100</p_len> for 2nd paragraph
1638
- <word_len>6</word_len>
1639
- <word_len>20</word_len>
1640
- ...
1635
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
1636
+ <column width_max="39354" width_min="39354"/>
1637
+ <column width_max="75394" width_min="75394"/>
1638
+ <column width_max="108813" width_min="108813"/>
1639
+ <tbody>
1640
+ <tr>
1641
+ <td width_max="39354" width_min="39354">
1642
+ <p_len>39354</p_len>
1643
+ <word_len>39354</word_len>
1644
+ </td>
1645
+
1646
+ OLD:
1647
+ <tables>
1648
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
1649
+ <tbody>
1650
+ <tr>
1651
+ <td id="tab-symdu_1_1">
1652
+ <p_len>6</p_len>
1653
+ <p_len>100</p_len> for 2nd paragraph
1654
+ <word_len>6</word_len>
1655
+ <word_len>20</word_len>
1656
+ ...
1641
1657
  -->
1642
1658
 
1643
1659
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -1856,6 +1872,10 @@
1856
1872
  <xsl:variable name="zero_width_space">​</xsl:variable>
1857
1873
  <xsl:variable name="hair_space"> </xsl:variable>
1858
1874
  <xsl:variable name="en_dash">–</xsl:variable>
1875
+ <xsl:variable name="em_dash">—</xsl:variable>
1876
+ <xsl:variable name="cr">&#13;</xsl:variable>
1877
+ <xsl:variable name="lf">
1878
+ </xsl:variable>
1859
1879
 
1860
1880
  <xsl:template name="getTitle">
1861
1881
  <xsl:param name="name"/>
@@ -2160,6 +2180,10 @@
2160
2180
 
2161
2181
  </xsl:attribute-set> <!-- example-name-style -->
2162
2182
 
2183
+ <xsl:template name="refine_example-name-style">
2184
+
2185
+ </xsl:template>
2186
+
2163
2187
  <xsl:attribute-set name="example-p-style">
2164
2188
 
2165
2189
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
@@ -2176,6 +2200,10 @@
2176
2200
 
2177
2201
  </xsl:attribute-set> <!-- termexample-name-style -->
2178
2202
 
2203
+ <xsl:template name="refine_termexample-name-style">
2204
+
2205
+ </xsl:template>
2206
+
2179
2207
  <!-- ========================== -->
2180
2208
  <!-- Table styles -->
2181
2209
  <!-- ========================== -->
@@ -2377,6 +2405,10 @@
2377
2405
 
2378
2406
  </xsl:attribute-set> <!-- table-fn-style -->
2379
2407
 
2408
+ <xsl:template name="refine_table-fn-style">
2409
+
2410
+ </xsl:template>
2411
+
2380
2412
  <xsl:attribute-set name="table-fn-number-style">
2381
2413
  <xsl:attribute name="font-size">80%</xsl:attribute>
2382
2414
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -2389,6 +2421,10 @@
2389
2421
 
2390
2422
  </xsl:attribute-set> <!-- table-fn-number-style -->
2391
2423
 
2424
+ <xsl:template name="refine_table-fn-number-style">
2425
+
2426
+ </xsl:template>
2427
+
2392
2428
  <xsl:attribute-set name="fn-container-body-style">
2393
2429
  <xsl:attribute name="text-indent">0</xsl:attribute>
2394
2430
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -2614,6 +2650,10 @@
2614
2650
 
2615
2651
  <xsl:template name="refine_figure-block-style">
2616
2652
 
2653
+ <xsl:if test="ancestor::*[local-name() = 'example'] or ancestor::*[local-name() = 'note']">
2654
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2655
+ </xsl:if>
2656
+
2617
2657
  </xsl:template>
2618
2658
 
2619
2659
  <xsl:attribute-set name="figure-style">
@@ -3492,6 +3532,20 @@
3492
3532
  </xsl:for-each>
3493
3533
  </xsl:template>
3494
3534
 
3535
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
3536
+
3537
+ <xsl:template match="*[local-name()='table']" priority="2">
3538
+ <xsl:choose>
3539
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
3540
+ <xsl:call-template name="table"/>
3541
+ </xsl:when>
3542
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
3543
+ <xsl:otherwise>
3544
+ <xsl:call-template name="table"/>
3545
+ </xsl:otherwise>
3546
+ </xsl:choose>
3547
+ </xsl:template>
3548
+
3495
3549
  <xsl:template match="*[local-name()='table']" name="table">
3496
3550
 
3497
3551
  <xsl:variable name="table-preamble">
@@ -3501,9 +3555,11 @@
3501
3555
  <xsl:variable name="table">
3502
3556
 
3503
3557
  <xsl:variable name="simple-table">
3504
- <xsl:call-template name="getSimpleTable">
3505
- <xsl:with-param name="id" select="@id"/>
3506
- </xsl:call-template>
3558
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
3559
+ <xsl:call-template name="getSimpleTable">
3560
+ <xsl:with-param name="id" select="@id"/>
3561
+ </xsl:call-template>
3562
+ </xsl:if>
3507
3563
  </xsl:variable>
3508
3564
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3509
3565
 
@@ -3599,9 +3655,9 @@
3599
3655
  </xsl:attribute>
3600
3656
  </xsl:for-each>
3601
3657
 
3602
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3658
+ <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']"/>
3603
3659
  <xsl:if test="$isNoteOrFnExist = 'true'">
3604
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3660
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3605
3661
  </xsl:if>
3606
3662
 
3607
3663
  <xsl:choose>
@@ -3733,9 +3789,28 @@
3733
3789
 
3734
3790
  </fo:block>
3735
3791
 
3792
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3793
+ <xsl:if test="$continued = 'true'">
3794
+ <fo:block text-align="right">
3795
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3796
+ </fo:block>
3797
+ </xsl:if>
3798
+ <!-- </xsl:if> -->
3799
+
3736
3800
  </xsl:if>
3737
3801
  </xsl:template> <!-- table/name -->
3738
3802
 
3803
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
3804
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
3805
+ <xsl:choose>
3806
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
3807
+ <!-- remove CR or LF at start -->
3808
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
3809
+ </xsl:when>
3810
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
3811
+ </xsl:choose>
3812
+ </xsl:template>
3813
+
3739
3814
  <!-- SOURCE: ... -->
3740
3815
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3741
3816
  <xsl:call-template name="termsource"/>
@@ -4146,7 +4221,7 @@
4146
4221
  <xsl:param name="colwidths"/>
4147
4222
  <xsl:param name="colgroup"/>
4148
4223
 
4149
- <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']"/>
4224
+ <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']"/>
4150
4225
 
4151
4226
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4152
4227
 
@@ -4216,7 +4291,7 @@
4216
4291
 
4217
4292
  <!-- except gb and bsi -->
4218
4293
 
4219
- <xsl:apply-templates select="../*[local-name()='p' or local-name()='dl' or local-name()='note' or local-name()='example' or local-name()='source']"/>
4294
+ <xsl:apply-templates select="../*[local-name()='p' or local-name()='dl' or (local-name()='note' and not(@type = 'units')) or local-name()='example' or local-name()='source']"/>
4220
4295
 
4221
4296
  <xsl:variable name="isDisplayRowSeparator">
4222
4297
 
@@ -4224,7 +4299,7 @@
4224
4299
 
4225
4300
  <!-- horizontal row separator -->
4226
4301
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4227
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4302
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4228
4303
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4229
4304
 
4230
4305
  <xsl:call-template name="setBordersTableArray"/>
@@ -4904,7 +4979,20 @@
4904
4979
  <!-- Definition List -->
4905
4980
  <!-- ===================== -->
4906
4981
 
4907
- <xsl:template match="*[local-name()='dl']">
4982
+ <!-- for table auto-layout algorithm -->
4983
+ <xsl:template match="*[local-name()='dl']" priority="2">
4984
+ <xsl:choose>
4985
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4986
+ <xsl:call-template name="dl"/>
4987
+ </xsl:when>
4988
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4989
+ <xsl:otherwise>
4990
+ <xsl:call-template name="dl"/>
4991
+ </xsl:otherwise>
4992
+ </xsl:choose>
4993
+ </xsl:template>
4994
+
4995
+ <xsl:template match="*[local-name()='dl']" name="dl">
4908
4996
  <xsl:variable name="isAdded" select="@added"/>
4909
4997
  <xsl:variable name="isDeleted" select="@deleted"/>
4910
4998
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -5860,11 +5948,16 @@
5860
5948
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5861
5949
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5862
5950
  <xsl:variable name="text" select="."/>
5863
- <fo:inline font-size="75%" role="SKIP">
5951
+ <xsl:variable name="ratio_">
5952
+ 0.75
5953
+ </xsl:variable>
5954
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5955
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
5864
5956
  <xsl:if test="string-length($text) &gt; 0">
5865
5957
  <xsl:variable name="smallCapsText">
5866
5958
  <xsl:call-template name="recursiveSmallCaps">
5867
5959
  <xsl:with-param name="text" select="$text"/>
5960
+ <xsl:with-param name="ratio" select="$ratio"/>
5868
5961
  </xsl:call-template>
5869
5962
  </xsl:variable>
5870
5963
  <!-- merge neighboring fo:inline -->
@@ -5901,12 +5994,13 @@
5901
5994
 
5902
5995
  <xsl:template name="recursiveSmallCaps">
5903
5996
  <xsl:param name="text"/>
5997
+ <xsl:param name="ratio"/>
5904
5998
  <xsl:variable name="char" select="substring($text,1,1)"/>
5905
5999
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5906
6000
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5907
6001
  <xsl:choose>
5908
6002
  <xsl:when test="$char=$upperCase">
5909
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
6003
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5910
6004
  <xsl:value-of select="$upperCase"/>
5911
6005
  </fo:inline>
5912
6006
  </xsl:when>
@@ -5917,6 +6011,7 @@
5917
6011
  <xsl:if test="string-length($text) &gt; 1">
5918
6012
  <xsl:call-template name="recursiveSmallCaps">
5919
6013
  <xsl:with-param name="text" select="substring($text,2)"/>
6014
+ <xsl:with-param name="ratio" select="$ratio"/>
5920
6015
  </xsl:call-template>
5921
6016
  </xsl:if>
5922
6017
  </xsl:template>
@@ -5953,6 +6048,9 @@
5953
6048
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5954
6049
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5955
6050
  </xsl:if>
6051
+ <xsl:if test="$key = 'text-indent'">
6052
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
6053
+ </xsl:if>
5956
6054
  </xsl:for-each>
5957
6055
  </xsl:variable>
5958
6056
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6829,7 +6927,13 @@
6829
6927
  <xsl:value-of select="$language_current_2"/>
6830
6928
  </xsl:when>
6831
6929
  <xsl:otherwise>
6832
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6930
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
6931
+ <xsl:choose>
6932
+ <xsl:when test="$language_current_3 != ''">
6933
+ <xsl:value-of select="$language_current_3"/>
6934
+ </xsl:when>
6935
+ <xsl:otherwise>en</xsl:otherwise>
6936
+ </xsl:choose>
6833
6937
  </xsl:otherwise>
6834
6938
  </xsl:choose>
6835
6939
  </xsl:otherwise>
@@ -7359,6 +7463,11 @@
7359
7463
  </xsl:call-template>
7360
7464
  </xsl:template>
7361
7465
 
7466
+ <!-- command between two xref points to non-standard bibitem -->
7467
+ <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']]]">
7468
+ <xsl:value-of select="."/>
7469
+ </xsl:template>
7470
+
7362
7471
  <!-- ====== -->
7363
7472
  <!-- formula -->
7364
7473
  <!-- ====== -->
@@ -7720,7 +7829,7 @@
7720
7829
  </xsl:when>
7721
7830
  <xsl:otherwise>
7722
7831
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7723
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7832
+ <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'])">
7724
7833
 
7725
7834
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7726
7835
  <xsl:attribute name="width">
@@ -8055,6 +8164,8 @@
8055
8164
  </xsl:attribute>
8056
8165
  </xsl:template>
8057
8166
 
8167
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
8168
+
8058
8169
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
8059
8170
  <xsl:copy>
8060
8171
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -8073,7 +8184,8 @@
8073
8184
 
8074
8185
  <xsl:attribute name="width">
8075
8186
  <xsl:choose>
8076
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8187
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8188
+ <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>
8077
8189
  <xsl:when test="$width != ''">
8078
8190
  <xsl:value-of select="round($width)"/>
8079
8191
  </xsl:when>
@@ -8082,7 +8194,8 @@
8082
8194
  </xsl:attribute>
8083
8195
  <xsl:attribute name="height">
8084
8196
  <xsl:choose>
8085
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8197
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
8198
+ <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>
8086
8199
  <xsl:when test="$height != ''">
8087
8200
  <xsl:value-of select="round($height)"/>
8088
8201
  </xsl:when>
@@ -8099,7 +8212,7 @@
8099
8212
  <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
8100
8213
  <xsl:attribute name="width">
8101
8214
  <xsl:choose>
8102
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
8215
+ <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>
8103
8216
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8104
8217
  </xsl:choose>
8105
8218
  </xsl:attribute>
@@ -8110,7 +8223,7 @@
8110
8223
  <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
8111
8224
  <xsl:attribute name="height">
8112
8225
  <xsl:choose>
8113
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
8226
+ <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>
8114
8227
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
8115
8228
  </xsl:choose>
8116
8229
  </xsl:attribute>
@@ -9571,6 +9684,7 @@
9571
9684
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
9572
9685
  <xsl:if test="normalize-space() != ''">
9573
9686
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
9687
+ <xsl:call-template name="refine_termexample-name-style"/>
9574
9688
  <xsl:apply-templates/>
9575
9689
  </fo:inline>
9576
9690
  </xsl:if>
@@ -9721,6 +9835,7 @@
9721
9835
  </xsl:when>
9722
9836
  <xsl:otherwise>
9723
9837
  <fo:inline xsl:use-attribute-sets="example-name-style">
9838
+ <xsl:call-template name="refine_example-name-style"/>
9724
9839
  <xsl:apply-templates/>
9725
9840
  </fo:inline>
9726
9841
  </xsl:otherwise>
@@ -10981,6 +11096,7 @@
10981
11096
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10982
11097
  <xsl:otherwise>
10983
11098
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
11099
+
10984
11100
  <fo:list-item-label end-indent="label-end()">
10985
11101
  <fo:block role="SKIP">
10986
11102
  <fo:inline role="SKIP">
@@ -3,14 +3,6 @@ require_relative "../../html2doc/lists"
3
3
  module IsoDoc
4
4
  module JIS
5
5
  class WordConvert < IsoDoc::Iso::WordConvert
6
- def postprocess(result, filename, dir)
7
- filename = filename.sub(/\.doc$/, "")
8
- header = generate_header(filename, dir)
9
- result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
10
- toWord(result, filename, dir, header)
11
- @files_to_delete.each { |f| FileUtils.rm_f f }
12
- end
13
-
14
6
  def word_cleanup(docxml)
15
7
  word_note_cleanup(docxml)
16
8
  boldface(docxml)
@@ -53,9 +45,12 @@ module IsoDoc
53
45
  end
54
46
  end
55
47
 
48
+ def postprocess_cleanup(result)
49
+ result = cleanup(to_xhtml(textcleanup(result)))
50
+ word_split(word_cleanup(result))
51
+ end
52
+
56
53
  def toWord(result, filename, dir, header)
57
- result = word_split(word_cleanup(to_xhtml(result)))
58
- @wordstylesheet = wordstylesheet_update
59
54
  result.each do |k, v|
60
55
  to_word1(v, "#{filename}#{k}", dir, header)
61
56
  end
@@ -89,11 +84,13 @@ module IsoDoc
89
84
  end
90
85
 
91
86
  def main_split(xml)
92
- c = xml.at("//div[@class = 'WordSection1']")
93
- c.next_element&.remove
94
- c.remove
95
- c = xml.at("//div[@class = 'WordSection2']")
96
- c.elements.first.at("./br") and c.elements.first.remove
87
+ if c = xml.at("//div[@class = 'WordSection1']")
88
+ c.next_element&.remove
89
+ c.remove
90
+ end
91
+ if c = xml.at("//div[@class = 'WordSection2']")
92
+ c.elements.first.at("./br") and c.elements.first.remove
93
+ end
97
94
  xml
98
95
  end
99
96
 
@@ -25,6 +25,20 @@ module IsoDoc
25
25
  l10n("#{title} #{num}<br/>#{obl}")
26
26
  end
27
27
 
28
+ def annex_name_anchors1(clause, num, level)
29
+ @anchors[clause["id"]] =
30
+ { xref: num, label: num, level: level,
31
+ subtype: "annex" }
32
+ end
33
+
34
+ def annex_names1(clause, num, level)
35
+ annex_name_anchors1(clause, num, level)
36
+ i = ::IsoDoc::XrefGen::Counter.new(0, prefix: "#{num}.")
37
+ clause.xpath(ns(SUBCLAUSES)).each do |c|
38
+ annex_names1(c, i.increment(c).print, level + 1)
39
+ end
40
+ end
41
+
28
42
  def clause_order_main(docxml)
29
43
  [
30
44
  { path: "//sections/introduction" },
@@ -97,14 +111,16 @@ module IsoDoc
97
111
  refer_list)
98
112
  c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0)
99
113
  list.xpath(ns("./li")).each do |li|
100
- bare_label, label = list_item_value(li, c, depth,
101
- { list_anchor: list_anchor, prev_label: prev_label, refer_list: refer_list })
114
+ bare_label, label =
115
+ list_item_value(li, c, depth, { list_anchor: list_anchor,
116
+ prev_label: prev_label, refer_list: depth == 1 ? refer_list : nil })
102
117
  li["id"] and @anchors[li["id"]] =
103
118
  { label: bare_label, bare_xref: "#{bare_label})",
104
- xref: "#{label})", type: "listitem", refer_list:
105
- refer_list, container: list_anchor[:container] }
119
+ xref: "#{label})", type: "listitem",
120
+ refer_list: refer_list, container: list_anchor[:container] }
106
121
  (li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
107
- list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
122
+ list_item_anchor_names(ol, list_anchor, depth + 1, label,
123
+ refer_list)
108
124
  end
109
125
  end
110
126
  end
@@ -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">
@@ -77,6 +77,11 @@ module Metanorma
77
77
  a.children.first.previous = "<name>#{@i18n.chairperson}</name>"
78
78
  end
79
79
  end
80
+
81
+ def ol_cleanup(doc)
82
+ ::Metanorma::Standoc::Converter.instance_method(:ol_cleanup).bind(self)
83
+ .call(doc)
84
+ end
80
85
  end
81
86
  end
82
87
  end
@@ -138,7 +138,8 @@ module Metanorma
138
138
 
139
139
  def metadata_id(node, xml)
140
140
  if id = node.attr("docidentifier")
141
- xml.docidentifier id.sub(/^JIS /, ""), **attr_code(type: "JIS")
141
+ xml.docidentifier id.sub(/^JIS /, ""),
142
+ **attr_code(type: "JIS", primary: "true")
142
143
  else iso_id(node, xml)
143
144
  end
144
145
  end
@@ -177,7 +178,7 @@ module Metanorma
177
178
 
178
179
  def iso_id_out(xml, params, _with_prf)
179
180
  id = iso_id_default(params).to_s(with_publisher: false)
180
- xml.docidentifier id.strip, type: "JIS"
181
+ xml.docidentifier id.strip, type: "JIS", primary: "true"
181
182
  end
182
183
 
183
184
  def iso_id_default(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,6 +1,6 @@
1
1
  module Metanorma
2
2
  module JIS
3
- VERSION = "0.2.4".freeze
3
+ VERSION = "0.2.6".freeze
4
4
  end
5
5
  end
6
6
 
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_dependency "japanese_calendar", "~> 0"
34
34
  spec.add_dependency "metanorma-iso", "~> 2.7.3"
35
- spec.add_dependency "pubid-jis"
35
+ spec.add_dependency "pubid"
36
36
 
37
37
  spec.add_development_dependency "debug"
38
38
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
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: japanese_calendar
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.7.3
41
41
  - !ruby/object:Gem::Dependency
42
- name: pubid-jis
42
+ name: pubid
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="