metanorma-cc 2.1.8.1 → 2.1.9

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: a628ec2c4338c385b27172fbd0920d1b3229b790bfd045512f7ac0a8ed147394
4
- data.tar.gz: 6be4f38382e53e85206ff30b79442446dca5b618825e47c0c0d8e06f5709c9de
3
+ metadata.gz: 6895d3f741596dacc396bc3c83fd15ce410d030b4680d1620458df572025cfa3
4
+ data.tar.gz: 7587a3c37abda6a45621ed022ebeaff24305d4df71788ed02865676ce139526a
5
5
  SHA512:
6
- metadata.gz: 9238dcbdc397ed054a715c8319ea62d8477679ca954fca6f9222a270aa258559acf111655d0cfa99f2036aecc901eb9649cc811fbcb6ef52bda0d04814958841
7
- data.tar.gz: 4dfa8aaf5b55c136e2b7a6e6303b8c9d8770ff6dabea88c85df05e87c41bdfd16bfe838a8b2db6f75466a94e18c891116a28a08d11854ab2b2cc2a4a444971c5
6
+ metadata.gz: 5b32831d37bd1ce267ef842983601253d72fe9c2bb72e7bf020417322f6338520c81dc0b77cd5006ee2fb47778fbdb0b96307cd65cb1db05f6b0193a28f37845
7
+ data.tar.gz: a11518e8c5d6b6de7793587c1d1c4f567a35c0f0dfa570d9cb2e751890b8ccf6d434bdf936d81b2dca3aa402244be92a2afa8b4a719ed12682b5227867697745
@@ -6326,6 +6326,18 @@
6326
6326
  </xsl:copy>
6327
6327
  </xsl:template>
6328
6328
 
6329
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
6330
+ <xsl:copy>
6331
+ <xsl:apply-templates mode="contents_item"/>
6332
+ </xsl:copy>
6333
+ </xsl:template>
6334
+
6335
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
6336
+ <xsl:copy>
6337
+ <xsl:apply-templates mode="contents_item"/>
6338
+ </xsl:copy>
6339
+ </xsl:template>
6340
+
6329
6341
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
6330
6342
  <xsl:copy-of select="."/>
6331
6343
  </xsl:template>
@@ -7780,21 +7792,29 @@
7780
7792
  </xsl:variable>
7781
7793
 
7782
7794
  <xsl:template match="@*|node()" mode="index_add_id">
7795
+ <xsl:param name="docid"/>
7783
7796
  <xsl:copy>
7784
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
7797
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
7798
+ <xsl:with-param name="docid" select="$docid"/>
7799
+ </xsl:apply-templates>
7785
7800
  </xsl:copy>
7786
7801
  </xsl:template>
7787
7802
 
7788
7803
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
7804
+ <xsl:param name="docid"/>
7789
7805
  <xsl:variable name="id">
7790
- <xsl:call-template name="generateIndexXrefId"/>
7806
+ <xsl:call-template name="generateIndexXrefId">
7807
+ <xsl:with-param name="docid" select="$docid"/>
7808
+ </xsl:call-template>
7791
7809
  </xsl:variable>
7792
7810
  <xsl:copy> <!-- add id to xref -->
7793
7811
  <xsl:apply-templates select="@*" mode="index_add_id"/>
7794
7812
  <xsl:attribute name="id">
7795
7813
  <xsl:value-of select="$id"/>
7796
7814
  </xsl:attribute>
7797
- <xsl:apply-templates mode="index_add_id"/>
7815
+ <xsl:apply-templates mode="index_add_id">
7816
+ <xsl:with-param name="docid" select="$docid"/>
7817
+ </xsl:apply-templates>
7798
7818
  </xsl:copy>
7799
7819
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
7800
7820
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -7806,7 +7826,9 @@
7806
7826
  <xsl:attribute name="id">
7807
7827
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
7808
7828
  </xsl:attribute>
7809
- <xsl:apply-templates mode="index_add_id"/>
7829
+ <xsl:apply-templates mode="index_add_id">
7830
+ <xsl:with-param name="docid" select="$docid"/>
7831
+ </xsl:apply-templates>
7810
7832
  </xsl:copy>
7811
7833
  </xsl:if>
7812
7834
  </xsl:template>
@@ -7843,12 +7865,33 @@
7843
7865
  </xsl:when>
7844
7866
  <xsl:when test="self::* and local-name(.) = 'xref'">
7845
7867
  <xsl:variable name="id" select="@id"/>
7846
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
7847
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
7848
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
7849
7868
 
7869
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
7850
7870
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
7851
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
7871
+
7872
+ <xsl:variable name="pages_">
7873
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
7874
+ <xsl:choose>
7875
+ <xsl:when test="@id = $id">
7876
+ <page><xsl:value-of select="."/></page>
7877
+ </xsl:when>
7878
+ <xsl:when test="@id = $id_next">
7879
+ <page_next><xsl:value-of select="."/></page_next>
7880
+ </xsl:when>
7881
+ <xsl:when test="@id = $id_prev">
7882
+ <page_prev><xsl:value-of select="."/></page_prev>
7883
+ </xsl:when>
7884
+ </xsl:choose>
7885
+ </xsl:for-each>
7886
+ </xsl:variable>
7887
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
7888
+
7889
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
7890
+ <xsl:variable name="page" select="$pages/page"/>
7891
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
7892
+ <xsl:variable name="page_next" select="$pages/page_next"/>
7893
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
7894
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
7852
7895
 
7853
7896
  <xsl:choose>
7854
7897
  <!-- 2nd pass -->
@@ -7908,16 +7951,20 @@
7908
7951
  </xsl:template>
7909
7952
 
7910
7953
  <xsl:template name="generateIndexXrefId">
7954
+ <xsl:param name="docid"/>
7955
+
7911
7956
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
7912
7957
 
7913
- <xsl:variable name="docid">
7914
- <xsl:call-template name="getDocumentId"/>
7958
+ <xsl:variable name="docid_curr">
7959
+ <xsl:value-of select="$docid"/>
7960
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
7915
7961
  </xsl:variable>
7962
+
7916
7963
  <xsl:variable name="item_number">
7917
7964
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
7918
7965
  </xsl:variable>
7919
7966
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
7920
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7967
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7921
7968
  </xsl:template>
7922
7969
 
7923
7970
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -6,8 +6,8 @@ require_relative "i18n"
6
6
  module IsoDoc
7
7
  module CC
8
8
  module Init
9
- def metadata_init(lang, script, i18n)
10
- @meta = Metadata.new(lang, script, i18n)
9
+ def metadata_init(lang, script, locale, i18n)
10
+ @meta = Metadata.new(lang, script, locale, i18n)
11
11
  end
12
12
 
13
13
  def xref_init(lang, script, _klass, i18n, options)
@@ -15,10 +15,10 @@ module IsoDoc
15
15
  @xrefs = Xref.new(lang, script, html, i18n, options)
16
16
  end
17
17
 
18
- def i18n_init(lang, script, i18nyaml = nil)
19
- @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
18
+ def i18n_init(lang, script, locale, i18nyaml = nil)
19
+ @i18n = I18n.new(lang, script, locale: locale,
20
+ i18nyaml: i18nyaml || @i18nyaml)
20
21
  end
21
22
  end
22
23
  end
23
24
  end
24
-
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  Metanorma::CC.configuration
9
9
  end
10
10
 
11
- def initialize(lang, script, labels)
11
+ def initialize(lang, script, locale, labels)
12
12
  super
13
13
  set(:tc, "XXXX")
14
14
  end
@@ -29,16 +29,18 @@ module IsoDoc
29
29
  end
30
30
 
31
31
  def personal_authors(isoxml)
