metanorma-bipm 2.4.0 → 2.4.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.
@@ -2246,6 +2246,10 @@
2246
2246
 
2247
2247
  </xsl:attribute-set>
2248
2248
 
2249
+ <xsl:template name="refine_termexample-style">
2250
+
2251
+ </xsl:template>
2252
+
2249
2253
  <xsl:attribute-set name="example-style">
2250
2254
 
2251
2255
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -3397,6 +3401,36 @@
3397
3401
  </xsl:for-each>
3398
3402
  </xsl:template>
3399
3403
 
3404
+ <xsl:template name="processMainSectionsDefault_flatxml">
3405
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
3406
+ <xsl:sort select="@displayorder" data-type="number"/>
3407
+ <xsl:variable name="flatxml">
3408
+ <xsl:apply-templates select="." mode="flatxml"/>
3409
+ </xsl:variable>
3410
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3411
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3412
+
3413
+ </xsl:for-each>
3414
+
3415
+ <xsl:for-each select="/*/*[local-name()='annex']">
3416
+ <xsl:sort select="@displayorder" data-type="number"/>
3417
+ <xsl:variable name="flatxml">
3418
+ <xsl:apply-templates select="." mode="flatxml"/>
3419
+ </xsl:variable>
3420
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3421
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3422
+ </xsl:for-each>
3423
+
3424
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
3425
+ <xsl:sort select="@displayorder" data-type="number"/>
3426
+ <xsl:variable name="flatxml">
3427
+ <xsl:apply-templates select="." mode="flatxml"/>
3428
+ </xsl:variable>
3429
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
3430
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
3431
+ </xsl:for-each>
3432
+ </xsl:template>
3433
+
3400
3434
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3401
3435
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
3402
3436
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -3523,7 +3557,9 @@
3523
3557
  </xsl:template> <!-- license-statement/p -->
3524
3558
 
3525
3559
  <xsl:template match="*[local-name()='legal-statement']">
3560
+ <xsl:param name="isLegacy">false</xsl:param>
3526
3561
  <fo:block xsl:use-attribute-sets="legal-statement-style">
3562
+
3527
3563
  <xsl:apply-templates/>
3528
3564
  </fo:block>
3529
3565
  </xsl:template> <!-- legal-statement -->
@@ -5536,13 +5572,13 @@
5536
5572
  <tr>
5537
5573
  <td>
5538
5574
  <xsl:attribute name="id">
5539
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
5575
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
5540
5576
  </xsl:attribute>
5541
5577
  <xsl:apply-templates/>
5542
5578
  </td>
5543
5579
  <td>
5544
5580
  <xsl:attribute name="id">
5545
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
5581
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
5546
5582
  </xsl:attribute>
5547
5583
 
5548
5584
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -5854,13 +5890,14 @@
5854
5890
  <!-- ================= -->
5855
5891
  <!-- Added,deleted text -->
5856
5892
  <!-- ================= -->
5857
- <xsl:template match="*[local-name()='add']" name="tag_add">
5893
+ <xsl:template match="*[local-name()='add'] | *[local-name() = 'change-open-tag'] | *[local-name() = 'change-close-tag']" name="tag_add">
5858
5894
  <xsl:param name="skip">true</xsl:param>
5859
5895
  <xsl:param name="block">false</xsl:param>
5860
5896
  <xsl:param name="type"/>
5861
5897
  <xsl:param name="text-align"/>
5862
5898
  <xsl:choose>
5863
- <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
5899
+ <xsl:when test="starts-with(., $ace_tag) or local-name() = 'change-open-tag' or local-name() = 'change-close-tag'"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start, or
5900
+ <change-open-tag>A<sub>1</sub></change-open-tag>, <change-close-tag>A<sub>1</sub></change-close-tag> -->
5864
5901
  <xsl:choose>
5865
5902
  <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
5866
5903
  <xsl:otherwise>
@@ -5868,12 +5905,32 @@
5868
5905
  <xsl:call-template name="insertTag">
5869
5906
  <xsl:with-param name="type">
5870
5907
  <xsl:choose>
5908
+ <xsl:when test="local-name() = 'change-open-tag'">start</xsl:when>
5909
+ <xsl:when test="local-name() = 'change-close-tag'">end</xsl:when>
5871
5910
  <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
5872
5911
  <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
5873
5912
  </xsl:choose>
5874
5913
  </xsl:with-param>
5875
- <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
5876
- <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
5914
+ <xsl:with-param name="kind">
5915
+ <xsl:choose>
5916
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
5917
+ <xsl:value-of select="text()"/>
5918
+ </xsl:when>
5919
+ <xsl:otherwise>
5920
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
5921
+ </xsl:otherwise>
5922
+ </xsl:choose>
5923
+ </xsl:with-param>
5924
+ <xsl:with-param name="value">
5925
+ <xsl:choose>
5926
+ <xsl:when test="local-name() = 'change-open-tag' or local-name() = 'change-close-tag'">
5927
+ <xsl:value-of select="*[local-name() = 'sub']"/>
5928
+ </xsl:when>
5929
+ <xsl:otherwise>
5930
+ <xsl:value-of select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
5931
+ </xsl:otherwise>
5932
+ </xsl:choose>
5933
+ </xsl:with-param>
5877
5934
  </xsl:call-template>
