metanorma-ribose 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: 3edc722be912cd5f552285f32943aa7a98ccbe0a92b2fd217b47ba729559f8da
4
- data.tar.gz: 77651772301d839682f696cb4c7f07578b0fe5d19011be84ada83a7e619b3515
3
+ metadata.gz: fb795cd22cf6cdc75bf3a53c1b9d979799a89b8d0733a6510c4de6b6af975b8e
4
+ data.tar.gz: 14eeadada4566d22bc576b9a28bc903d45cbaf17536ff62db78e59b8d167e75c
5
5
  SHA512:
6
- metadata.gz: b5ccc82c2937fcb82983c65f0d10762fb64a9f1736d81e528ad2d98311e52912cb48dd57b3bbc9c56c8b50f7ecbbeeafdabc3eb01653be2af353dd1da2cba448
7
- data.tar.gz: 288f73b49dac4cf6cdde93e3f19f794466ada5691a3a4dac93adab4763a8db804e25c5b48912489a9bf1166292f1b90fe0bd281af6dfd08a06b519fa4fe2a9e6
6
+ metadata.gz: 9225d6ff20a31be5bac5e041f4b566a87e6f49bd04ae3a8f05fa745a75367463321cd206865a47da30bbb3fc4c56049a4ef7bdb0aa25644cda7daa2265a0bbc5
7
+ data.tar.gz: 7b18bff8d19e7c72cb36a6c64a60f498c4aca7a4664b9e7e69a67f2d966dec57fd51f9be7f72b04dab6a828b9c2adf6d4d740fce42d3a9ee015cfd1ad44e47e0
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/
@@ -622,8 +622,11 @@ a:hover {
622
622
  background: #1661AD;
623
623
  box-shadow: 3px 0 0 #1661AD, -3px 0 0 #1661AD; }
624
624
 
625
- ::selection,
626
- ::-moz-selection {
625
+ *::selection {
626
+ background: #1661AD;
627
+ color: white; }
628
+
629
+ *::-moz-selection {
627
630
  background: #1661AD;
628
631
  color: white; }
629
632
 
@@ -14,7 +14,7 @@ module IsoDoc
14
14
  mod = elem.at(ns("./modification")) and
15
15
  termsource_modification(mod)
16
16
  elem.children = l10n("<strong>#{@i18n.source}:</strong> "\
17
- "#{elem.children.to_xml.strip}")
17
+ "#{to_xml(elem.children).strip}")
18
18
  elem&.next_element&.name == "termsource" and elem.next = "; "
19
19
  end
20
20
 
@@ -2030,6 +2030,10 @@
2030
2030
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2031
2031
  </xsl:attribute-set>
2032
2032
 
2033
+ <xsl:attribute-set name="figure-block-style">
2034
+
2035
+ </xsl:attribute-set>
2036
+
2033
2037
  <xsl:attribute-set name="figure-style">
2034
2038
  <!-- background for image -->
2035
2039
  <xsl:attribute name="background-color">rgb(236,242,246)</xsl:attribute>
@@ -3478,6 +3482,10 @@
3478
3482
  <xsl:with-param name="continued">true</xsl:with-param>
3479
3483
  </xsl:apply-templates>
3480
3484
 
3485
+ <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
3486
+ <fo:block/>
3487
+ </xsl:if>
3488
+
3481
3489
  </fo:table-cell>
3482
3490
  </fo:table-row>
3483
3491
  </xsl:template> <!-- table-header-title -->
@@ -3867,7 +3875,26 @@
3867
3875
 
3868
3876
  <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
3869
3877
  <xsl:variable name="footnote_inline">
3870
- <fo:inline xsl:use-attribute-sets="fn-num-style">
3878
+ <fo:inline>
3879
+
3880
+ <xsl:variable name="fn_styles">
3881
+ <xsl:choose>
3882
+ <xsl:when test="ancestor::*[local-name() = 'bibitem']">
3883
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
3884
+ </xsl:when>
3885
+ <xsl:otherwise>
3886
+ <fn_styles xsl:use-attribute-sets="fn-num-style"/>
3887
+ </xsl:otherwise>
3888
+ </xsl:choose>
3889
+ </xsl:variable>
3890
+
3891
+ <xsl:for-each select="xalan:nodeset($fn_styles)/fn_styles/@*">
3892
+ <xsl:copy-of select="."/>
3893
+ </xsl:for-each>
3894
+
3895
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3896
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3897
+ </xsl:if>
3871
3898
 
3872
3899
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3873
3900
  <xsl:value-of select="$current_fn_number_text"/>
@@ -3927,7 +3954,10 @@
3927
3954
  </xsl:for-each>
3928
3955
  <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']/*">
3929
3956
  <xsl:sort select="@displayorder" data-type="number"/>
3930
- <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])]">
3957
+ <!-- commented:
3958
+ .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
3959
+ because 'fn' there is in biblio-tag -->
3960
+ <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])]">
3931
3961
  <!-- copy unique fn -->
3932
3962
  <fn gen_id="{generate-id(.)}">
3933
3963
  <xsl:copy-of select="@*"/>
@@ -4784,7 +4814,7 @@
4784
4814
 
4785
4815
  <xsl:variable name="_font-size">
4786
4816
 
4787
- <!-- 10 -->
4817
+ <!-- inherit -->
4788
4818
 
4789
4819
  <xsl:choose>
4790
4820
  <xsl:when test="ancestor::*[local-name() = 'table']">inherit</xsl:when>
@@ -5030,6 +5060,23 @@
5030
5060
  <xsl:apply-templates/>
5031
5061
  </xsl:template>
5032
5062
 
5063
+ <!-- Don't break standard's numbers -->
5064
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
5065
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
5066
+ <xsl:choose>
5067
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5068
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5069
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5070
+ </xsl:when>
5071
+ <xsl:otherwise>
5072
+ <xsl:apply-templates/>
5073
+ </xsl:otherwise>
5074
+ </xsl:choose>
5075
+ </xsl:template>
5076
+ <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">
5077
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5078
+ </xsl:template>
5079
+
5033
5080
  <!-- ========================= -->
5034
5081
  <!-- END Rich text formatting -->
5035
5082
  <!-- ========================= -->
@@ -5425,7 +5472,7 @@
5425
5472
  <xsl:choose>
5426
5473
  <xsl:when test="@colspan">
5427
5474
  <xsl:variable name="td">
5428
- <xsl:element name="td">
5475
+ <xsl:element name="{local-name()}">
5429
5476
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
5430
5477
  <xsl:if test="local-name()='th'">
5431
5478
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5440,7 +5487,7 @@
5440
5487
  </xsl:call-template>
5441
5488
  </xsl:when>
5442
5489
  <xsl:otherwise>
5443
- <xsl:element name="td">
5490
+ <xsl:element name="{local-name()}">
5444
5491
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
5445
5492
  <xsl:if test="local-name()='th'">
5446
5493
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -5507,7 +5554,7 @@
5507
5554
  <xsl:variable name="currentRow" select="."/>
5508
5555
 
5509
5556
  <xsl:variable name="normalizedTDs">
5510
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
5557
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
5511
5558
  <xsl:choose>
5512
5559
  <xsl:when test="@rowspan &gt; 1">
5513
5560
  <xsl:copy>
@@ -5519,7 +5566,7 @@
5519
5566
  </xsl:copy>
5520
5567
  </xsl:when>
5521
5568
  <xsl:otherwise>
5522
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
5569
+ <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)])]"/>
5523
5570
  </xsl:otherwise>
5524
5571
  </xsl:choose>
5525
5572
  </xsl:for-each>
@@ -5740,6 +5787,33 @@
5740
5787
  </xsl:choose>
5741
5788
  </xsl:template>
5742
5789
 
5790
+ <xsl:template name="getLang_fromCurrentNode">
5791
+ <xsl:variable name="language_current" select="normalize-space(.//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5792
+ <xsl:variable name="language">
5793
+ <xsl:choose>
5794
+ <xsl:when test="$language_current != ''">
5795
+ <xsl:value-of select="$language_current"/>
5796
+ </xsl:when>
5797
+ <xsl:otherwise>
5798
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5799
+ <xsl:choose>
5800
+ <xsl:when test="$language_current_2 != ''">
5801
+ <xsl:value-of select="$language_current_2"/>
5802
+ </xsl:when>
5803
+ <xsl:otherwise>
5804
+ <xsl:value-of select=".//*[local-name()='bibdata']//*[local-name()='language']"/>
5805
+ </xsl:otherwise>
5806
+ </xsl:choose>
5807
+ </xsl:otherwise>
5808
+ </xsl:choose>
5809
+ </xsl:variable>
5810
+
5811
+ <xsl:choose>
5812
+ <xsl:when test="$language = 'English'">en</xsl:when>
5813
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
5814
+ </xsl:choose>
5815
+ </xsl:template>
5816
+
5743
5817
  <xsl:template name="capitalizeWords">
5744
5818
  <xsl:param name="str"/>
5745
5819
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
@@ -6200,12 +6274,6 @@
6200
6274
 
6201
6275
  <fo:block-container margin-left="0mm">
6202
6276
 
6203
- <!-- <xsl:if test="$namespace = 'iho'">
6204
- <xsl:if test="ancestor::iho:td">
6205
- <xsl:attribute name="font-size">12pt</xsl:attribute>
6206
- </xsl:if>
6207
- </xsl:if> -->
6208
-
6209
6277
  <fo:block>
6210
6278
 
6211
6279
  <fo:inline xsl:use-attribute-sets="note-name-style">
@@ -6375,7 +6443,7 @@
6375
6443
  <xsl:template match="*[local-name() = 'figure']" name="figure">
6376
6444
  <xsl:variable name="isAdded" select="@added"/>
6377
6445
  <xsl:variable name="isDeleted" select="@deleted"/>
6378
- <fo:block-container id="{@id}">
6446
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6379
6447
 
6380
6448
  <xsl:call-template name="setTrackChangesStyles">
6381
6449
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -6712,6 +6780,31 @@
6712
6780
  <xsl:apply-templates mode="svg_update"/>
6713
6781
  </xsl:copy>
6714
6782
  </xsl:template>
6783
+
6784
+ <!-- regex for 'display: inline-block;' -->
6785
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
6786
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
6787
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
6788
+ </xsl:template>
6789
+
6790
+ <!-- replace
6791
+ stroke="rgba(r, g, b, alpha)" to
6792
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
6793
+ fill="rgba(r, g, b, alpha)" to
6794
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6795
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6796
+ <xsl:variable name="components_">
6797
+ <xsl:call-template name="split">
6798
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6799
+ <xsl:with-param name="sep" select="','"/>
6800
+ </xsl:call-template>
6801
+ </xsl:variable>
6802
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6803
+ <xsl:variable name="att_name" select="local-name()"/>
6804
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6805
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6806
+ </xsl:template>
6807
+
6715
6808
  <!-- ============== -->
6716
6809
  <!-- END: svg_update -->
6717
6810
  <!-- ============== -->
@@ -7337,7 +7430,13 @@
7337
7430
  </xsl:template>
7338
7431
 
7339
7432
  <xsl:template match="text()" mode="contents_item">
7340
- <xsl:call-template name="keep_together_standard_number"/>
7433
+ <xsl:variable name="text">
7434
+ <!-- to split by '_' and other chars -->
7435
+ <text><xsl:call-template name="add-zero-spaces-java"/></text>
7436
+ </xsl:variable>
7437
+ <xsl:for-each select="xalan:nodeset($text)/text/text()">
7438
+ <xsl:call-template name="keep_together_standard_number"/>
7439
+ </xsl:for-each>
7341
7440
  </xsl:template>
7342
7441
 
7343
7442
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
@@ -7348,39 +7447,57 @@
7348
7447
  <!-- =============== -->
7349
7448
  <!-- sourcecode -->
7350
7449
  <!-- =============== -->
7351
- <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7352
7450
 
7353
- <xsl:variable name="sourcecode_attributes">
7354
- <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7355
- <xsl:variable name="_font-size">
7451
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7452
+ <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7453
+ <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7356
7454
 
7357
- <!-- 9 -->
7455
+ <xsl:template match="*[local-name() = 'property']" mode="css">
7456
+ <xsl:attribute name="{@name}">
7457
+ <xsl:value-of select="@value"/>
7458
+ </xsl:attribute>
7459
+ </xsl:template>
7358
7460
 
7359
- <!-- <xsl:if test="$namespace = 'ieee'">
7360
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
7361
- </xsl:if> -->
7461
+ <xsl:template name="get_sourcecode_attributes">
7462
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
7463
+ <xsl:variable name="_font-size">
7362
7464
 
7363
- <xsl:choose>
7364
- <xsl:when test="ancestor::*[local-name() = 'table']">inherit</xsl:when>
7365
- <xsl:otherwise>95%</xsl:otherwise><!-- 110% -->
7366
- </xsl:choose>
7465
+ <!-- inherit -->
7367
7466
 
7368
- </xsl:variable>
7467
+ <!-- <xsl:if test="$namespace = 'ieee'">
7468
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
7469
+ </xsl:if> -->
7369
7470
 
7370
- <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7371
- <xsl:if test="$font-size != ''">
7372
- <xsl:attribute name="font-size">
7373
- <xsl:choose>
7374
- <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7375
- <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7376
- <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7377
- <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7378
- </xsl:choose>
7379
- </xsl:attribute>
7380
- </xsl:if>
7381
- </xsl:element>
7471
+ <xsl:choose>
7472
+ <xsl:when test="ancestor::*[local-name() = 'table'][not(@type = 'sourcecode')]">inherit</xsl:when>
7473
+ <xsl:otherwise>95%</xsl:otherwise><!-- 110% -->
7474
+ </xsl:choose>
7475
+
7476
+ </xsl:variable>
7477
+
7478
+ <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
7479
+ <xsl:if test="$font-size != ''">
7480
+ <xsl:attribute name="font-size">
7481
+ <xsl:choose>
7482
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
7483
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
7484
+ <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
7485
+ <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
7486
+ </xsl:choose>
7487
+ </xsl:attribute>
7488
+ </xsl:if>
7489
+ <xsl:apply-templates select="$sourcecode_css//class[@name = 'sourcecode']" mode="css"/>
7490
+ </xsl:element>
7491
+ </xsl:template>
7492
+
7493
+ <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
7494
+
7495
+ <xsl:variable name="sourcecode_attributes">
7496
+ <xsl:call-template name="get_sourcecode_attributes"/>
7382
7497
  </xsl:variable>
7383
7498
 
7499
+ <!-- <xsl:copy-of select="$sourcecode_css"/> -->
7500
+
7384
7501
  <xsl:choose>
7385
7502
  <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
7386
7503
  <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
@@ -7448,9 +7565,10 @@
7448
7565
  </xsl:choose>
7449
7566
  </xsl:template>
7450
7567
 
7451
- <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
7568
+ <xsl:template match="*[local-name()='sourcecode']/text() | *[local-name()='sourcecode']//*[local-name()='span']/text()" priority="2">
7452
7569
  <xsl:choose>
7453
- <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7570
+ <!-- disabled -->
7571
+ <xsl:when test="1 = 2 and normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
7454
7572
  <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
7455
7573
  <xsl:choose>
7456
7574
  <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
@@ -7465,9 +7583,76 @@
7465
7583
  <xsl:call-template name="add_spaces_to_sourcecode"/>
7466
7584
  </xsl:otherwise>
7467
7585
  </xsl:choose>
7586
+ </xsl:template>
7468
7587
 
7588
+ <!-- add sourcecode highlighting -->
7589
+ <xsl:template match="*[local-name()='sourcecode']//*[local-name()='span'][@class]" priority="2">
7590
+ <xsl:variable name="class" select="@class"/>
7591
+ <xsl:choose>
7592
+ <xsl:when test="$sourcecode_css//class[@name = $class]">
7593
+ <fo:inline>
7594
+ <xsl:apply-templates select="$sourcecode_css//class[@name = $class]" mode="css"/>
7595
+ <xsl:apply-templates/>
7596
+ </fo:inline>
7597
+ </xsl:when>
7598
+ <xsl:otherwise>
7599
+ <xsl:apply-templates/>
7600
+ </xsl:otherwise>
7601
+ </xsl:choose>
7469
7602
  </xsl:template>
7470
7603
 
7604
+ <!-- outer table with line numbers for sourcecode -->
7605
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
7606
+ <fo:block>
7607
+ <fo:table width="100%" table-layout="fixed">
7608
+ <xsl:copy-of select="@id"/>
7609
+ <fo:table-column column-width="8%"/>
7610
+ <fo:table-column column-width="92%"/>
7611
+ <fo:table-body>
7612
+ <xsl:apply-templates/>
7613
+ </fo:table-body>
7614
+ </fo:table>
7615
+ </fo:block>
7616
+ </xsl:template>
7617
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
7618
+ <xsl:apply-templates/>
7619
+ </xsl:template>
7620
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
7621
+ <fo:table-row>
7622
+ <xsl:apply-templates/>
7623
+ </fo:table-row>
7624
+ </xsl:template>
7625
+ <!-- first td with line numbers -->
7626
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
7627
+ <fo:table-cell>
7628
+ <fo:block>
7629
+
7630
+ <!-- set attibutes for line numbers - same as sourcecode -->
7631
+ <xsl:variable name="sourcecode_attributes">
7632
+ <xsl:for-each select="following-sibling::*[local-name() = 'td']/*[local-name() = 'sourcecode']">
7633
+ <xsl:call-template name="get_sourcecode_attributes"/>
7634
+ </xsl:for-each>
7635
+ </xsl:variable>
7636
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*[not(starts-with(local-name(), 'margin-') or starts-with(local-name(), 'space-'))]">
7637
+ <xsl:attribute name="{local-name()}">
7638
+ <xsl:value-of select="."/>
7639
+ </xsl:attribute>
7640
+ </xsl:for-each>
7641
+
7642
+ <xsl:apply-templates/>
7643
+ </fo:block>
7644
+ </fo:table-cell>
7645
+ </xsl:template>
7646
+ <!-- second td with sourcecode -->
7647
+ <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
7648
+ <fo:table-cell>
7649
+ <fo:block>
7650
+ <xsl:apply-templates/>
7651
+ </fo:block>
7652
+ </fo:table-cell>
7653
+ </xsl:template>
7654
+ <!-- END outer table with line numbers for sourcecode -->
7655
+
7471
7656
  <xsl:template name="add_spaces_to_sourcecode">
7472
7657
  <xsl:variable name="text_step1">
7473
7658
  <xsl:call-template name="add-zero-spaces-equal"/>
@@ -9143,27 +9328,16 @@
9143
9328
  <fo:list-item>
9144
9329
  <fo:list-item-label end-indent="label-end()">
9145
9330
  <fo:block>
9146
- <fo:inline>
9147
-
9148
- <xsl:number format="1." count="*[local-name()='bibitem'][not(@hidden = 'true')]"/>
9149
-
9150
- </fo:inline>
9331
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9332
+ <xsl:with-param name="biblio_tag_part">first</xsl:with-param>
9333
+ </xsl:apply-templates>
9151
9334
  </fo:block>
9152
9335
  </fo:list-item-label>
9153
9336
  <fo:list-item-body start-indent="body-start()">
9154
9337
  <fo:block>
9155
- <xsl:variable name="docidentifier">
9156
- <xsl:choose>
9157
- <xsl:when test="rsd:docidentifier/@type = 'metanorma'"/>
9158
- <xsl:otherwise>
9159
- <xsl:value-of select="rsd:docidentifier[not(@type = 'metanorma-ordinal')]"/>
9160
- </xsl:otherwise>
9161
- </xsl:choose>
9162
- </xsl:variable>
9163
- <xsl:value-of select="$docidentifier"/>
9164
- <xsl:if test="normalize-space($docidentifier) != '' and rsd:formattedref">
9165
- <xsl:text>, </xsl:text>
9166
- </xsl:if>
9338
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9339
+ <xsl:with-param name="biblio_tag_part">last</xsl:with-param>
9340
+ </xsl:apply-templates>
9167
9341
  <xsl:apply-templates select="rsd:formattedref"/>
9168
9342
  </fo:block>
9169
9343
  </fo:list-item-body>
@@ -9174,170 +9348,51 @@
9174
9348
  </xsl:template> <!-- references[not(@normative='true')]/bibitem -->
9175
9349
 
9176
9350
  <xsl:template name="processBibitem">
9351
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9177
9352
 
9178
- <!-- start RSD bibitem processing -->
9179
- <xsl:if test=".//rsd:fn">
9353
+ <!-- start bibitem processing -->
9354
+ <xsl:if test=".//*[local-name() = 'fn']">
9180
9355
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
9181
9356
  </xsl:if>
9182
- <xsl:variable name="docidentifier" select="rsd:docidentifier"/>
9183
- <xsl:value-of select="$docidentifier"/>
9184
- <xsl:apply-templates select="rsd:note"/>
9185
- <xsl:if test="normalize-space($docidentifier) != '' and rsd:formattedref">, </xsl:if>
9186
- <xsl:apply-templates select="rsd:formattedref"/>
9187
- <!-- END RSD bibitem processing -->
9357
+
9358
+ <xsl:apply-templates select="*[local-name() = 'biblio-tag']">
9359
+ <xsl:with-param name="biblio_tag_part" select="$biblio_tag_part"/>
9360
+ </xsl:apply-templates>
9361
+ <xsl:apply-templates select="*[local-name() = 'formattedref']"/>
9362
+ <!-- end bibitem processing -->
9188
9363
 
9189
9364
  </xsl:template> <!-- processBibitem (bibitem) -->
9190
9365
 
9191
- <xsl:template name="processBibitemDocId">
9192
- <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')]"/>
9193
- <xsl:choose>
9194
- <xsl:when test="normalize-space($_doc_ident) != ''">
9195
- <!-- <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"/>
9196
- <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
9197
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9198
- </xsl:if> -->
9199
- <xsl:value-of select="$_doc_ident"/>
9200
- </xsl:when>
9201
- <xsl:otherwise>
9202
- <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
9203
- <xsl:if test="$type != ''">
9204
- <xsl:value-of select="$type"/><xsl:text> </xsl:text>
9205
- </xsl:if> -->
9206
- <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma') and not(@type = 'metanorma-ordinal')]"/>
9207
- </xsl:otherwise>
9208
- </xsl:choose>
9209
- </xsl:template> <!-- processBibitemDocId -->
9366
+ <xsl:template match="*[local-name() = 'title']" mode="title">
9367
+ <fo:inline><xsl:apply-templates/></fo:inline>
9368
+ </xsl:template>
9369
+
9370
+ <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9210
9371
 
9211
- <xsl:template name="processPersonalAuthor">
9372
+ <xsl:template match="*[local-name() = 'formattedref']">
9373
+ <!-- <xsl:if test="$namespace = 'unece' or $namespace = 'unece-rec'">
9374
+ <xsl:text>, </xsl:text>
9375
+ </xsl:if> -->
9376
+ <xsl:apply-templates/>
9377
+ </xsl:template>
9378
+
9379
+ <xsl:template match="*[local-name() = 'biblio-tag']">
9380
+ <xsl:param name="biblio_tag_part">both</xsl:param>
9212
9381
  <xsl:choose>
9213
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'completename']">
9214
- <author>
9215
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'completename']"/>
9216
- </author>
9217
- </xsl:when>
9218
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'initial']">
9219
- <author>
9220
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9221
- <xsl:text> </xsl:text>
9222
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'initial']" mode="strip"/>
9223
- </author>
9382
+ <xsl:when test="$biblio_tag_part = 'first' and *[local-name() = 'tab']">
9383
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
9224
9384
  </xsl:when>
9225
- <xsl:when test="*[local-name() = 'name']/*[local-name() = 'surname'] and *[local-name() = 'name']/*[local-name() = 'forename']">
9226
- <author>
9227
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'surname']"/>
9228
- <xsl:text> </xsl:text>
9229
- <xsl:apply-templates select="*[local-name() = 'name']/*[local-name() = 'forename']" mode="strip"/>
9230
- </author>
9385
+ <xsl:when test="$biblio_tag_part = 'last'">
9386
+ <xsl:apply-templates select="./*[local-name() = 'tab'][1]/following-sibling::node()"/>
9231
9387
  </xsl:when>
9232
9388
  <xsl:otherwise>
9233
9389
  <xsl:apply-templates/>
9234
9390
  </xsl:otherwise>
9235
9391
  </xsl:choose>
9236
- </xsl:template> <!-- processPersonalAuthor -->
9237
-
9238
- <xsl:template name="renderDate">
9239
- <xsl:if test="normalize-space(*[local-name() = 'on']) != ''">
9240
- <xsl:value-of select="*[local-name() = 'on']"/>
9241
- </xsl:if>
9242
- <xsl:if test="normalize-space(*[local-name() = 'from']) != ''">
9243
- <xsl:value-of select="concat(*[local-name() = 'from'], '–', *[local-name() = 'to'])"/>
9244
- </xsl:if>
9245
- </xsl:template>
9246
-
9247
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'initial']/text()" mode="strip">
9248
- <xsl:value-of select="translate(.,'. ','')"/>
9249
- </xsl:template>
9250
-
9251
- <xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
9252
- <xsl:value-of select="substring(.,1,1)"/>
9253
- </xsl:template>
9254
-
9255
- <xsl:template match="*[local-name() = 'title']" mode="title">
9256
- <fo:inline><xsl:apply-templates/></fo:inline>
9257
- </xsl:template>
9258
-
9259
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'title']" priority="2">
9260
- <!-- <fo:inline><xsl:apply-templates /></fo:inline> -->
9261
- <fo:inline font-style="italic"> <!-- BIPM BSI CSD CSA GB IEC IHO ISO ITU JCGM -->
9262
- <xsl:apply-templates/>
9263
- </fo:inline>
9264
9392
  </xsl:template>
9265
9393
 
9266
- <!-- bibitem/note renders as footnote -->
9267
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
9268
-
9269
- <!-- list of footnotes to calculate actual footnotes number -->
9270
- <xsl:variable name="p_fn_">
9271
- <xsl:call-template name="get_fn_list"/>
9272
- </xsl:variable>
9273
- <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9274
- <xsl:variable name="gen_id" select="generate-id(.)"/>
9275
- <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9276
- <!-- fn sequence number in document -->
9277
- <xsl:variable name="current_fn_number">
9278
- <xsl:choose>
9279
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9280
- <xsl:otherwise>
9281
- <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
9282
- <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
9283
- </xsl:otherwise>
9284
- </xsl:choose>
9285
- </xsl:variable>
9286
- <fo:footnote>
9287
- <xsl:variable name="number">
9288
-
9289
- <xsl:choose>
9290
- <xsl:when test="ancestor::*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]">
9291
- <xsl:number level="any" count="*[local-name() = 'references'][preceding-sibling::*[local-name() = 'references']]//*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
9292
- </xsl:when>
9293
- <xsl:otherwise>
9294
- <xsl:value-of select="$current_fn_number"/>
9295
- </xsl:otherwise>
9296
- </xsl:choose>
9297
-
9298
- </xsl:variable>
9299
-
9300
- <xsl:variable name="current_fn_number_text">
9301
- <xsl:value-of select="$number"/>
9302
-
9303
- </xsl:variable>
9304
-
9305
- <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
9306
- <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
9307
- <xsl:value-of select="$current_fn_number_text"/>
9308
- </fo:basic-link>
9309
- </fo:inline>
9310
- <fo:footnote-body>
9311
- <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
9312
- <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
9313
- <xsl:value-of select="$current_fn_number_text"/>
9314
- </fo:inline>
9315
- <xsl:apply-templates/>
9316
- </fo:block>
9317
- </fo:footnote-body>
9318
- </fo:footnote>
9319
- </xsl:template>
9320
-
9321
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'edition']"> <!-- for iho -->
9322
- <xsl:text> edition </xsl:text>
9323
- <xsl:value-of select="."/>
9324
- </xsl:template>
9325
-
9326
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'uri']"> <!-- for iho -->
9327
- <xsl:text> (</xsl:text>
9328
- <fo:inline xsl:use-attribute-sets="link-style">
9329
- <fo:basic-link external-destination="." fox:alt-text=".">
9330
- <xsl:value-of select="."/>
9331
- </fo:basic-link>
9332
- </fo:inline>
9333
- <xsl:text>)</xsl:text>
9334
- </xsl:template>
9335
-
9336
- <xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'docidentifier']"/>
9337
-
9338
- <xsl:template match="*[local-name() = 'formattedref']">
9339
-
9340
- <xsl:apply-templates/>
9394
+ <xsl:template match="*[local-name() = 'biblio-tag']/*[local-name() = 'tab']" priority="2">
9395
+ <xsl:text> </xsl:text>
9341
9396
  </xsl:template>
9342
9397
 
9343
9398
  <!-- ======================= -->
@@ -9670,7 +9725,9 @@
9670
9725
  <!-- Update xml -->
9671
9726
  <!-- ===================================== -->
9672
9727
  <!-- =========================================================================== -->
9673
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9728
+ <!-- STEP1: -->
9729
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
9730
+ <!-- - Ignore 'span' without style -->
9674
9731
  <!-- =========================================================================== -->
9675
9732
  <xsl:template match="@*|node()" mode="update_xml_step1">
9676
9733
  <xsl:copy>
@@ -9753,7 +9810,8 @@
9753
9810
  </xsl:copy>
9754
9811
  </xsl:template>
9755
9812
 
9756
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9813
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9814
+ <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">
9757
9815
  <xsl:copy>
9758
9816
  <xsl:copy-of select="@*"/>
9759
9817
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -9763,6 +9821,12 @@
9763
9821
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9764
9822
  <xsl:apply-templates mode="update_xml_step1"/>
9765
9823
  </xsl:template>
9824
+ <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
9825
+ <xsl:copy>
9826
+ <xsl:copy-of select="@*"/>
9827
+ <xsl:apply-templates mode="update_xml_step1"/>
9828
+ </xsl:copy>
9829
+ </xsl:template>
9766
9830
  <!-- =========================================================================== -->
9767
9831
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9768
9832
  <!-- =========================================================================== -->
@@ -10243,6 +10307,10 @@
10243
10307
  <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
10244
10308
  </xsl:template>
10245
10309
 
10310
+ <xsl:template name="getDocumentId_fromCurrentNode">
10311
+ <xsl:call-template name="getLang_fromCurrentNode"/><xsl:value-of select=".//*[local-name() = 'p'][1]/@id"/>
10312
+ </xsl:template>
10313
+
10246
10314
  <xsl:template name="namespaceCheck">
10247
10315
  <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
10248
10316
  <xsl:variable name="XSLNS">
@@ -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 Ribose
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-ribose
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
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
243
  requirements: []
244
- rubygems_version: 3.3.7
244
+ rubygems_version: 3.3.26
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: metanorma-ribose lets you write Ribose standards in AsciiDoc.