32
- persons = {}
33
- roles = isoxml.xpath(ns("//bibdata/contributor/role/@type")).
34
- inject([]) { |m, t| m << t.value }
35
- roles.uniq.sort.each do |r|
32
+ set(:roles_authors_affiliations, roles_authors_affiliations(isoxml))
33
+ super
34
+ end
35
+
36
+ def roles_authors_affiliations(isoxml)
37
+ isoxml.xpath(ns("//bibdata/contributor/role/@type"))
38
+ .inject([]) { |m, t| m << t.value }
39
+ .uniq.sort.each_with_object({}) do |r, m|
36
40
  names = isoxml.xpath(ns("//bibdata/contributor[role/@type = '#{r}']"\
37
- "/person"))
38
- persons[r] = extract_person_names_affiliations(names) unless names.empty?
41
+ "/person"))
42
+ names.empty? or m[r] = extract_person_names_affiliations(names)
39
43
  end
40
- set(:roles_authors_affiliations, persons)
41
- super
42
44
  end
43
45
  end
44
46
  end
@@ -73,8 +73,14 @@
73
73
  <text/>
74
74
  </element>
75
75
  </define>
76
- <define name="script">
76
+ <define name="locale">
77
77
  <a:documentation>ISO-639</a:documentation>
78
+ <element name="locale">
79
+ <text/>
80
+ </element>
81
+ </define>
82
+ <define name="script">
83
+ <a:documentation>ISO-3166</a:documentation>
78
84
  <element name="script">
79
85
  <text/>
80
86
  </element>
@@ -93,6 +99,9 @@
93
99
  <!-- multiple languages and scripts possible: comma delimit them if so -->
94
100
  <attribute name="language"/>
95
101
  </optional>
102
+ <optional>
103
+ <attribute name="locale"/>
104
+ </optional>
96
105
  <optional>
97
106
  <attribute name="script"/>
98
107
  </optional>
@@ -136,6 +145,9 @@
136
145
  <!-- multiple languages and scripts possible: comma delimit them if so -->
137
146
  <attribute name="language"/>
138
147
  </optional>
148
+ <optional>
149
+ <attribute name="locale"/>
150
+ </optional>
139
151
  <optional>
140
152
  <attribute name="script"/>
141
153
  </optional>
@@ -650,6 +662,9 @@
650
662
  <zeroOrMore>
651
663
  <ref name="language"/>
652
664
  </zeroOrMore>
665
+ <zeroOrMore>
666
+ <ref name="locale"/>
667
+ </zeroOrMore>
653
668
  <zeroOrMore>
654
669
  <ref name="script"/>
655
670
  </zeroOrMore>
@@ -741,6 +756,9 @@
741
756
  <zeroOrMore>
742
757
  <ref name="language"/>
743
758
  </zeroOrMore>
759
+ <zeroOrMore>
760
+ <ref name="locale"/>
761
+ </zeroOrMore>
744
762
  <zeroOrMore>
745
763
  <ref name="script"/>
746
764
  </zeroOrMore>
@@ -854,6 +872,15 @@
854
872
  <optional>
855
873
  <attribute name="type"/>
856
874
  </optional>
875
+ <optional>
876
+ <attribute name="language"/>
877
+ </optional>
878
+ <optional>
879
+ <attribute name="locale"/>
880
+ </optional>
881
+ <optional>
882
+ <attribute name="script"/>
883
+ </optional>
857
884
  <data type="anyURI"/>
858
885
  </define>
859
886
  <define name="DateType">
@@ -882,6 +909,7 @@
882
909
  <value>vote-started</value>
883
910
  <value>vote-ended</value>
884
911
  <value>announced</value>
912
+ <value>stable-until</value>
885
913
  </choice>
886
914
  </define>
887
915
  <define name="bdate">
@@ -930,6 +958,9 @@
930
958
  <optional>
931
959
  <attribute name="language"/>
932
960
  </optional>
961
+ <optional>
962
+ <attribute name="locale"/>
963
+ </optional>
933
964
  <optional>
934
965
  <attribute name="script"/>
935
966
  </optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.1.8.1".freeze
3
+ VERSION = "2.1.9".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
- spec.add_dependency "metanorma-generic", "~> 2.2.0"
31
+ spec.add_dependency "metanorma-generic", "~> 2.2.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-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8.1
4
+ version: 2.1.9
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-09-07 00:00:00.000000000 Z
11
+ date: 2022-09-26 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.0
19
+ version: 2.2.2
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.0
26
+ version: 2.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement