metanorma-csa 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad12d8a38ab08e75aefc9fb672d35b9e363980d1f71a61ae9b38c5af9e42fc4c
4
- data.tar.gz: 054c0100481db949965516221c1a7ae499d6b612461173c67f9ab133b34a885e
3
+ metadata.gz: 806a51a66247c3398f78d9f516525b0f2aaa3fe83d669038d0dccc9c7daceea0
4
+ data.tar.gz: 1aa70cd654e05d3acccfb0879309815e5c1b4bc48a2086d07b6be3d52aff1704
5
5
  SHA512:
6
- metadata.gz: eaa7d0cd126bb5b61ece5c2c625ba1c50460f085eda890ce4e68886ea8e1a8bf39188e4718340fceb65367fd312f4d60820b18ec197090e307142f95bdcc1ff2
7
- data.tar.gz: ce4a488caecc3d2620c88ed0b78c0994234e53544b85ada7e3e7704b62d162522f6d3d539263e50cb33cd9c3d091ce74a8c11ff4f3f9deec538bea96a1912873
6
+ metadata.gz: f6b1e0ca4b2895aea8c96f514edd8cfcba2270ea96be1d84e3357df6f941bbb1d3e72a8b3f9c85846296272385570e1817cf8af8c98c67c44bf4c9563b6ae801
7
+ data.tar.gz: 4724482cd93a0e9b4f615e824156bec5569469c458c0fcedb274a6dce49bc927f5e8eebcfd321e7fe271734b5dd331916d5d580ebf478a14e9db022987b338a2
@@ -2,7 +2,7 @@
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="yes"/>
4
4
 
5
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
5
+ <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
6
6
 
7
7
  <xsl:variable name="debug">false</xsl:variable>
8
8
 
@@ -1346,6 +1346,12 @@
1346
1346
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1347
1347
  </xsl:attribute-set>
1348
1348
 
1349
+ <xsl:attribute-set name="figure-block-style">
1350
+
1351
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1352
+
1353
+ </xsl:attribute-set>
1354
+
1349
1355
  <xsl:attribute-set name="figure-style">
1350
1356
 
1351
1357
  </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">6pt</xsl:attribute>
1365
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1360
1366
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1361
1367
 
1362
1368
  </xsl:attribute-set>
@@ -2765,6 +2771,10 @@
2765
2771
  <xsl:with-param name="continued">true</xsl:with-param>
2766
2772
  </xsl:apply-templates>
2767
2773
 
2774
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
2775
+ <fo:block/>
2776
+ </xsl:if>
2777
+
2768
2778
  </fo:table-cell>
2769
2779
  </fo:table-row>
2770
2780
  </xsl:template> <!-- table-header-title -->
@@ -3118,7 +3128,7 @@
3118
3128
  </fn>
3119
3129
  -->
3120
3130
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
3121
- <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" priority="2" name="fn">
3131
+ <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
3122
3132
 
3123
3133
  <!-- list of footnotes to calculate actual footnotes number -->
3124
3134
  <xsl:variable name="p_fn_">
@@ -3149,7 +3159,22 @@
3149
3159
 
3150
3160
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3151
3161
  <xsl:variable name="footnote_inline">
3152
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3162
+ <fo:inline>
3163
+
3164
+ <xsl:variable name="fn_styles">
3165
+ <xsl:choose>
3166
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3167
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3168
+ </xsl:when>
3169
+ <xsl:otherwise>
3170
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3171
+ </xsl:otherwise>
3172
+ </xsl:choose>
3173
+ </xsl:variable>
3174
+
3175
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3176
+ <xsl:copy-of select="."/>
3177
+ </xsl:for-each>
3153
3178
 
3154
3179
  <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3155
3180
  <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
@@ -3160,8 +3185,7 @@
3160
3185
  </fo:basic-link>
3161
3186
  </fo:inline>
3162
3187
  </xsl:variable>
3163
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
3164
- gen_id=<xsl:value-of select="$gen_id"/> -->
3188
+
3165
3189
  <xsl:choose>
3166
3190
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
3167
3191
  <xsl:copy-of select="$footnote_inline"/>
@@ -3213,7 +3237,10 @@
3213
3237
  </xsl:for-each>
3214
3238
  <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']/*">
3215
3239
  <xsl:sort select="@displayorder" data-type="number"/>
3216
- <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])]">
3240
+ <!-- commented:
3241
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3242
+ because 'fn' there is in biblio-tag -->
3243
+ <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])]">
3217
3244
  <!-- copy unique fn -->
3218
3245
  <fn gen_id="{generate-id(.)}">
3219
3246
  <xsl:copy-of select="@*"/>
@@ -4064,7 +4091,7 @@
4064
4091
  10
4065
4092
 
4066
4093
 
4067
- <!-- 10 -->
4094
+ <!-- inherit -->
4068
4095
 
4069
4096
  </xsl:variable>
4070
4097
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5032,6 +5059,33 @@
5032
5059
  </xsl:choose>
5033
5060
  </xsl:template>
5034
5061
 
5062
+ <xsl:template name="getLang_fromCurrentNode">
5063
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5064
+ <xsl:variable name="language">
5065
+ <xsl:choose>
5066
+ <xsl:when test="$language_current != ''">
5067
+ <xsl:value-of select="$language_current"/>
5068
+ </xsl:when>
5069
+ <xsl:otherwise>
5070
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5071
+ <xsl:choose>
5072
+ <xsl:when test="$language_current_2 != ''">
5073
+ <xsl:value-of select="$language_current_2"/>
5074
+ </xsl:when>
5075
+ <xsl:otherwise>
5076
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5077
+ </xsl:otherwise>
5078
+ </xsl:choose>
5079
+ </xsl:otherwise>
5080
+ </xsl:choose>
5081
+ </xsl:variable>
5082
+
5083
+ <xsl:choose>
5084
+ <xsl:when test="$language = 'English'">en</xsl:when>
5085
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5086
+ </xsl:choose>
5087
+ </xsl:template>
5088
+
5035
5089
  <xsl:template name="capitalizeWords">
5036
5090
  <xsl:param name="str"/>
5037
5091
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5650,7 +5704,7 @@
5650
5704
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5651
5705
  <xsl:variable name="isAdded" select="@added"/>
5652
5706
  <xsl:variable name="isDeleted" select="@deleted"/>
5653
- <fo:block-container id="{@id}">
5707
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5654
5708
 
5655
5709
  <xsl:call-template name="setTrackChangesStyles">
5656
5710
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -5728,7 +5782,9 @@
5728
5782
 
5729
5783
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
5730
5784
  <xsl:if test="number($scale) &lt; 100">
5731
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5785
+
5786
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
5787
+
5732
5788
  </xsl:if>
5733
5789
 
5734
5790
  </xsl:if>
@@ -6636,7 +6692,13 @@
6636
6692
  </xsl:template>
6637
6693
 
6638
6694
  <xsl:template match="text()" mode="contents_item">
6639
- <xsl:call-template name="keep_together_standard_number"/>
6695
+ <xsl:variable name="text">
6696
+ <!-- to split by '_' and other chars -->
6697
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6698
+ </xsl:variable>
6699
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6700
+ <xsl:call-template name="keep_together_standard_number"/>
6701
+ </xsl:for-each>
6640
6702
  </xsl:template>
6641
6703
 
6642
6704
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6647,36 +6709,54 @@
6647
6709
  <!-- =============== -->
6648
6710
  <!-- sourcecode -->
6649
6711
  <!-- =============== -->
6650
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6651
6712
 
6652
- <xsl:variable name="sourcecode_attributes">
6653
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6654
- <xsl:variable name="_font-size">
6655
- 10
6713
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6714
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6715
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6656
6716
 
6717
+ <xsl:template match="*[local-name() = 'property']" mode="css">
6718
+ <xsl:attribute name="{@name}">
6719
+ <xsl:value-of select="@value"/>
6720
+ </xsl:attribute>
6721
+ </xsl:template>
6657
6722
 
6658
- <!-- 9 -->
6723
+ <xsl:template name="get_sourcecode_attributes">
6724
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6725
+ <xsl:variable name="_font-size">
6726
+ 10
6659
6727
 
6660
- <!-- <xsl:if test="$namespace = 'ieee'">
6661
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6662
- </xsl:if> -->
6663
6728
 
6664
- </xsl:variable>
6729
+ <!-- inherit -->
6665
6730
 
6666
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6667
- <xsl:if test="$font-size != ''">
6668
- <xsl:attribute name="font-size">
6669
- <xsl:choose>
6670
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6671
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6672
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6673
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6674
- </xsl:choose>
6675
- </xsl:attribute>
6676
- </xsl:if>
6677
- </xsl:element>
6731
+ <!-- <xsl:if test="$namespace = 'ieee'">
6732
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6733
+ </xsl:if> -->
6734
+
6735
+ </xsl:variable>
6736
+
6737
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6738
+ <xsl:if test="$font-size != ''">
6739
+ <xsl:attribute name="font-size">
6740
+ <xsl:choose>
6741
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6742
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6743
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6744
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6745
+ </xsl:choose>
6746
+ </xsl:attribute>
6747
+ </xsl:if>
6748
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
6749
+ </xsl:element>
6750
+ </xsl:template>
6751
+
6752
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6753
+
6754
+ <xsl:variable name="sourcecode_attributes">
6755
+ <xsl:call-template name="get_sourcecode_attributes"/>
6678
6756
  </xsl:variable>
6679
6757
 
6758
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
6759
+
6680
6760
  <xsl:choose>
6681
6761
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6682
6762
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6719,6 +6799,12 @@
6719
6799
  </xsl:attribute>
6720
6800
  </xsl:for-each>
6721
6801
 
6802
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
6803
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
6804
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
6805
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
6806
+ </xsl:if>
6807
+
6722
6808
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6723
6809
  </fo:block>
6724
6810
 
@@ -6730,9 +6816,10 @@
6730
6816
  </xsl:choose>
6731
6817
  </xsl:template>
6732
6818
 
6733
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
6819
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6734
6820
  <xsl:choose>
6735
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6821
+ <!-- disabled -->
6822
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6736
6823
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6737
6824
  <xsl:choose>
6738
6825
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6747,9 +6834,77 @@
6747
6834
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6748
6835
  </xsl:otherwise>
6749
6836
  </xsl:choose>
6837
+ </xsl:template>
6750
6838
 
6839
+ <!-- add sourcecode highlighting -->
6840
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
6841
+ <xsl:variable name="class" select="@class"/>
6842
+ <xsl:choose>
6843
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
6844
+ <fo:inline>
6845
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
6846
+ <xsl:apply-templates/>
6847
+ </fo:inline>
6848
+ </xsl:when>
6849
+ <xsl:otherwise>
6850
+ <xsl:apply-templates/>
6851
+ </xsl:otherwise>
6852
+ </xsl:choose>
6751
6853
  </xsl:template>
6752
6854
 
6855
+ <!-- outer table with line numbers for sourcecode -->
6856
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
6857
+ <fo:block>
6858
+ <fo:table width="100%" table-layout="fixed">
6859
+ <xsl:copy-of select="@id"/>
6860
+ <fo:table-column column-width="8%"/>
6861
+ <fo:table-column column-width="92%"/>
6862
+ <fo:table-body>
6863
+ <xsl:apply-templates/>
6864
+ </fo:table-body>
6865
+ </fo:table>
6866
+ </fo:block>
6867
+ </xsl:template>
6868
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
6869
+ <xsl:apply-templates/>
6870
+ </xsl:template>
6871
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
6872
+ <fo:table-row>
6873
+ <xsl:apply-templates/>
6874
+ </fo:table-row>
6875
+ </xsl:template>
6876
+ <!-- first td with line numbers -->
6877
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
6878
+ <fo:table-cell>
6879
+ <fo:block>
6880
+
6881
+ <!-- set attibutes for line numbers - same as sourcecode -->
6882
+ <xsl:variable name="sourcecode_attributes">
6883
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
6884
+ <xsl:call-template name="get_sourcecode_attributes"/>
6885
+ </xsl:for-each>
6886
+ </xsl:variable>
6887
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
6888
+ <xsl:attribute name="{local-name()}">
6889
+ <xsl:value-of select="."/>
6890
+ </xsl:attribute>
6891
+ </xsl:for-each>
6892
+
6893
+ <xsl:apply-templates/>
6894
+ </fo:block>
6895
+ </fo:table-cell>
6896
+ </xsl:template>
6897
+
6898
+ <!-- second td with sourcecode -->
6899
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
6900
+ <fo:table-cell>
6901
+ <fo:block>
6902
+ <xsl:apply-templates/>
6903
+ </fo:block>
6904
+ </fo:table-cell>
6905
+ </xsl:template>
6906
+ <!-- END outer table with line numbers for sourcecode -->
6907
+
6753
6908
  <xsl:template name="add_spaces_to_sourcecode">
6754
6909
  <xsl:variable name="text_step1">
6755
6910
  <xsl:call-template name="add-zero-spaces-equal"/>
@@ -6979,7 +7134,25 @@
6979
7134
  <xsl:template match="*[local-name()='pre']" name="pre">
6980
7135
  <fo:block xsl:use-attribute-sets="pre-style">
6981
7136
  <xsl:copy-of select="@id"/>
6982
- <xsl:apply-templates/>
7137
+ <xsl:choose>
7138
+
7139
+ <xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
7140
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
7141
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
7142
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7143
+ </xsl:if>
7144
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
7145
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
7146
+ <mtext><xsl:value-of select="."/></mtext>
7147
+ </math>
7148
+ </fo:instream-foreign-object>
7149
+ </xsl:when>
7150
+
7151
+ <xsl:otherwise>
7152
+ <xsl:apply-templates/>
7153
+ </xsl:otherwise>
7154
+
7155
+ </xsl:choose>
6983
7156
  </fo:block>
6984
7157
  </xsl:template>
6985
7158
  <!-- =============== -->
@@ -8417,203 +8590,59 @@
8417
8590
 
8418
8591
  <!-- start CSA bibitem processing -->
8419
8592
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-style">
8420
-
8421
- <xsl:variable name="docidentifier">
8422
- <xsl:value-of select="csa:docidentifier[@type = 'metanorma-ordinal']"/>
8423
- <xsl:if test="not(csa:docidentifier[@type = 'metanorma-ordinal'])">
8424
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
8425
- </xsl:if>
8426
- </xsl:variable>
8427
-
8428
- <xsl:value-of select="$docidentifier"/>
8429
- <xsl:apply-templates select="*[local-name() = 'note']"/>
8430
- <xsl:text> </xsl:text>
8431
-
8593
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']"/>
8432
8594
  <xsl:apply-templates select="csa:formattedref"/>
8433
-
8434
8595
  </fo:block>
8435
8596
  <!-- END CSA bibitem processing -->
8436
8597
 
8437
8598
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8438
8599
 
8439
8600
  <xsl:template name="processBibitem">
8601
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8440
8602
 
8441
8603
  <!-- start bibitem processing -->
8442
8604
  <xsl:if test=".//*[local-name() = 'fn']">
8443
8605
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8444
8606
  </xsl:if>
8445
8607
 
8446
- <!-- display document identifier, not number [1] -->
8447
- <xsl:variable name="docidentifier">
8448
- <xsl:choose>
8449
- <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
8450
- <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8451
- </xsl:choose>
8452
- </xsl:variable>
8453
- <xsl:value-of select="$docidentifier"/>
8454
-
8455
- <xsl:apply-templates select="*[local-name() = 'note']"/>
8456
-
8457
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
8458
-
8459
- <xsl:text> </xsl:text>
8460
- </xsl:if>
8461
-
8608
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8609
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8610
+ </xsl:apply-templates>
8462
8611
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8463
8612
  <!-- end bibitem processing -->
8464
8613
 
8465
8614
  </xsl:template> <!-- processBibitem (bibitem) -->
8466
8615
 
8467
- <xsl:template name="processBibitemDocId">
8468
- <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')]"/>
8469
- <xsl:choose>
8470
- <xsl:when test="normalize-space($_doc_ident) != ''">
8471
- <!-- <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"/>
8472
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8473
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8474
- </xsl:if> -->
8475
- <xsl:value-of select="$_doc_ident"/>
8476
- </xsl:when>
8477
- <xsl:otherwise>
8478
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8479
- <xsl:if test="$type != ''">
8480
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8481
- </xsl:if> -->
8482
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8483
- </xsl:otherwise>
8484
- </xsl:choose>
8485
- </xsl:template> <!-- processBibitemDocId -->
8616
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8617
+ <fo:inline><xsl:apply-templates/></fo:inline>
8618
+ </xsl:template>
8619
+
8620
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8486
8621
 
8487
- <xsl:template name="processPersonalAuthor">
8622
+ <xsl:template match="*[local-name() = 'formattedref']">
8623
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8624
+ <xsl:text>, </xsl:text>
8625
+ </xsl:if> -->
8626
+ <xsl:apply-templates/>
8627
+ </xsl:template>
8628
+
8629
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8630
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8488
8631
  <xsl:choose>
8489
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8490
- <author>
8491
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8492
- </author>
8493
- </xsl:when>
8494
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8495
- <author>
8496
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8497
- <xsl:text> </xsl:text>
8498
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8499
- </author>
8632
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8633
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8500
8634
  </xsl:when>
8501
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8502
- <author>
8503
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8504
- <xsl:text> </xsl:text>
8505
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8506
- </author>
8635
+ <xsl:when test="$biblio_tag_part = 'last'">
8636
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8507
8637
  </xsl:when>
8508
8638
  <xsl:otherwise>
8509
8639
  <xsl:apply-templates/>
8510
8640
  </xsl:otherwise>
8511
8641
  </xsl:choose>
8512
- </xsl:template> <!-- processPersonalAuthor -->
8513
-
8514
- <xsl:template name="renderDate">
8515
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8516
- <xsl:value-of select="*[local-name() = 'on']"/>
8517
- </xsl:if>
8518
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8519
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8520
- </xsl:if>
8521
- </xsl:template>
8522
-
8523
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8524
- <xsl:value-of select="translate(.,'. ','')"/>
8525
- </xsl:template>
8526
-
8527
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8528
- <xsl:value-of select="substring(.,1,1)"/>
8529
- </xsl:template>
8530
-
8531
- <xsl:template match="*[local-name() = 'title']" mode="title">
8532
- <fo:inline><xsl:apply-templates/></fo:inline>
8533
- </xsl:template>
8534
-
8535
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8536
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8537
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8538
- <xsl:apply-templates/>
8539
- </fo:inline>
8540
8642
  </xsl:template>
8541
8643
 
8542
- <!-- bibitem/note renders as footnote -->
8543
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8544
-
8545
- <!-- list of footnotes to calculate actual footnotes number -->
8546
- <xsl:variable name="p_fn_">
8547
- <xsl:call-template name="get_fn_list"/>
8548
- </xsl:variable>
8549
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8550
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8551
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8552
- <!-- fn sequence number in document -->
8553
- <xsl:variable name="current_fn_number">
8554
- <xsl:choose>
8555
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8556
- <xsl:otherwise>
8557
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8558
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8559
- </xsl:otherwise>
8560
- </xsl:choose>
8561
- </xsl:variable>
8562
- <fo:footnote>
8563
- <xsl:variable name="number">
8564
-
8565
- <xsl:choose>
8566
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
8567
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
8568
- </xsl:when>
8569
- <xsl:otherwise>
8570
- <xsl:value-of select="$current_fn_number"/>
8571
- </xsl:otherwise>
8572
- </xsl:choose>
8573
-
8574
- </xsl:variable>
8575
-
8576
- <xsl:variable name="current_fn_number_text">
8577
- <xsl:value-of select="$number"/>
8578
-
8579
- </xsl:variable>
8580
-
8581
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8582
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8583
- <xsl:value-of select="$current_fn_number_text"/>
8584
- </fo:basic-link>
8585
- </fo:inline>
8586
- <fo:footnote-body>
8587
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8588
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8589
- <xsl:value-of select="$current_fn_number_text"/>
8590
- </fo:inline>
8591
- <xsl:apply-templates/>
8592
- </fo:block>
8593
- </fo:footnote-body>
8594
- </fo:footnote>
8595
- </xsl:template>
8596
-
8597
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8598
- <xsl:text> edition </xsl:text>
8599
- <xsl:value-of select="."/>
8600
- </xsl:template>
8601
-
8602
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8603
- <xsl:text> (</xsl:text>
8604
- <fo:inline xsl:use-attribute-sets="link-style">
8605
- <fo:basic-link external-destination="." fox:alt-text=".">
8606
- <xsl:value-of select="."/>
8607
- </fo:basic-link>
8608
- </fo:inline>
8609
- <xsl:text>)</xsl:text>
8610
- </xsl:template>
8611
-
8612
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8613
-
8614
- <xsl:template match="*[local-name() = 'formattedref']">
8615
-
8616
- <xsl:apply-templates/>
8644
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8645
+ <xsl:text> </xsl:text>
8617
8646
  </xsl:template>
8618
8647
 
8619
8648
  <!-- ======================= -->
@@ -9038,6 +9067,12 @@
9038
9067
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9039
9068
  <xsl:apply-templates mode="update_xml_step1"/>
9040
9069
  </xsl:template>
9070
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9071
+ <xsl:copy>
9072
+ <xsl:copy-of select="@*"/>
9073
+ <xsl:apply-templates mode="update_xml_step1"/>
9074
+ </xsl:copy>
9075
+ </xsl:template>
9041
9076
  <!-- =========================================================================== -->
9042
9077
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9043
9078
  <!-- =========================================================================== -->
@@ -9518,6 +9553,10 @@
9518
9553
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9519
9554
  </xsl:template>
9520
9555
 
9556
+ <xsl:template name="getDocumentId_fromCurrentNode">
9557
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9558
+ </xsl:template>
9559
+
9521
9560
  <xsl:template name="namespaceCheck">
9522
9561
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9523
9562
  <xsl:variable name="XSLNS">
@@ -131,6 +131,35 @@ a.FootnoteRef + a.FootnoteRef:before {
131
131
  color: red;
132
132
  text-decoration: line-through; }
133
133
 
134
+ /* code highlighting with line numbers */
135
+ table.rouge-line-table td.rouge-gutter {
136
+ -moz-user-select: none;
137
+ -ms-user-select: none;
138
+ -webkit-user-select: none;
139
+ user-select: none;
140
+ padding-right: 1em; }
141
+
142
+ table.rouge-line-table td.rouge-code {
143
+ -moz-user-select: all;
144
+ -ms-user-select: all;
145
+ -webkit-user-select: all;
146
+ user-select: all; }
147
+
148
+ table.rouge-line-table,
149
+ table.rouge-line-table th,
150
+ table.rouge-line-table td {
151
+ width: auto;
152
+ border: none;
153
+ margin: 0;
154
+ padding: 0;
155
+ font-size: 100%; }
156
+
157
+ table.rouge-line-table pre {
158
+ margin: 0;
159
+ padding: 0;
160
+ overflow-x: visible;
161
+ font-size: 100%; }
162
+
134
163
  #standard-band {
135
164
  background-color: #0AC442; }
136
165
 
@@ -596,8 +625,11 @@ a:hover {
596
625
  background: #4D7EA5;
597
626
  box-shadow: 3px 0 0 #4D7EA5, -3px 0 0 #4D7EA5; }
598
627
 
599
- ::selection,
600
- ::-moz-selection {
628
+ *::selection {
629
+ background: #4D7EA5;
630
+ color: white; }
631
+
632
+ *::-moz-selection {
601
633
  background: #4D7EA5;
602
634
  color: white; }
603
635
 
@@ -762,7 +794,7 @@ table {
762
794
  table th, table td {
763
795
  padding: 1em; }
764
796
  table td.header {
765
- font-weigth: 400; }
797
+ font-weight: 400; }
766
798
 
767
799
  table,
768
800
  th,
@@ -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,7 +2663,7 @@
2653
2663
  <value>full</value>
2654
2664
  <value>short</value>
2655
2665
  <value>id</value>
2656
- <value>modspec</value>
2666
+ <text/>
2657
2667
  </choice>
2658
2668
  </define>
2659
2669
  <define name="erefTypeWithConnective">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.2.0".freeze
3
+ VERSION = "2.2.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.2
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-12-05 00:00:00.000000000 Z
11
+ date: 2022-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic