metanorma-cc 2.1.13 → 2.2.1

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: 5000afa2946588d1bfb3cb0e985af9beef653134e773704f72b27944d98e0b83
4
- data.tar.gz: 22cd057e8aa8c8ac6e50a11af2c8d959648461be50c5126cd96bf4d786b86086
3
+ metadata.gz: 7711b9675bcfab88ba0624be6f88f5ac5262e06b1f31b18a676ab370f9f83736
4
+ data.tar.gz: 1af7111b2d6341c4264d8a8e639b538036ea98bd8d1ee909740101adad8c8d4f
5
5
  SHA512:
6
- metadata.gz: e7c899b03f57744cb7cad336a38b28fd7c6f6f31e19191900c0647b91d76186c6baef984c917087d7a84141f7a3b559bad73d7fcb509a043379a3f9f5fff4e38
7
- data.tar.gz: 05bf8c83d0b32183c5844ed482c2439a410af5a33f621f70c5514ebc5ad711a50ce01fabb87931bb5d629548ede68308162520cbe85cd99fd5b71cd352d38979
6
+ metadata.gz: dcb84e476aa6a99ab5575246b9ac9a3770476c737dadc098db6450a3f97df8168a0f9a28b70283a274d2534d6b84e77b6d7d2ed3d38c81401c558ca3cc93daef
7
+ data.tar.gz: bae80bf550876a114d6c48e170e115dbd6f340dc60c7a0227c0e81115bae9542808bf17966d8d630e69afd9457821061626d9c1489afd027e457ee4c23cf0f44
data/.gitignore CHANGED
@@ -3,6 +3,5 @@
3
3
  .rubocop-https--*
4
4
 
5
5
  /.rspec_status
6
- /Gemfile.devel
7
6
  /Gemfile.lock
8
7
  /coverage/
@@ -1347,6 +1347,12 @@
1347
1347
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1348
1348
  </xsl:attribute-set>
1349
1349
 
1350
+ <xsl:attribute-set name="figure-block-style">
1351
+
1352
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1353
+
1354
+ </xsl:attribute-set>
1355
+
1350
1356
  <xsl:attribute-set name="figure-style">
1351
1357
 
1352
1358
  </xsl:attribute-set>
@@ -1356,7 +1362,7 @@
1356
1362
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1357
1363
  <xsl:attribute name="text-align">center</xsl:attribute>
1358
1364
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1359
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1365
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
1360
1366
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1361
1367
 
1362
1368
  </xsl:attribute-set>
@@ -2739,6 +2745,10 @@
2739
2745
  <xsl:with-param name="continued">true</xsl:with-param>
2740
2746
  </xsl:apply-templates>
2741
2747
 
2748
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
2749
+ <fo:block/>
2750
+ </xsl:if>
2751
+
2742
2752
  </fo:table-cell>
2743
2753
  </fo:table-row>
2744
2754
  </xsl:template> <!-- table-header-title -->
@@ -3123,7 +3133,26 @@
3123
3133
 
3124
3134
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3125
3135
  <xsl:variable name="footnote_inline">
3126
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3136
+ <fo:inline>
3137
+
3138
+ <xsl:variable name="fn_styles">
3139
+ <xsl:choose>
3140
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3141
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3142
+ </xsl:when>
3143
+ <xsl:otherwise>
3144
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3145
+ </xsl:otherwise>
3146
+ </xsl:choose>
3147
+ </xsl:variable>
3148
+
3149
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3150
+ <xsl:copy-of select="."/>
3151
+ </xsl:for-each>
3152
+
3153
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3154
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3155
+ </xsl:if>
3127
3156
 
3128
3157
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3129
3158
  <xsl:value-of select="$current_fn_number_text"/>
@@ -3183,7 +3212,10 @@
3183
3212
  </xsl:for-each>
3184
3213
  <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='boilerplate']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
3185
3214
  <xsl:sort select="@displayorder" data-type="number"/>
3186
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3215
+ <!-- commented:
3216
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3217
+ because 'fn' there is in biblio-tag -->
3218
+ <xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
3187
3219
  <!-- copy unique fn -->
3188
3220
  <fn gen_id="{generate-id(.)}">
3189
3221
  <xsl:copy-of select="@*"/>
@@ -4035,7 +4067,7 @@
4035
4067
  10
4036
4068
 
4037
4069
 
4038
- <!-- 10 -->
4070
+ <!-- inherit -->
4039
4071
 
4040
4072
  </xsl:variable>
4041
4073
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4276,6 +4308,23 @@
4276
4308
  <xsl:apply-templates/>
4277
4309
  </xsl:template>
4278
4310
 
4311
+ <!-- Don't break standard's numbers -->
4312
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4313
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4314
+ <xsl:choose>
4315
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4316
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4317
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4318
+ </xsl:when>
4319
+ <xsl:otherwise>
4320
+ <xsl:apply-templates/>
4321
+ </xsl:otherwise>
4322
+ </xsl:choose>
4323
+ </xsl:template>
4324
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
4325
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4326
+ </xsl:template>
4327
+
4279
4328
  <!-- ========================= -->
4280
4329
  <!-- END Rich text formatting -->
4281
4330
  <!-- ========================= -->
@@ -4671,7 +4720,7 @@
4671
4720
  <xsl:choose>
4672
4721
  <xsl:when test="@colspan">
4673
4722
  <xsl:variable name="td">
4674
- <xsl:element name="td">
4723
+ <xsl:element name="{local-name()}">
4675
4724
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4676
4725
  <xsl:if test="local-name()='th'">
4677
4726
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4686,7 +4735,7 @@
4686
4735
  </xsl:call-template>
4687
4736
  </xsl:when>
4688
4737
  <xsl:otherwise>
4689
- <xsl:element name="td">
4738
+ <xsl:element name="{local-name()}">
4690
4739
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4691
4740
  <xsl:if test="local-name()='th'">
4692
4741
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4753,7 +4802,7 @@
4753
4802
  <xsl:variable name="currentRow" select="."/>
4754
4803
 
4755
4804
  <xsl:variable name="normalizedTDs">
4756
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
4805
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
4757
4806
  <xsl:choose>
4758
4807
  <xsl:when test="@rowspan &gt; 1">
4759
4808
  <xsl:copy>
@@ -4765,7 +4814,7 @@
4765
4814
  </xsl:copy>
4766
4815
  </xsl:when>
4767
4816
  <xsl:otherwise>
4768
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
4817
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
4769
4818
  </xsl:otherwise>
4770
4819
  </xsl:choose>
4771
4820
  </xsl:for-each>
@@ -4986,6 +5035,33 @@
4986
5035
  </xsl:choose>
4987
5036
  </xsl:template>
4988
5037
 
5038
+ <xsl:template name="getLang_fromCurrentNode">
5039
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5040
+ <xsl:variable name="language">
5041
+ <xsl:choose>
5042
+ <xsl:when test="$language_current != ''">
5043
+ <xsl:value-of select="$language_current"/>
5044
+ </xsl:when>
5045
+ <xsl:otherwise>
5046
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5047
+ <xsl:choose>
5048
+ <xsl:when test="$language_current_2 != ''">
5049
+ <xsl:value-of select="$language_current_2"/>
5050
+ </xsl:when>
5051
+ <xsl:otherwise>
5052
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5053
+ </xsl:otherwise>
5054
+ </xsl:choose>
5055
+ </xsl:otherwise>
5056
+ </xsl:choose>
5057
+ </xsl:variable>
5058
+
5059
+ <xsl:choose>
5060
+ <xsl:when test="$language = 'English'">en</xsl:when>
5061
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5062
+ </xsl:choose>
5063
+ </xsl:template>
5064
+
4989
5065
  <xsl:template name="capitalizeWords">
4990
5066
  <xsl:param name="str"/>
4991
5067
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5435,12 +5511,6 @@
5435
5511
 
5436
5512
  <fo:block-container margin-left="0mm">
5437
5513
 
5438
- <!-- <xsl:if test="$namespace = 'iho'">
5439
- <xsl:if test="ancestor::iho:td">
5440
- <xsl:attribute name="font-size">12pt</xsl:attribute>
5441
- </xsl:if>
5442
- </xsl:if> -->
5443
-
5444
5514
  <fo:block>
5445
5515
 
5446
5516
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -5606,7 +5676,7 @@
5606
5676
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5607
5677
  <xsl:variable name="isAdded" select="@added"/>
5608
5678
  <xsl:variable name="isDeleted" select="@deleted"/>
5609
- <fo:block-container id="{@id}">
5679
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5610
5680
 
5611
5681
  <xsl:call-template name="setTrackChangesStyles">
5612
5682
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -5942,6 +6012,31 @@
5942
6012
  <xsl:apply-templates mode="svg_update"/>
5943
6013
  </xsl:copy>
5944
6014
  </xsl:template>
6015
+
6016
+ <!-- regex for 'display: inline-block;' -->
6017
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
6018
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
6019
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
6020
+ </xsl:template>
6021
+
6022
+ <!-- replace
6023
+ stroke="rgba(r, g, b, alpha)" to
6024
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
6025
+ fill="rgba(r, g, b, alpha)" to
6026
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6027
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6028
+ <xsl:variable name="components_">
6029
+ <xsl:call-template name="split">
6030
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6031
+ <xsl:with-param name="sep" select="','"/>
6032
+ </xsl:call-template>
6033
+ </xsl:variable>
6034
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6035
+ <xsl:variable name="att_name" select="local-name()"/>
6036
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6037
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6038
+ </xsl:template>
6039
+
5945
6040
  <!-- ============== -->
5946
6041
  <!-- END: svg_update -->
5947
6042
  <!-- ============== -->
@@ -6567,7 +6662,13 @@
6567
6662
  </xsl:template>
6568
6663
 
6569
6664
  <xsl:template match="text()" mode="contents_item">
6570
- <xsl:call-template name="keep_together_standard_number"/>
6665
+ <xsl:variable name="text">
6666
+ <!-- to split by '_' and other chars -->
6667
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6668
+ </xsl:variable>
6669
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6670
+ <xsl:call-template name="keep_together_standard_number"/>
6671
+ </xsl:for-each>
6571
6672
  </xsl:template>
6572
6673
 
6573
6674
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6578,37 +6679,55 @@
6578
6679
  <!-- =============== -->
6579
6680
  <!-- sourcecode -->
6580
6681
  <!-- =============== -->
6581
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6582
6682
 
6583
- <xsl:variable name="sourcecode_attributes">
6584
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6585
- <xsl:variable name="_font-size">
6683
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6684
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6685
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6586
6686
 
6587
- 10
6687
+ <xsl:template match="*[local-name() = 'property']" mode="css">
6688
+ <xsl:attribute name="{@name}">
6689
+ <xsl:value-of select="@value"/>
6690
+ </xsl:attribute>
6691
+ </xsl:template>
6588
6692
 
6693
+ <xsl:template name="get_sourcecode_attributes">
6694
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6695
+ <xsl:variable name="_font-size">
6589
6696
 
6590
- <!-- 9 -->
6697
+ 10
6591
6698
 
6592
- <!-- <xsl:if test="$namespace = 'ieee'">
6593
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6594
- </xsl:if> -->
6595
6699
 
6596
- </xsl:variable>
6700
+ <!-- inherit -->
6597
6701
 
6598
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6599
- <xsl:if test="$font-size != ''">
6600
- <xsl:attribute name="font-size">
6601
- <xsl:choose>
6602
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6603
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6604
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6605
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6606
- </xsl:choose>
6607
- </xsl:attribute>
6608
- </xsl:if>
6609
- </xsl:element>
6702
+ <!-- <xsl:if test="$namespace = 'ieee'">
6703
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6704
+ </xsl:if> -->
6705
+
6706
+ </xsl:variable>
6707
+
6708
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6709
+ <xsl:if test="$font-size != ''">
6710
+ <xsl:attribute name="font-size">
6711
+ <xsl:choose>
6712
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6713
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6714
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6715
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6716
+ </xsl:choose>
6717
+ </xsl:attribute>
6718
+ </xsl:if>
6719
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
6720
+ </xsl:element>
6721
+ </xsl:template>
6722
+
6723
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6724
+
6725
+ <xsl:variable name="sourcecode_attributes">
6726
+ <xsl:call-template name="get_sourcecode_attributes"/>
6610
6727
  </xsl:variable>
6611
6728
 
6729
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
6730
+
6612
6731
  <xsl:choose>
6613
6732
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6614
6733
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6662,9 +6781,10 @@
6662
6781
  </xsl:choose>
6663
6782
  </xsl:template>
6664
6783
 
6665
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
6784
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6666
6785
  <xsl:choose>
6667
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6786
+ <!-- disabled -->
6787
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6668
6788
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6669
6789
  <xsl:choose>
6670
6790
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6679,8 +6799,75 @@
6679
6799
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6680
6800
  </xsl:otherwise>
6681
6801
  </xsl:choose>
6802
+ </xsl:template>
6803
+
6804
+ <!-- add sourcecode highlighting -->
6805
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
6806
+ <xsl:variable name="class" select="@class"/>
6807
+ <xsl:choose>
6808
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
6809
+ <fo:inline>
6810
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
6811
+ <xsl:apply-templates/>
6812
+ </fo:inline>
6813
+ </xsl:when>
6814
+ <xsl:otherwise>
6815
+ <xsl:apply-templates/>
6816
+ </xsl:otherwise>
6817
+ </xsl:choose>
6818
+ </xsl:template>
6819
+
6820
+ <!-- outer table with line numbers for sourcecode -->
6821
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
6822
+ <fo:block>
6823
+ <fo:table width="100%" table-layout="fixed">
6824
+ <xsl:copy-of select="@id"/>
6825
+ <fo:table-column column-width="8%"/>
6826
+ <fo:table-column column-width="92%"/>
6827
+ <fo:table-body>
6828
+ <xsl:apply-templates/>
6829
+ </fo:table-body>
6830
+ </fo:table>
6831
+ </fo:block>
6832
+ </xsl:template>
6833
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
6834
+ <xsl:apply-templates/>
6835
+ </xsl:template>
6836
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
6837
+ <fo:table-row>
6838
+ <xsl:apply-templates/>
6839
+ </fo:table-row>
6840
+ </xsl:template>
6841
+ <!-- first td with line numbers -->
6842
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
6843
+ <fo:table-cell>
6844
+ <fo:block>
6845
+
6846
+ <!-- set attibutes for line numbers - same as sourcecode -->
6847
+ <xsl:variable name="sourcecode_attributes">
6848
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
6849
+ <xsl:call-template name="get_sourcecode_attributes"/>
6850
+ </xsl:for-each>
6851
+ </xsl:variable>
6852
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
6853
+ <xsl:attribute name="{local-name()}">
6854
+ <xsl:value-of select="."/>
6855
+ </xsl:attribute>
6856
+ </xsl:for-each>
6682
6857
 
6858
+ <xsl:apply-templates/>
6859
+ </fo:block>
6860
+ </fo:table-cell>
6861
+ </xsl:template>
6862
+ <!-- second td with sourcecode -->
6863
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
6864
+ <fo:table-cell>
6865
+ <fo:block>
6866
+ <xsl:apply-templates/>
6867
+ </fo:block>
6868
+ </fo:table-cell>
6683
6869
  </xsl:template>
6870
+ <!-- END outer table with line numbers for sourcecode -->
6684
6871
 
6685
6872
  <xsl:template name="add_spaces_to_sourcecode">
6686
6873
  <xsl:variable name="text_step1">
@@ -8365,17 +8552,17 @@
8365
8552
  <fo:block>
8366
8553
  <fo:inline>
8367
8554
 
8368
- <xsl:value-of select="*[local-name()='docidentifier'][@type = 'metanorma-ordinal']"/>
8369
- <xsl:if test="not(*[local-name()='docidentifier'][@type = 'metanorma-ordinal'])">
8370
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
8371
- </xsl:if>
8372
-
8555
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8556
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
8557
+ </xsl:apply-templates>
8373
8558
  </fo:inline>
8374
8559
  </fo:block>
8375
8560
  </fo:list-item-label>
8376
8561
  <fo:list-item-body start-indent="body-start()">
8377
8562
  <fo:block xsl:use-attribute-sets="bibitem-non-normative-list-body-style">
8378
- <xsl:call-template name="processBibitem"/>
8563
+ <xsl:call-template name="processBibitem">
8564
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
8565
+ </xsl:call-template>
8379
8566
  </fo:block>
8380
8567
  </fo:list-item-body>
8381
8568
  </fo:list-item>
@@ -8384,183 +8571,51 @@
8384
8571
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8385
8572
 
8386
8573
  <xsl:template name="processBibitem">
8574
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8387
8575
 
8388
8576
  <!-- start bibitem processing -->
8389
8577
  <xsl:if test=".//*[local-name() = 'fn']">
8390
8578
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8391
8579
  </xsl:if>
8392
8580
 
8393
- <!-- display document identifier, not number [1] -->
8394
- <xsl:variable name="docidentifier">
8395
- <xsl:choose>
8396
- <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
8397
- <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8398
- </xsl:choose>
8399
- </xsl:variable>
8400
- <xsl:value-of select="$docidentifier"/>
8401
-
8402
- <xsl:apply-templates select="*[local-name() = 'note']"/>
8403
-
8404
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
8405
- <xsl:text>,</xsl:text>
8406
- <xsl:text> </xsl:text>
8407
- </xsl:if>
8408
-
8581
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8582
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8583
+ </xsl:apply-templates>
8409
8584
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8410
8585
  <!-- end bibitem processing -->
8411
8586
 
8412
8587
  </xsl:template> <!-- processBibitem (bibitem) -->
8413
8588
 
8414
- <xsl:template name="processBibitemDocId">
8415
- <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'metanorma-ordinal' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
8416
- <xsl:choose>
8417
- <xsl:when test="normalize-space($_doc_ident) != ''">
8418
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
8419
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8420
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8421
- </xsl:if> -->
8422
- <xsl:value-of select="$_doc_ident"/>
8423
- </xsl:when>
8424
- <xsl:otherwise>
8425
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8426
- <xsl:if test="$type != ''">
8427
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8428
- </xsl:if> -->
8429
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8430
- </xsl:otherwise>
8431
- </xsl:choose>
8432
- </xsl:template> <!-- processBibitemDocId -->
8589
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8590
+ <fo:inline><xsl:apply-templates/></fo:inline>
8591
+ </xsl:template>
8592
+
8593
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8433
8594
 
8434
- <xsl:template name="processPersonalAuthor">
8595
+ <xsl:template match="*[local-name() = 'formattedref']">
8596
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8597
+ <xsl:text>, </xsl:text>
8598
+ </xsl:if> -->
8599
+ <xsl:apply-templates/>
8600
+ </xsl:template>
8601
+
8602
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8603
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8435
8604
  <xsl:choose>
8436
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8437
- <author>
8438
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8439
- </author>
8440
- </xsl:when>
8441
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8442
- <author>
8443
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8444
- <xsl:text> </xsl:text>
8445
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8446
- </author>
8605
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8606
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8447
8607
  </xsl:when>
8448
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8449
- <author>
8450
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8451
- <xsl:text> </xsl:text>
8452
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8453
- </author>
8608
+ <xsl:when test="$biblio_tag_part = 'last'">
8609
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8454
8610
  </xsl:when>
8455
8611
  <xsl:otherwise>
8456
8612
  <xsl:apply-templates/>
8457
8613
  </xsl:otherwise>
8458
8614
  </xsl:choose>
8459
- </xsl:template> <!-- processPersonalAuthor -->
8460
-
8461
- <xsl:template name="renderDate">
8462
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8463
- <xsl:value-of select="*[local-name() = 'on']"/>
8464
- </xsl:if>
8465
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8466
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8467
- </xsl:if>
8468
- </xsl:template>
8469
-
8470
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8471
- <xsl:value-of select="translate(.,'. ','')"/>
8472
- </xsl:template>
8473
-
8474
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8475
- <xsl:value-of select="substring(.,1,1)"/>
8476
- </xsl:template>
8477
-
8478
- <xsl:template match="*[local-name() = 'title']" mode="title">
8479
- <fo:inline><xsl:apply-templates/></fo:inline>
8480
8615
  </xsl:template>
8481
8616
 
8482
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8483
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8484
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8485
- <xsl:apply-templates/>
8486
- </fo:inline>
8487
- </xsl:template>
8488
-
8489
- <!-- bibitem/note renders as footnote -->
8490
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8491
-
8492
- <!-- list of footnotes to calculate actual footnotes number -->
8493
- <xsl:variable name="p_fn_">
8494
- <xsl:call-template name="get_fn_list"/>
8495
- </xsl:variable>
8496
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8497
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8498
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8499
- <!-- fn sequence number in document -->
8500
- <xsl:variable name="current_fn_number">
8501
- <xsl:choose>
8502
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8503
- <xsl:otherwise>
8504
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8505
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8506
- </xsl:otherwise>
8507
- </xsl:choose>
8508
- </xsl:variable>
8509
- <fo:footnote>
8510
- <xsl:variable name="number">
8511
-
8512
- <xsl:choose>
8513
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
8514
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
8515
- </xsl:when>
8516
- <xsl:otherwise>
8517
- <xsl:value-of select="$current_fn_number"/>
8518
- </xsl:otherwise>
8519
- </xsl:choose>
8520
-
8521
- </xsl:variable>
8522
-
8523
- <xsl:variable name="current_fn_number_text">
8524
- <xsl:value-of select="$number"/>
8525
-
8526
- </xsl:variable>
8527
-
8528
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8529
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8530
- <xsl:value-of select="$current_fn_number_text"/>
8531
- </fo:basic-link>
8532
- </fo:inline>
8533
- <fo:footnote-body>
8534
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8535
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8536
- <xsl:value-of select="$current_fn_number_text"/>
8537
- </fo:inline>
8538
- <xsl:apply-templates/>
8539
- </fo:block>
8540
- </fo:footnote-body>
8541
- </fo:footnote>
8542
- </xsl:template>
8543
-
8544
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8545
- <xsl:text> edition </xsl:text>
8546
- <xsl:value-of select="."/>
8547
- </xsl:template>
8548
-
8549
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8550
- <xsl:text> (</xsl:text>
8551
- <fo:inline xsl:use-attribute-sets="link-style">
8552
- <fo:basic-link external-destination="." fox:alt-text=".">
8553
- <xsl:value-of select="."/>
8554
- </fo:basic-link>
8555
- </fo:inline>
8556
- <xsl:text>)</xsl:text>
8557
- </xsl:template>
8558
-
8559
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8560
-
8561
- <xsl:template match="*[local-name() = 'formattedref']">
8562
-
8563
- <xsl:apply-templates/>
8617
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8618
+ <xsl:text> </xsl:text>
8564
8619
  </xsl:template>
8565
8620
 
8566
8621
  <!-- ======================= -->
@@ -8898,7 +8953,9 @@
8898
8953
  <!-- Update xml -->
8899
8954
  <!-- ===================================== -->
8900
8955
  <!-- =========================================================================== -->
8901
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
8956
+ <!-- STEP1: -->
8957
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
8958
+ <!-- - Ignore 'span' without style -->
8902
8959
  <!-- =========================================================================== -->
8903
8960
  <xsl:template match="@*|node()" mode="update_xml_step1">
8904
8961
  <xsl:copy>
@@ -8981,7 +9038,8 @@
8981
9038
  </xsl:copy>
8982
9039
  </xsl:template>
8983
9040
 
8984
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9041
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9042
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
8985
9043
  <xsl:copy>
8986
9044
  <xsl:copy-of select="@*"/>
8987
9045
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -8991,6 +9049,12 @@
8991
9049
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
8992
9050
  <xsl:apply-templates mode="update_xml_step1"/>
8993
9051
  </xsl:template>
9052
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9053
+ <xsl:copy>
9054
+ <xsl:copy-of select="@*"/>
9055
+ <xsl:apply-templates mode="update_xml_step1"/>
9056
+ </xsl:copy>
9057
+ </xsl:template>
8994
9058
  <!-- =========================================================================== -->
8995
9059
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
8996
9060
  <!-- =========================================================================== -->
@@ -9471,6 +9535,10 @@
9471
9535
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9472
9536
  </xsl:template>
9473
9537
 
9538
+ <xsl:template name="getDocumentId_fromCurrentNode">
9539
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9540
+ </xsl:template>
9541
+
9474
9542
  <xsl:template name="namespaceCheck">
9475
9543
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9476
9544
  <xsl:variable name="XSLNS">
@@ -810,8 +810,11 @@ a:hover {
810
810
  background: #1d1d1d;
811
811
  box-shadow: 3px 0 0 #1d1d1d, -3px 0 0 #1d1d1d; }
812
812
 
813
- ::selection,
814
- ::-moz-selection {
813
+ *::selection {
814
+ background: #1d1d1d;
815
+ color: white; }
816
+
817
+ *::-moz-selection {
815
818
  background: #1d1d1d;
816
819
  color: white; }
817
820
 
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  def annex1(elem)
9
9
  lbl = @xrefs.anchor(elem["id"], :label)
10
10
  if t = elem.at(ns("./title"))
11
- t.children = "<strong>#{t.children.to_xml}</strong>"
11
+ t.children = "<strong>#{to_xml(t.children)}</strong>"
12
12
  end
13
13
  prefix_name(elem, "<br/>", lbl, "title")
14
14
  end
@@ -683,6 +683,9 @@
683
683
  </define>
684
684
  <define name="underline">
685
685
  <element name="underline">
686
+ <optional>
687
+ <attribute name="style"/>
688
+ </optional>
686
689
  <zeroOrMore>
687
690
  <ref name="PureTextElement"/>
688
691
  </zeroOrMore>
@@ -47,7 +47,7 @@
47
47
  </element>
48
48
  </define>
49
49
  <define name="DocumentType">
50
- <value>document</value>
50
+ <text/>
51
51
  </define>
52
52
  <define name="docsubtype">
53
53
  <element name="subdoctype">
@@ -571,6 +571,11 @@
571
571
  <ref name="MultilingualRenderingType"/>
572
572
  </attribute>
573
573
  </optional>
574
+ <optional>
575
+ <attribute name="linenums">
576
+ <data type="boolean"/>
577
+ </attribute>
578
+ </optional>
574
579
  <optional>
575
580
  <ref name="tname"/>
576
581
  </optional>
@@ -1238,6 +1243,11 @@
1238
1243
  </define>
1239
1244
  <define name="concept">
1240
1245
  <element name="concept">
1246
+ <optional>
1247
+ <attribute name="bold">
1248
+ <data type="boolean"/>
1249
+ </attribute>
1250
+ </optional>
1241
1251
  <optional>
1242
1252
  <attribute name="ital">
1243
1253
  <data type="boolean"/>
@@ -2653,6 +2663,7 @@
2653
2663
  <value>full</value>
2654
2664
  <value>short</value>
2655
2665
  <value>id</value>
2666
+ <text/>
2656
2667
  </choice>
2657
2668
  </define>
2658
2669
  <define name="erefTypeWithConnective">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.1.13".freeze
3
+ VERSION = "2.2.1".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 2.2.2"
32
+ spec.add_dependency "metanorma-generic", "~> 2.3.0"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.13
4
+ version: 2.2.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-11-21 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.2
19
+ version: 2.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.2
26
+ version: 2.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
245
  - !ruby/object:Gem::Version
246
246
  version: '0'
247
247
  requirements: []
248
- rubygems_version: 3.3.7
248
+ rubygems_version: 3.3.26
249
249
  signing_key:
250
250
  specification_version: 4
251
251
  summary: metanorma-cc lets you write CalConnect standards in AsciiDoc.