metanorma-csa 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: 41bacb1e8cce4edaecc1abbc8b80d10182bc18e47f7eefc5ff0fd18bf2ec7bc2
4
- data.tar.gz: e3a06a2a3837fc7892319db24e1438cdb06a67ff53edecceaf7b4254b1c2be82
3
+ metadata.gz: 3f685276b592de3a6020087f07bffbe7e6b616a4fe297942b455f48ec609e858
4
+ data.tar.gz: af28b9eeffc3381c801ccddd18c31e67a69342938291a0c713bdfd2245418e8c
5
5
  SHA512:
6
- metadata.gz: 3a953eddc1012bfa2c9fcd36ab4632fc283d8b05f25d03852aefaf937107fefdebd0c7653d000f00b4f07008a9a6c8366c3bce0d3b052af0cbcd206195806fc0
7
- data.tar.gz: f7b6a3a2d38ece3ea945cf626d7b086c632895530a84fda0a0ff3f4ee6fadacf2e3af4f720c348084b6e63f2b4177babe1d3f42895695494ea9e96d8bcbd7b97
6
+ metadata.gz: 1ba656baf21d649630fa8d9cb68050f6156b040f11604856553496ba34c9fac5056aca4bc15b44fc32e9697c744d5c6df19b177c9e0d6aca07855ae0259452a6
7
+ data.tar.gz: 7259d9fbef72983e99749dca8eee07bfb09d6d9a02bfd8f5a458c356ed46293385a5a37b6f27853eee0261f2758def49f066e351aa123fbcb87066e386313641
data/.gitignore CHANGED
@@ -9,5 +9,4 @@
9
9
 
10
10
  .rubocop-https--*
11
11
 
12
- /Gemfile.devel
13
12
  /Gemfile.lock
@@ -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 -->
@@ -3149,7 +3159,26 @@
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>
3178
+
3179
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3180
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3181
+ </xsl:if>
3153
3182
 
3154
3183
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3155
3184
  <xsl:value-of select="$current_fn_number_text"/>
@@ -3209,7 +3238,10 @@
3209
3238
  </xsl:for-each>
3210
3239
  <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']/*">
3211
3240
  <xsl:sort select="@displayorder" data-type="number"/>
3212
- <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])]">
3241
+ <!-- commented:
3242
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3243
+ because 'fn' there is in biblio-tag -->
3244
+ <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])]">
3213
3245
  <!-- copy unique fn -->
3214
3246
  <fn gen_id="{generate-id(.)}">
3215
3247
  <xsl:copy-of select="@*"/>
@@ -4060,7 +4092,7 @@
4060
4092
  10
4061
4093
 
4062
4094
 
4063
- <!-- 10 -->
4095
+ <!-- inherit -->
4064
4096
 
4065
4097
  </xsl:variable>
4066
4098
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4301,6 +4333,23 @@
4301
4333
  <xsl:apply-templates/>
4302
4334
  </xsl:template>
4303
4335
 
4336
+ <!-- Don't break standard's numbers -->
4337
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4338
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4339
+ <xsl:choose>
4340
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4341
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4342
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4343
+ </xsl:when>
4344
+ <xsl:otherwise>
4345
+ <xsl:apply-templates/>
4346
+ </xsl:otherwise>
4347
+ </xsl:choose>
4348
+ </xsl:template>
4349
+ <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">
4350
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4351
+ </xsl:template>
4352
+
4304
4353
  <!-- ========================= -->
4305
4354
  <!-- END Rich text formatting -->
4306
4355
  <!-- ========================= -->
@@ -4696,7 +4745,7 @@
4696
4745
  <xsl:choose>
4697
4746
  <xsl:when test="@colspan">
4698
4747
  <xsl:variable name="td">
4699
- <xsl:element name="td">
4748
+ <xsl:element name="{local-name()}">
4700
4749
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4701
4750
  <xsl:if test="local-name()='th'">
4702
4751
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4711,7 +4760,7 @@
4711
4760
  </xsl:call-template>
4712
4761
  </xsl:when>
4713
4762
  <xsl:otherwise>
4714
- <xsl:element name="td">
4763
+ <xsl:element name="{local-name()}">
4715
4764
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4716
4765
  <xsl:if test="local-name()='th'">
4717
4766
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4778,7 +4827,7 @@
4778
4827
  <xsl:variable name="currentRow" select="."/>
4779
4828
 
4780
4829
  <xsl:variable name="normalizedTDs">
4781
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
4830
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
4782
4831
  <xsl:choose>
4783
4832
  <xsl:when test="@rowspan &gt; 1">
4784
4833
  <xsl:copy>
@@ -4790,7 +4839,7 @@
4790
4839
  </xsl:copy>
4791
4840
  </xsl:when>
4792
4841
  <xsl:otherwise>
4793
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
4842
+ <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)])]"/>
4794
4843
  </xsl:otherwise>
4795
4844
  </xsl:choose>
4796
4845
  </xsl:for-each>
@@ -5011,6 +5060,33 @@
5011
5060
  </xsl:choose>
5012
5061
  </xsl:template>
5013
5062
 
5063
+ <xsl:template name="getLang_fromCurrentNode">
5064
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5065
+ <xsl:variable name="language">
5066
+ <xsl:choose>
5067
+ <xsl:when test="$language_current != ''">
5068
+ <xsl:value-of select="$language_current"/>
5069
+ </xsl:when>
5070
+ <xsl:otherwise>
5071
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5072
+ <xsl:choose>
5073
+ <xsl:when test="$language_current_2 != ''">
5074
+ <xsl:value-of select="$language_current_2"/>
5075
+ </xsl:when>
5076
+ <xsl:otherwise>
5077
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5078
+ </xsl:otherwise>
5079
+ </xsl:choose>
5080
+ </xsl:otherwise>
5081
+ </xsl:choose>
5082
+ </xsl:variable>
5083
+
5084
+ <xsl:choose>
5085
+ <xsl:when test="$language = 'English'">en</xsl:when>
5086
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5087
+ </xsl:choose>
5088
+ </xsl:template>
5089
+
5014
5090
  <xsl:template name="capitalizeWords">
5015
5091
  <xsl:param name="str"/>
5016
5092
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -5464,12 +5540,6 @@
5464
5540
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
5465
5541
  </xsl:if>
5466
5542
 
5467
- <!-- <xsl:if test="$namespace = 'iho'">
5468
- <xsl:if test="ancestor::iho:td">
5469
- <xsl:attribute name="font-size">12pt</xsl:attribute>
5470
- </xsl:if>
5471
- </xsl:if> -->
5472
-
5473
5543
  <fo:block>
5474
5544
 
5475
5545
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -5635,7 +5705,7 @@
5635
5705
  <xsl:template match="*[local-name() = 'figure']" name="figure">
5636
5706
  <xsl:variable name="isAdded" select="@added"/>
5637
5707
  <xsl:variable name="isDeleted" select="@deleted"/>
5638
- <fo:block-container id="{@id}">
5708
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
5639
5709
 
5640
5710
  <xsl:call-template name="setTrackChangesStyles">
5641
5711
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -5971,6 +6041,31 @@
5971
6041
  <xsl:apply-templates mode="svg_update"/>
5972
6042
  </xsl:copy>
5973
6043
  </xsl:template>
6044
+
6045
+ <!-- regex for 'display: inline-block;' -->
6046
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
6047
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
6048
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
6049
+ </xsl:template>
6050
+
6051
+ <!-- replace
6052
+ stroke="rgba(r, g, b, alpha)" to
6053
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
6054
+ fill="rgba(r, g, b, alpha)" to
6055
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6056
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6057
+ <xsl:variable name="components_">
6058
+ <xsl:call-template name="split">
6059
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6060
+ <xsl:with-param name="sep" select="','"/>
6061
+ </xsl:call-template>
6062
+ </xsl:variable>
6063
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6064
+ <xsl:variable name="att_name" select="local-name()"/>
6065
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6066
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6067
+ </xsl:template>
6068
+
5974
6069
  <!-- ============== -->
5975
6070
  <!-- END: svg_update -->
5976
6071
  <!-- ============== -->
@@ -6596,7 +6691,13 @@
6596
6691
  </xsl:template>
6597
6692
 
6598
6693
  <xsl:template match="text()" mode="contents_item">
6599
- <xsl:call-template name="keep_together_standard_number"/>
6694
+ <xsl:variable name="text">
6695
+ <!-- to split by '_' and other chars -->
6696
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
6697
+ </xsl:variable>
6698
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
6699
+ <xsl:call-template name="keep_together_standard_number"/>
6700
+ </xsl:for-each>
6600
6701
  </xsl:template>
6601
6702
 
6602
6703
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -6607,36 +6708,54 @@
6607
6708
  <!-- =============== -->
6608
6709
  <!-- sourcecode -->
6609
6710
  <!-- =============== -->
6610
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6611
6711
 
6612
- <xsl:variable name="sourcecode_attributes">
6613
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6614
- <xsl:variable name="_font-size">
6615
- 10
6712
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
6713
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
6714
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
6616
6715
 
6716
+ <xsl:template match="*[local-name() = 'property']" mode="css">
6717
+ <xsl:attribute name="{@name}">
6718
+ <xsl:value-of select="@value"/>
6719
+ </xsl:attribute>
6720
+ </xsl:template>
6617
6721
 
6618
- <!-- 9 -->
6722
+ <xsl:template name="get_sourcecode_attributes">
6723
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6724
+ <xsl:variable name="_font-size">
6725
+ 10
6619
6726
 
6620
- <!-- <xsl:if test="$namespace = 'ieee'">
6621
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6622
- </xsl:if> -->
6623
6727
 
6624
- </xsl:variable>
6728
+ <!-- inherit -->
6625
6729
 
6626
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6627
- <xsl:if test="$font-size != ''">
6628
- <xsl:attribute name="font-size">
6629
- <xsl:choose>
6630
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6631
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6632
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6633
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6634
- </xsl:choose>
6635
- </xsl:attribute>
6636
- </xsl:if>
6637
- </xsl:element>
6730
+ <!-- <xsl:if test="$namespace = 'ieee'">
6731
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6732
+ </xsl:if> -->
6733
+
6734
+ </xsl:variable>
6735
+
6736
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
6737
+ <xsl:if test="$font-size != ''">
6738
+ <xsl:attribute name="font-size">
6739
+ <xsl:choose>
6740
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
6741
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
6742
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
6743
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
6744
+ </xsl:choose>
6745
+ </xsl:attribute>
6746
+ </xsl:if>
6747
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
6748
+ </xsl:element>
6749
+ </xsl:template>
6750
+
6751
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6752
+
6753
+ <xsl:variable name="sourcecode_attributes">
6754
+ <xsl:call-template name="get_sourcecode_attributes"/>
6638
6755
  </xsl:variable>
6639
6756
 
6757
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
6758
+
6640
6759
  <xsl:choose>
6641
6760
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6642
6761
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -6690,9 +6809,10 @@
6690
6809
  </xsl:choose>
6691
6810
  </xsl:template>
6692
6811
 
6693
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
6812
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
6694
6813
  <xsl:choose>
6695
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6814
+ <!-- disabled -->
6815
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6696
6816
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6697
6817
  <xsl:choose>
6698
6818
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -6707,8 +6827,75 @@
6707
6827
  <xsl:call-template name="add_spaces_to_sourcecode"/>
6708
6828
  </xsl:otherwise>
6709
6829
  </xsl:choose>
6830
+ </xsl:template>
6831
+
6832
+ <!-- add sourcecode highlighting -->
6833
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
6834
+ <xsl:variable name="class" select="@class"/>
6835
+ <xsl:choose>
6836
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
6837
+ <fo:inline>
6838
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
6839
+ <xsl:apply-templates/>
6840
+ </fo:inline>
6841
+ </xsl:when>
6842
+ <xsl:otherwise>
6843
+ <xsl:apply-templates/>
6844
+ </xsl:otherwise>
6845
+ </xsl:choose>
6846
+ </xsl:template>
6847
+
6848
+ <!-- outer table with line numbers for sourcecode -->
6849
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
6850
+ <fo:block>
6851
+ <fo:table width="100%" table-layout="fixed">
6852
+ <xsl:copy-of select="@id"/>
6853
+ <fo:table-column column-width="8%"/>
6854
+ <fo:table-column column-width="92%"/>
6855
+ <fo:table-body>
6856
+ <xsl:apply-templates/>
6857
+ </fo:table-body>
6858
+ </fo:table>
6859
+ </fo:block>
6860
+ </xsl:template>
6861
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
6862
+ <xsl:apply-templates/>
6863
+ </xsl:template>
6864
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
6865
+ <fo:table-row>
6866
+ <xsl:apply-templates/>
6867
+ </fo:table-row>
6868
+ </xsl:template>
6869
+ <!-- first td with line numbers -->
6870
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
6871
+ <fo:table-cell>
6872
+ <fo:block>
6873
+
6874
+ <!-- set attibutes for line numbers - same as sourcecode -->
6875
+ <xsl:variable name="sourcecode_attributes">
6876
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
6877
+ <xsl:call-template name="get_sourcecode_attributes"/>
6878
+ </xsl:for-each>
6879
+ </xsl:variable>
6880
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
6881
+ <xsl:attribute name="{local-name()}">
6882
+ <xsl:value-of select="."/>
6883
+ </xsl:attribute>
6884
+ </xsl:for-each>
6710
6885
 
6886
+ <xsl:apply-templates/>
6887
+ </fo:block>
6888
+ </fo:table-cell>
6889
+ </xsl:template>
6890
+ <!-- second td with sourcecode -->
6891
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
6892
+ <fo:table-cell>
6893
+ <fo:block>
6894
+ <xsl:apply-templates/>
6895
+ </fo:block>
6896
+ </fo:table-cell>
6711
6897
  </xsl:template>
6898
+ <!-- END outer table with line numbers for sourcecode -->
6712
6899
 
6713
6900
  <xsl:template name="add_spaces_to_sourcecode">
6714
6901
  <xsl:variable name="text_step1">
@@ -8377,203 +8564,59 @@
8377
8564
 
8378
8565
  <!-- start CSA bibitem processing -->
8379
8566
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-style">
8380
-
8381
- <xsl:variable name="docidentifier">
8382
- <xsl:value-of select="csa:docidentifier[@type = 'metanorma-ordinal']"/>
8383
- <xsl:if test="not(csa:docidentifier[@type = 'metanorma-ordinal'])">
8384
- <xsl:number format="[1]" count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
8385
- </xsl:if>
8386
- </xsl:variable>
8387
-
8388
- <xsl:value-of select="$docidentifier"/>
8389
- <xsl:apply-templates select="*[local-name() = 'note']"/>
8390
- <xsl:text> </xsl:text>
8391
-
8567
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']"/>
8392
8568
  <xsl:apply-templates select="csa:formattedref"/>
8393
-
8394
8569
  </fo:block>
8395
8570
  <!-- END CSA bibitem processing -->
8396
8571
 
8397
8572
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
8398
8573
 
8399
8574
  <xsl:template name="processBibitem">
8575
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8400
8576
 
8401
8577
  <!-- start bibitem processing -->
8402
8578
  <xsl:if test=".//*[local-name() = 'fn']">
8403
8579
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
8404
8580
  </xsl:if>
8405
8581
 
8406
- <!-- display document identifier, not number [1] -->
8407
- <xsl:variable name="docidentifier">
8408
- <xsl:choose>
8409
- <xsl:when test="*[local-name() = 'docidentifier']/@type = 'metanorma'"/>
8410
- <xsl:otherwise><xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma-ordinal')]"/></xsl:otherwise>
8411
- </xsl:choose>
8412
- </xsl:variable>
8413
- <xsl:value-of select="$docidentifier"/>
8414
-
8415
- <xsl:apply-templates select="*[local-name() = 'note']"/>
8416
-
8417
- <xsl:if test="normalize-space($docidentifier) != '' and *[local-name() = 'formattedref']">
8418
-
8419
- <xsl:text> </xsl:text>
8420
- </xsl:if>
8421
-
8582
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
8583
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
8584
+ </xsl:apply-templates>
8422
8585
  <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
8423
8586
  <!-- end bibitem processing -->
8424
8587
 
8425
8588
  </xsl:template> <!-- processBibitem (bibitem) -->
8426
8589
 
8427
- <xsl:template name="processBibitemDocId">
8428
- <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')]"/>
8429
- <xsl:choose>
8430
- <xsl:when test="normalize-space($_doc_ident) != ''">
8431
- <!-- <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"/>
8432
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
8433
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8434
- </xsl:if> -->
8435
- <xsl:value-of select="$_doc_ident"/>
8436
- </xsl:when>
8437
- <xsl:otherwise>
8438
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
8439
- <xsl:if test="$type != ''">
8440
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
8441
- </xsl:if> -->
8442
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
8443
- </xsl:otherwise>
8444
- </xsl:choose>
8445
- </xsl:template> <!-- processBibitemDocId -->
8590
+ <xsl:template match="*[local-name() = 'title']" mode="title">
8591
+ <fo:inline><xsl:apply-templates/></fo:inline>
8592
+ </xsl:template>
8593
+
8594
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8595
+
8596
+ <xsl:template match="*[local-name() = 'formattedref']">
8597
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
8598
+ <xsl:text>, </xsl:text>
8599
+ </xsl:if> -->
8600
+ <xsl:apply-templates/>
8601
+ </xsl:template>
8446
8602
 
8447
- <xsl:template name="processPersonalAuthor">
8603
+ <xsl:template match="*[local-name() = 'biblio-tag']">
8604
+ <xsl:param name="biblio_tag_part">both</xsl:param>
8448
8605
  <xsl:choose>
8449
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
8450
- <author>
8451
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
8452
- </author>
8606
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
8607
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
8453
8608
  </xsl:when>
8454
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
8455
- <author>
8456
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8457
- <xsl:text> </xsl:text>
8458
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
8459
- </author>
8460
- </xsl:when>
8461
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
8462
- <author>
8463
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
8464
- <xsl:text> </xsl:text>
8465
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
8466
- </author>
8609
+ <xsl:when test="$biblio_tag_part = 'last'">
8610
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
8467
8611
  </xsl:when>
8468
8612
  <xsl:otherwise>
8469
8613
  <xsl:apply-templates/>
8470
8614
  </xsl:otherwise>
8471
8615
  </xsl:choose>
8472
- </xsl:template> <!-- processPersonalAuthor -->
8473
-
8474
- <xsl:template name="renderDate">
8475
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
8476
- <xsl:value-of select="*[local-name() = 'on']"/>
8477
- </xsl:if>
8478
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
8479
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
8480
- </xsl:if>
8481
- </xsl:template>
8482
-
8483
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
8484
- <xsl:value-of select="translate(.,'. ','')"/>
8485
- </xsl:template>
8486
-
8487
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
8488
- <xsl:value-of select="substring(.,1,1)"/>
8489
- </xsl:template>
8490
-
8491
- <xsl:template match="*[local-name() = 'title']" mode="title">
8492
- <fo:inline><xsl:apply-templates/></fo:inline>
8493
- </xsl:template>
8494
-
8495
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
8496
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
8497
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
8498
- <xsl:apply-templates/>
8499
- </fo:inline>
8500
- </xsl:template>
8501
-
8502
- <!-- bibitem/note renders as footnote -->
8503
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
8504
-
8505
- <!-- list of footnotes to calculate actual footnotes number -->
8506
- <xsl:variable name="p_fn_">
8507
- <xsl:call-template name="get_fn_list"/>
8508
- </xsl:variable>
8509
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
8510
- <xsl:variable name="gen_id" select="generate-id(.)"/>
8511
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
8512
- <!-- fn sequence number in document -->
8513
- <xsl:variable name="current_fn_number">
8514
- <xsl:choose>
8515
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
8516
- <xsl:otherwise>
8517
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
8518
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
8519
- </xsl:otherwise>
8520
- </xsl:choose>
8521
- </xsl:variable>
8522
- <fo:footnote>
8523
- <xsl:variable name="number">
8524
-
8525
- <xsl:choose>
8526
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
8527
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
8528
- </xsl:when>
8529
- <xsl:otherwise>
8530
- <xsl:value-of select="$current_fn_number"/>
8531
- </xsl:otherwise>
8532
- </xsl:choose>
8533
-
8534
- </xsl:variable>
8535
-
8536
- <xsl:variable name="current_fn_number_text">
8537
- <xsl:value-of select="$number"/>
8538
-
8539
- </xsl:variable>
8540
-
8541
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
8542
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
8543
- <xsl:value-of select="$current_fn_number_text"/>
8544
- </fo:basic-link>
8545
- </fo:inline>
8546
- <fo:footnote-body>
8547
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
8548
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
8549
- <xsl:value-of select="$current_fn_number_text"/>
8550
- </fo:inline>
8551
- <xsl:apply-templates/>
8552
- </fo:block>
8553
- </fo:footnote-body>
8554
- </fo:footnote>
8555
- </xsl:template>
8556
-
8557
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
8558
- <xsl:text> edition </xsl:text>
8559
- <xsl:value-of select="."/>
8560
- </xsl:template>
8561
-
8562
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
8563
- <xsl:text> (</xsl:text>
8564
- <fo:inline xsl:use-attribute-sets="link-style">
8565
- <fo:basic-link external-destination="." fox:alt-text=".">
8566
- <xsl:value-of select="."/>
8567
- </fo:basic-link>
8568
- </fo:inline>
8569
- <xsl:text>)</xsl:text>
8570
8616
  </xsl:template>
8571
8617
 
8572
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
8573
-
8574
- <xsl:template match="*[local-name() = 'formattedref']">
8575
-
8576
- <xsl:apply-templates/>
8618
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
8619
+ <xsl:text> </xsl:text>
8577
8620
  </xsl:template>
8578
8621
 
8579
8622
  <!-- ======================= -->
@@ -8902,7 +8945,9 @@
8902
8945
  <!-- Update xml -->
8903
8946
  <!-- ===================================== -->
8904
8947
  <!-- =========================================================================== -->
8905
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
8948
+ <!-- STEP1: -->
8949
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
8950
+ <!-- - Ignore 'span' without style -->
8906
8951
  <!-- =========================================================================== -->
8907
8952
  <xsl:template match="@*|node()" mode="update_xml_step1">
8908
8953
  <xsl:copy>
@@ -8985,7 +9030,8 @@
8985
9030
  </xsl:copy>
8986
9031
  </xsl:template>
8987
9032
 
8988
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9033
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9034
+ <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">
8989
9035
  <xsl:copy>
8990
9036
  <xsl:copy-of select="@*"/>
8991
9037
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -8995,6 +9041,12 @@
8995
9041
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
8996
9042
  <xsl:apply-templates mode="update_xml_step1"/>
8997
9043
  </xsl:template>
9044
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9045
+ <xsl:copy>
9046
+ <xsl:copy-of select="@*"/>
9047
+ <xsl:apply-templates mode="update_xml_step1"/>
9048
+ </xsl:copy>
9049
+ </xsl:template>
8998
9050
  <!-- =========================================================================== -->
8999
9051
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9000
9052
  <!-- =========================================================================== -->
@@ -9475,6 +9527,10 @@
9475
9527
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
9476
9528
  </xsl:template>
9477
9529
 
9530
+ <xsl:template name="getDocumentId_fromCurrentNode">
9531
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
9532
+ </xsl:template>
9533
+
9478
9534
  <xsl:template name="namespaceCheck">
9479
9535
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
9480
9536
  <xsl:variable name="XSLNS">
@@ -596,8 +596,11 @@ a:hover {
596
596
  background: #4D7EA5;
597
597
  box-shadow: 3px 0 0 #4D7EA5, -3px 0 0 #4D7EA5; }
598
598
 
599
- ::selection,
600
- ::-moz-selection {
599
+ *::selection {
600
+ background: #4D7EA5;
601
+ color: white; }
602
+
603
+ *::-moz-selection {
601
604
  background: #4D7EA5;
602
605
  color: white; }
603
606
 
@@ -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 Csa
3
- VERSION = "2.1.13".freeze
3
+ VERSION = "2.2.1".freeze
4
4
  end
5
5
  end
@@ -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-csa
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
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.3.7
247
+ rubygems_version: 3.3.26
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: metanorma-csa lets you write CSA Normal Documents (CSAND) in AsciiDoc.