5878
5935
  </xsl:variable>
5879
5936
  <xsl:choose>
@@ -6133,6 +6190,10 @@
6133
6190
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6134
6191
  </xsl:template>
6135
6192
 
6193
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
6194
+ <xsl:value-of select="."/>
6195
+ </xsl:template>
6196
+
6136
6197
  <!-- ========================= -->
6137
6198
  <!-- END Rich text formatting -->
6138
6199
  <!-- ========================= -->
@@ -6763,7 +6824,7 @@
6763
6824
  </xsl:choose>
6764
6825
  </xsl:variable>
6765
6826
  <xsl:attribute name="id">
6766
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
6827
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
6767
6828
  </xsl:attribute>
6768
6829
 
6769
6830
  <xsl:for-each select="*[local-name() = 'p']">
@@ -6771,7 +6832,7 @@
6771
6832
  <xsl:copy-of select="@*"/>
6772
6833
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
6773
6834
  <xsl:attribute name="id">
6774
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
6835
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
6775
6836
  </xsl:attribute>
6776
6837
 
6777
6838
  <!-- <xsl:copy-of select="node()" /> -->
@@ -6835,7 +6896,7 @@
6835
6896
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
6836
6897
  <xsl:copy>
6837
6898
  <xsl:attribute name="id">
6838
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
6899
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
6839
6900
  </xsl:attribute>
6840
6901
  <xsl:copy-of select="node()"/>
6841
6902
  </xsl:copy>
@@ -8086,11 +8147,17 @@
8086
8147
  </xsl:when>
8087
8148
  <xsl:otherwise>
8088
8149
 
8150
+ <xsl:variable name="image_class" select="ancestor::*[local-name() = 'image']/@class"/>
8151
+ <xsl:variable name="ancestor_table_cell" select="normalize-space(ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])"/>
8152
+
8089
8153
  <xsl:variable name="element">
8090
8154
  <xsl:choose>
8091
8155
  <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
8092
8156
  <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
8093
8157
  </xsl:when>
8158
+ <xsl:when test="not(ancestor::*[local-name() = 'figure'])">
8159
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
8160
+ </xsl:when>
8094
8161
  <xsl:otherwise>
8095
8162
  <fo:block xsl:use-attribute-sets="image-style">
8096
8163
  <xsl:if test="ancestor::*[local-name() = 'dt']">
@@ -8106,10 +8173,24 @@
8106
8173
  <xsl:copy-of select="@*"/>
8107
8174
  <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
8108
8175
  <fo:instream-foreign-object fox:alt-text="{$alt-text}">
8109
- <xsl:if test="$isGenerateTableIF = 'false'">
8110
- <xsl:attribute name="width">100%</xsl:attribute>
8111
- </xsl:if>
8112
- <xsl:attribute name="content-height">100%</xsl:attribute>
8176
+
8177
+ <xsl:choose>
8178
+ <xsl:when test="$image_class = 'corrigenda-tag'">
8179
+ <xsl:attribute name="fox:alt-text">CorrigendaTag</xsl:attribute>
8180
+ <xsl:attribute name="baseline-shift">-10%</xsl:attribute>
8181
+ <xsl:if test="$ancestor_table_cell = 'true'">
8182
+ <xsl:attribute name="baseline-shift">-25%</xsl:attribute>
8183
+ </xsl:if>
8184
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
8185
+ </xsl:when>
8186
+ <xsl:otherwise>
8187
+ <xsl:if test="$isGenerateTableIF = 'false'">
8188
+ <xsl:attribute name="width">100%</xsl:attribute>
8189
+ </xsl:if>
8190
+ <xsl:attribute name="content-height">100%</xsl:attribute>
8191
+ </xsl:otherwise>
8192
+ </xsl:choose>
8193
+
8113
8194
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
8114
8195
  <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
8115
8196
  <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
@@ -9624,7 +9705,7 @@
9624
9705
  <!-- ====== -->
9625
9706
  <xsl:template match="*[local-name() = 'termexample']">
9626
9707
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
9627
-
9708
+ <xsl:call-template name="refine_termexample-style"/>
9628
9709
  <xsl:call-template name="setBlockSpanAll"/>
9629
9710
 
9630
9711
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -10323,13 +10404,19 @@
10323
10404
  <fo:block id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10324
10405
  </xsl:when>
10325
10406
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10326
- <xsl:when test="not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10407
+ <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
10408
+ <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10409
+ </xsl:when>
10410
+ <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10327
10411
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
10328
10412
  </xsl:when>
10329
10413
  </xsl:choose>
10330
10414
 
10331
10415
  </xsl:template>
10332
10416
 
10417
+ <!-- https://github.com/metanorma/mn-samples-bsi/issues/312 -->
10418
+ <xsl:template match="*[local-name() = 'review'][@type = 'other']"/>
10419
+
10333
10420
  <xsl:template match="*[local-name() = 'name']/text()">
10334
10421
  <!-- 0xA0 to space replacement -->
10335
10422
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
@@ -11944,6 +12031,7 @@
11944
12031
  <xsl:template name="printEdition">
11945
12032
  <xsl:variable name="edition_i18n" select="normalize-space((//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
11946
12033
  <xsl:text> </xsl:text>
12034
+
11947
12035
  <xsl:choose>
11948
12036
  <xsl:when test="$edition_i18n != ''">
11949
12037
  <!-- Example: <edition language="fr">deuxième édition</edition> -->
@@ -22,19 +22,19 @@ module IsoDoc
22
22
  set(:si_aspect_paths, si_paths)
23
23
  end
24
24
 
25
- TITLE = "//bibdata/title".freeze
25
+ def title1(xml, type, lang)
26
+ xml.at(ns("//bibdata/title[@type='title-#{type}']" \
27
+ "[@language='#{lang}']"))
28
+ &.children&.to_xml || ""
29
+ end
26
30
 
27
31
  def title(isoxml, _out)
28
32
  lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
29
- set(:doctitle, @c.encode(isoxml.at(
30
- ns("#{TITLE}[@type='title-main'][@language='#{lang1}']"))&.text || ""))
31
- set(:docsubtitle, @c.encode(isoxml.at(
32
- ns("#{TITLE}[@type='title-main'][@language='#{lang2}']"))&.text || ""))
33
+ set(:doctitle, title1(isoxml, "main", lang1))
34
+ set(:docsubtitle, title1(isoxml, "main", lang2))
33
35
  %w(appendix annex part subtitle provenance).each do |e|
34
- set("#{e}title".to_sym, @c.encode(isoxml.at(
35
- ns("#{TITLE}[@type='title-#{e}'][@language='#{lang1}']"))&.text || ""))
36
- set("#{e}subtitle".to_sym, @c.encode(isoxml.at(
37
- ns("#{TITLE}[@type='title-#{e}'][@language='#{lang2}']"))&.text || ""))
36
+ set("#{e}title".to_sym, title1(isoxml, e, lang1))
37
+ set("#{e}subtitle".to_sym, title1(isoxml, e, lang2))
38
38
  end
39
39
  end
40
40
 
@@ -57,7 +57,7 @@ module IsoDoc
57
57
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
58
58
  dn and set(:annexid, @i18n.l10n("#{label1} #{dn.text}"))
59
59
  dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn.text}"))
60
- label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
60
+ label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
61
61
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
62
62
  dn and set(:partid, @i18n.l10n("#{label1} #{dn.text}"))
63
63
  dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn.text}"))
@@ -71,7 +71,8 @@ module IsoDoc
71
71
  end
72
72
 
73
73
  def bibdate(isoxml, _out)
74
- pubdate = isoxml.at(ns("//bibdata/date[not(@format)][@type = 'published']"))
74
+ pubdate = isoxml
75
+ .at(ns("//bibdata/date[not(@format)][@type = 'published']"))
75
76
  pubdate and set(:pubdate_monthyear, monthyr(pubdate.text))
76
77
  end
77
78
  end
@@ -244,6 +244,9 @@
244
244
  <data type="ID"/>
245
245
  </attribute>
246
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
247
250
  <optional>
248
251
  <attribute name="date">
249
252
  <data type="dateTime"/>
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.2.12 -->
20
+ <!-- VERSION v1.3.0 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -146,6 +146,9 @@
146
146
  <data type="boolean"/>
147
147
  </attribute>
148
148
  </optional>
149
+ <optional>
150
+ <attribute name="style"/>
151
+ </optional>
149
152
  <oneOrMore>
150
153
  <ref name="PureTextElement"/>
151
154
  </oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.4.0".freeze
3
+ VERSION = "2.4.2".freeze
4
4
  end
5
5
  end
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
29
29
 
30
- spec.add_dependency "metanorma-generic", "~> 2.6.0"
31
- spec.add_dependency "metanorma-iso", "~> 2.7.0"
30
+ spec.add_dependency "metanorma-generic", "~> 2.6.1"
31
+ spec.add_dependency "metanorma-iso", "~> 2.7.2"
32
32
 
33
33
  spec.add_development_dependency "debug"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.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: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.0
19
+ version: 2.6.1
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.6.0
26
+ version: 2.6.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: metanorma-iso
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.7.0
33
+ version: 2.7.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.7.0
40
+ version: 2.7.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement