metanorma-iec 2.5.11 → 2.5.12

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: ed4a618c9e1ba0726ed92aa754be91fc050633dfcc14200f8ca1df0770d6e6e2
4
- data.tar.gz: 79c04caf59bb6e617d2e7a2481673af29cd11d43c44c17cd625b554567a1f43d
3
+ metadata.gz: 293aedaf5e38a5a6144556ee13fffdc271e4477c945cd681728e5e9e9154c01f
4
+ data.tar.gz: 79a0643a146fe752e1895523068f2589da742e391ff1596cb00aabae692e3a59
5
5
  SHA512:
6
- metadata.gz: 81d946a173c03c2782a6c20c4ba5a42396605778fb8780446256b8e303731d0c3ce5813cb5c9ad60c38e0f9091250d589e18dc7dd0fd8dbfdef4eb329f6dd4b1
7
- data.tar.gz: f9e096af9bc5e8f8e34b6ded0a600dcfdedf3fc636555663fc85c30558fdd9a54539382ca5cbc871760bc47b26669dc6d0b0a9023d3ea16a8c52f47501f65ac6
6
+ metadata.gz: 6a20bc6b38666a64a6a768a3a8908420db3efef4a59dee7b2643a1e24a4c08611bfa34d3f894a7df3e5ee69a5bf1fba8e97ea7695fa7b8ab915835b5e4c02aea
7
+ data.tar.gz: f4d3769e2894778122a77a38657fd0870d2b1408235bfa30845e1133689272c815a1085948c34e9e11d21e623869a9969c9336867944305c4659d27bf061c2f0
@@ -43,6 +43,11 @@ module IsoDoc
43
43
  end
44
44
  end
45
45
 
46
+ def termdef_parse(node, out)
47
+ node.at(ns("./fmt-preferred")) or return
48
+ super
49
+ end
50
+
46
51
  def para_class(node)
47
52
  case node["class"]
48
53
  when "zzSTDTitle1", "zzSTDTitle2" then "zzSTDTitle1"
@@ -3403,6 +3403,9 @@
3403
3403
 
3404
3404
  </xsl:attribute-set>
3405
3405
 
3406
+ <xsl:attribute-set name="related-block-style" use-attribute-sets="preferred-block-style">
3407
+ </xsl:attribute-set>
3408
+
3406
3409
  <xsl:attribute-set name="definition-style">
3407
3410
 
3408
3411
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -5732,7 +5735,9 @@
5732
5735
  <xsl:with-param name="element">
5733
5736
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
5734
5737
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5738
+
5735
5739
  <xsl:copy-of select="$current_fn_number_text"/>
5740
+
5736
5741
  </fo:inline>
5737
5742
  </fo:basic-link>
5738
5743
  </xsl:with-param>
@@ -5751,8 +5756,7 @@
5751
5756
 
5752
5757
  <fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">
5753
5758
 
5754
- <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
5755
-
5759
+ <xsl:variable name="fn_block">
5756
5760
  <xsl:call-template name="refine_fn-body-style"/>
5757
5761
 
5758
5762
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">
@@ -5760,9 +5764,15 @@
5760
5764
  <xsl:call-template name="refine_fn-body-num-style"/>
5761
5765
 
5762
5766
  <xsl:value-of select="$current_fn_number_text"/>
5767
+
5763
5768
  </fo:inline>
5764
5769
  <xsl:apply-templates/>
5765
- </fo:block>
5770
+ </xsl:variable>
5771
+
5772
+ <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
5773
+ <xsl:copy-of select="$fn_block"/>
5774
+ </fo:block>
5775
+
5766
5776
  </fo:block-container>
5767
5777
  </fo:footnote-body>
5768
5778
  </fo:footnote>
@@ -11904,14 +11914,17 @@
11904
11914
  </fo:block>
11905
11915
  </xsl:template>
11906
11916
 
11907
- <xsl:template match="*[local-name() = 'domain']">
11917
+ <!-- <xsl:template match="*[local-name() = 'domain']"> -->
11908
11918
  <!-- https://github.com/metanorma/isodoc/issues/607
11909
11919
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
11910
11920
  <xsl:text> </xsl:text> -->
11911
- <xsl:if test="not(@hidden = 'true')">
11921
+ <!-- <xsl:if test="not(@hidden = 'true')">
11912
11922
  <xsl:apply-templates/>
11913
11923
  </xsl:if>
11914
- </xsl:template>
11924
+ </xsl:template> -->
11925
+
11926
+ <!-- https://github.com/metanorma/isodoc/issues/632#issuecomment-2567163931 -->
11927
+ <xsl:template match="*[local-name() = 'domain']"/>
11915
11928
 
11916
11929
  <xsl:template match="*[local-name() = 'admitted']">
11917
11930
  <fo:block xsl:use-attribute-sets="admitted-style">
@@ -11926,9 +11939,11 @@
11926
11939
  </xsl:template>
11927
11940
 
11928
11941
  <xsl:template name="setStyle_preferred">
11929
- <xsl:if test="*[local-name() = 'strong']">
11930
- <xsl:attribute name="font-weight">normal</xsl:attribute>
11931
- </xsl:if>
11942
+
11943
+ <xsl:if test="*[local-name() = 'strong']">
11944
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
11945
+ </xsl:if>
11946
+
11932
11947
  </xsl:template>
11933
11948
 
11934
11949
  <!-- regarding ISO 10241-1:2011, If there is more than one preferred term, each preferred term follows the previous one on a new line. -->
@@ -11938,6 +11953,17 @@
11938
11953
  </xsl:template>
11939
11954
  <!-- End Preferred, admitted, deprecated -->
11940
11955
 
11956
+ <xsl:template match="*[local-name() = 'fmt-related']">
11957
+ <fo:block role="SKIP" xsl:use-attribute-sets="related-block-style">
11958
+ <xsl:apply-templates/>
11959
+ </fo:block>
11960
+ </xsl:template>
11961
+ <xsl:template match="*[local-name() = 'fmt-related']/*[local-name() = 'p']" priority="4">
11962
+ <fo:block>
11963
+ <xsl:apply-templates/>
11964
+ </fo:block>
11965
+ </xsl:template>
11966
+
11941
11967
  <!-- ========== -->
11942
11968
  <!-- definition -->
11943
11969
  <!-- ========== -->
@@ -12848,6 +12874,7 @@
12848
12874
 
12849
12875
  <!-- Normative references -->
12850
12876
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
12877
+ <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
12851
12878
 
12852
12879
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
12853
12880
 
@@ -13564,7 +13591,8 @@
13564
13591
  <!-- add @id - first element with @id plus '_element_name' -->
13565
13592
  <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
13566
13593
  <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
13567
- <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13594
+ <xsl:variable name="document_suffix" select="ancestor::*[contains(local-name(), '-standard')]/@document_suffix"/>
13595
+ <xsl:attribute name="id"><xsl:value-of select="concat($prefix_id, '_', local-name(), '_', $document_suffix)"/></xsl:attribute>
13568
13596
  </xsl:if>
13569
13597
  </xsl:template>
13570
13598
 
@@ -13621,6 +13649,31 @@
13621
13649
  <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
13622
13650
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_step1"/>
13623
13651
  <xsl:template match="*[local-name() = 'section-title'][following-sibling::*[1][local-name() = 'p'][@type = 'section-title' or @type = 'floating-title']]" mode="update_xml_pres"/>
13652
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_step1"/> -->
13653
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_step1"/>
13654
+ <!-- <xsl:template match="*[local-name() = 'preferred'][following-sibling::*[not(local-name() = 'preferred')][1][local-name() = 'fmt-preferred']]" mode="update_xml_pres"/> -->
13655
+ <xsl:template match="*[local-name() = 'preferred']" mode="update_xml_pres"/>
13656
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_step1"/> -->
13657
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_step1"/>
13658
+ <!-- <xsl:template match="*[local-name() = 'admitted'][following-sibling::*[not(local-name() = 'admitted')][1][local-name() = 'fmt-admitted']]" mode="update_xml_pres"/> -->
13659
+ <xsl:template match="*[local-name() = 'admitted']" mode="update_xml_pres"/>
13660
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_step1"/> -->
13661
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_step1"/>
13662
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_step1"/>
13663
+ <!-- <xsl:template match="*[local-name() = 'deprecates'][following-sibling::*[not(local-name() = 'deprecates')][1][local-name() = 'fmt-deprecates']]" mode="update_xml_pres"/> -->
13664
+ <xsl:template match="*[local-name() = 'deprecates']" mode="update_xml_pres"/>
13665
+ <xsl:template match="*[local-name() = 'related']" mode="update_xml_pres"/>
13666
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_step1"/> -->
13667
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_step1"/>
13668
+ <!-- <xsl:template match="*[local-name() = 'definition'][following-sibling::*[1][local-name() = 'fmt-definition']]" mode="update_xml_pres"/> -->
13669
+ <xsl:template match="*[local-name() = 'definition']" mode="update_xml_pres"/>
13670
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_step1"/> -->
13671
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_step1"/>
13672
+ <!-- <xsl:template match="*[local-name() = 'termsource'][following-sibling::*[1][local-name() = 'fmt-termsource']]" mode="update_xml_pres"/> -->
13673
+ <xsl:template match="*[local-name() = 'termsource']" mode="update_xml_pres"/>
13674
+
13675
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_step1"/>
13676
+ <xsl:template match="*[local-name() = 'term'][@unnumbered = 'true'][not(.//*[starts-with(local-name(), 'fmt-')])]" mode="update_xml_pres"/>
13624
13677
 
13625
13678
  <xsl:template match="*[local-name() = 'p'][@type = 'section-title' or @type = 'floating-title'][preceding-sibling::*[1][local-name() = 'section-title']]" mode="update_xml_step1">
13626
13679
  <xsl:copy>
@@ -13665,6 +13718,94 @@
13665
13718
  </xsl:element>
13666
13719
  </xsl:template>
13667
13720
 
13721
+ <xsl:template match="*[local-name() = 'fmt-preferred']"/>
13722
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
13723
+ <xsl:apply-templates mode="update_xml_step1"/>
13724
+ </xsl:template>
13725
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_step1">
13726
+ <xsl:element name="preferred" namespace="{$namespace_full}">
13727
+ <xsl:copy-of select="@*"/>
13728
+ <xsl:apply-templates mode="update_xml_step1"/>
13729
+ </xsl:element>
13730
+ </xsl:template>
13731
+ <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_pres">
13732
+ <xsl:apply-templates mode="update_xml_pres"/>
13733
+ </xsl:template>
13734
+ <xsl:template match="*[local-name() = 'fmt-preferred'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-preferred']/*[local-name() = 'p']" mode="update_xml_pres">
13735
+ <xsl:element name="preferred" namespace="{$namespace_full}">
13736
+ <xsl:copy-of select="@*"/>
13737
+ <xsl:apply-templates mode="update_xml_pres"/>
13738
+ </xsl:element>
13739
+ </xsl:template>
13740
+
13741
+ <xsl:template match="*[local-name() = 'fmt-admitted']"/>
13742
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_step1">
13743
+ <xsl:apply-templates mode="update_xml_step1"/>
13744
+ </xsl:template>
13745
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_step1">
13746
+ <xsl:element name="admitted" namespace="{$namespace_full}">
13747
+ <xsl:copy-of select="@*"/>
13748
+ <xsl:apply-templates mode="update_xml_step1"/>
13749
+ </xsl:element>
13750
+ </xsl:template>
13751
+ <xsl:template match="*[local-name() = 'fmt-admitted'][*[local-name() = 'p']]" mode="update_xml_pres">
13752
+ <xsl:apply-templates mode="update_xml_pres"/>
13753
+ </xsl:template>
13754
+ <xsl:template match="*[local-name() = 'fmt-admitted'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-admitted']/*[local-name() = 'p']" mode="update_xml_pres">
13755
+ <xsl:element name="admitted" namespace="{$namespace_full}">
13756
+ <xsl:copy-of select="@*"/>
13757
+ <xsl:apply-templates mode="update_xml_pres"/>
13758
+ </xsl:element>
13759
+ </xsl:template>
13760
+
13761
+ <xsl:template match="*[local-name() = 'fmt-deprecates']"/>
13762
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_step1">
13763
+ <xsl:apply-templates mode="update_xml_step1"/>
13764
+ </xsl:template>
13765
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_step1">
13766
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
13767
+ <xsl:copy-of select="@*"/>
13768
+ <xsl:apply-templates mode="update_xml_step1"/>
13769
+ </xsl:element>
13770
+ </xsl:template>
13771
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][*[local-name() = 'p']]" mode="update_xml_pres">
13772
+ <xsl:apply-templates mode="update_xml_pres"/>
13773
+ </xsl:template>
13774
+ <xsl:template match="*[local-name() = 'fmt-deprecates'][not(*[local-name() = 'p'])] | *[local-name() = 'fmt-deprecates']/*[local-name() = 'p']" mode="update_xml_pres">
13775
+ <xsl:element name="deprecates" namespace="{$namespace_full}">
13776
+ <xsl:copy-of select="@*"/>
13777
+ <xsl:apply-templates mode="update_xml_pres"/>
13778
+ </xsl:element>
13779
+ </xsl:template>
13780
+
13781
+ <xsl:template match="*[local-name() = 'fmt-definition']"/>
13782
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_step1">
13783
+ <xsl:element name="definition" namespace="{$namespace_full}">
13784
+ <xsl:copy-of select="@*"/>
13785
+ <xsl:apply-templates mode="update_xml_step1"/>
13786
+ </xsl:element>
13787
+ </xsl:template>
13788
+ <xsl:template match="*[local-name() = 'fmt-definition']" mode="update_xml_pres">
13789
+ <xsl:element name="definition" namespace="{$namespace_full}">
13790
+ <xsl:copy-of select="@*"/>
13791
+ <xsl:apply-templates mode="update_xml_pres"/>
13792
+ </xsl:element>
13793
+ </xsl:template>
13794
+
13795
+ <xsl:template match="*[local-name() = 'fmt-termsource']"/>
13796
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_step1">
13797
+ <xsl:element name="termsource" namespace="{$namespace_full}">
13798
+ <xsl:copy-of select="@*"/>
13799
+ <xsl:apply-templates mode="update_xml_step1"/>
13800
+ </xsl:element>
13801
+ </xsl:template>
13802
+ <xsl:template match="*[local-name() = 'fmt-termsource']" mode="update_xml_pres">
13803
+ <xsl:element name="termsource" namespace="{$namespace_full}">
13804
+ <xsl:copy-of select="@*"/>
13805
+ <xsl:apply-templates mode="update_xml_pres"/>
13806
+ </xsl:element>
13807
+ </xsl:template>
13808
+
13668
13809
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
13669
13810
  <xsl:apply-templates mode="update_xml_step1"/>
13670
13811
  </xsl:template>
@@ -14803,7 +14944,7 @@
14803
14944
  </xsl:template>
14804
14945
 
14805
14946
  <xsl:template name="namespaceCheck">
14806
- <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
14947
+ <xsl:variable name="documentNS" select="$namespace_full"/> <!-- namespace-uri(/*) -->
14807
14948
  <xsl:variable name="XSLNS">
14808
14949
 
14809
14950
  <xsl:value-of select="document('')//*/namespace::iec"/>
@@ -14893,6 +15034,9 @@
14893
15034
  <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
14894
15035
  <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14895
15036
  </xsl:when>
15037
+ <xsl:when test="string-length($bibdata_updated) != ''">
15038
+ <xsl:value-of select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
15039
+ </xsl:when>
14896
15040
  <xsl:when test="$formatted = 'true'">
14897
15041
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14898
15042
  </xsl:when>
@@ -39,13 +39,14 @@ module IsoDoc
39
39
  def terms(docxml)
40
40
  otherlang_designations(docxml)
41
41
  super
42
+ remove_otherlang_designations(docxml)
42
43
  merge_fr_into_en_term(docxml)
43
44
  end
44
45
 
45
- def termdomain(elem)
46
+ def termdomain(elem, fmt_defn)
46
47
  if @is_iev
47
- d = elem.at(ns("./domain")) or return
48
- d["hidden"] = true
48
+ #d = elem.at(ns("./domain")) or return
49
+ #d["hidden"] = true
49
50
  else super
50
51
  end
51
52
  end
@@ -55,17 +56,21 @@ module IsoDoc
55
56
  docxml.xpath(ns("//term[@language = 'en'][@tag]")).each do |en|
56
57
  fr = docxml.at(ns("//term[@language = 'fr'][@tag = '#{en['tag']}']"))
57
58
  merge_fr_into_en_term1(en, fr) if fr
58
- en.xpath(ns("./fmt-name | ./fmt-xref-label")).each(&:remove)
59
- term1(en)
60
59
  end
60
+ # renumber
61
61
  @xrefs.parse_inclusions(clauses: true).parse docxml
62
- #docxml.xpath(ns("//term/fmt-name | //term/fmt-xref")).each(&:remove)
63
- #term(docxml)
62
+ docxml.xpath(ns("//term/fmt-name | //term/fmt-xref-label")).each(&:remove)
63
+ term(docxml)
64
64
  end
65
65
 
66
66
  def merge_fr_into_en_term1(en_term, fr_term)
67
67
  dl = en_term&.at(ns("./dl[@type = 'other-lang']"))&.remove
68
- en_term << fr_term.remove.children
68
+ #en_term << fr_term.remove.children
69
+ dup = semx_fmt_dup(fr_term)
70
+ dup.xpath(ns("./fmt-name | ./fmt-xref-label")).each(&:remove)
71
+ en_term << dup
72
+ fr_term.xpath(ns(".//fmt-name | .//fmt-xref-label | .//fmt-preferred | .//fmt-admitted | .//fmt-deprecates | .//fmt-definition | .//fmt-related | .//fmt-termsource")).each(&:remove)
73
+ fr_term["unnumbered"] = "true"
69
74
  en_term << dl if dl
70
75
  en_term["language"] = "en,fr"
71
76
  en_term.delete("tag")
@@ -78,6 +83,14 @@ module IsoDoc
78
83
  end
79
84
  end
80
85
 
86
+ def remove_otherlang_designations(docxml)
87
+ @is_iev or return
88
+ docxml.xpath(ns("//term")).each do |t|
89
+ remove_otherlang_designations1(t, t["language"]&.split(",") || %w(en fr))
90
+ end
91
+ end
92
+
93
+ # KILL
81
94
  def extract_otherlang_designations(term, lgs)
82
95
  term.xpath(ns(".//preferred/expression[@language]"))
83
96
  .each_with_object([]) do |d, m|
@@ -85,12 +98,26 @@ module IsoDoc
85
98
  d.delete("language")
86
99
  lgs.include?(lg) and next
87
100
  p = d.parent
88
- designation_annotate(p, d.at(ns("./name")))
101
+ designation_annotate(p, p.at(ns("./name")))
89
102
  m << { lang: lg, script: Metanorma::Utils.default_script(lg),
90
103
  designation: to_xml(l10n_recursive(p.remove, lg)).strip }
91
104
  end
92
105
  end
93
106
 
107
+ def extract_otherlang_designations(term, lgs)
108
+ term.xpath(ns(".//preferred/expression[@language]"))
109
+ .each_with_object([]) do |d, m|
110
+ lg = d["language"]
111
+ lgs.include?(lg) and next
112
+ p = semx_fmt_dup(d.parent)
113
+ e = p.at(ns("./expression"))
114
+ e.delete("language")
115
+ designation_annotate(p, p.at(ns(".//name")), d.parent)
116
+ m << { lang: lg, script: Metanorma::Utils.default_script(lg),
117
+ designation: to_xml(l10n_recursive(p, lg)).strip }
118
+ end
119
+ end
120
+
94
121
  def l10n_recursive(xml, lang)
95
122
  script = Metanorma::Utils.default_script(lang)
96
123
  c = HTMLEntities.new
@@ -125,18 +152,36 @@ module IsoDoc
125
152
  term << "<dl type='other-lang'>#{prefs.join}</dl>"
126
153
  end
127
154
 
155
+ def remove_otherlang_designations1(term, lgs)
156
+ term.xpath(ns(".//fmt-preferred/p/semx[@element = 'preferred']")).each do |s|
157
+ p = semx_orig(s, term)
158
+ lg = p.at(ns("./expression/@language"))&.text or next
159
+ lgs.include?(lg) and next
160
+ s.parent.remove
161
+ end
162
+ end
163
+
128
164
  def related(docxml)
129
- docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
165
+ #docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
130
166
  super
167
+ docxml.xpath(ns("//term[related]")).each { |f| move_related(f) }
131
168
  end
132
169
 
133
- def move_related(term)
170
+ # KILL
171
+ def move_related(term)
134
172
  defn = term.at(ns("./definition")) or return
135
173
  term.xpath(ns("./related")).reverse_each do |r|
136
174
  defn.next = r.remove
137
175
  end
138
176
  end
139
177
 
178
+ def move_related(term)
179
+ defn = term.at(ns("./fmt-definition")) or return
180
+ rel = term.at(ns("./fmt-related")) or return
181
+ defn << rel.children
182
+ end
183
+
184
+ # KILL
140
185
  def related1(node)
141
186
  lg = node.at("./ancestor::xmlns:term/@language")&.text
142
187
  @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
@@ -148,6 +193,16 @@ module IsoDoc
148
193
  @i18n = @i18n_lg["default"]
149
194
  end
150
195
 
196
+ def related1(node)
197
+ lg = node.at("./ancestor::xmlns:term/@language")&.text
198
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
199
+ p, ref, orig = related1_prep(node)
200
+ label = @i18n.relatedterms[orig["type"]].upcase
201
+ node.children =(l10n("<p>#{label}: " \
202
+ "#{to_xml(p)} (#{Common::to_xml(ref)})</p>"))
203
+ @i18n = @i18n_lg["default"]
204
+ end
205
+
151
206
  def termsource_modification(node)
152
207
  lg = node&.at("./ancestor::xmlns:term/@language")&.text
153
208
  @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
@@ -155,7 +210,8 @@ module IsoDoc
155
210
  @i18n = @i18n_lg["default"]
156
211
  end
157
212
 
158
- def termsource1(node)
213
+ # KILL
214
+ def termsource1xx(node)
159
215
  lg = node&.at("./ancestor::xmlns:term/@language")&.text
160
216
  @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
161
217
  if @is_iev then termsource1_iev(node)
@@ -164,6 +220,7 @@ module IsoDoc
164
220
  @i18n = @i18n_lg["default"]
165
221
  end
166
222
 
223
+ # KILL
167
224
  def termsource1_iev(elem)
168
225
  while elem&.next_element&.name == "termsource"
169
226
  elem << "; #{to_xml(elem.next_element.remove.children)}"
@@ -171,6 +228,14 @@ module IsoDoc
171
228
  elem.children = l10n("#{@i18n.source}: #{to_xml(elem.children).strip}")
172
229
  end
173
230
 
231
+ def termsource_label(elem, sources)
232
+ @is_iev or return super
233
+ lg = elem&.at("./ancestor::xmlns:term/@language")&.text
234
+ @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
235
+ elem.replace(l10n("#{@i18n.source}: #{sources}"))
236
+ @i18n = @i18n_lg["default"]
237
+ end
238
+
174
239
  def termexample(docxml)
175
240
  docxml.xpath(ns("//termexample")).each do |f|
176
241
  termexample1(f)
@@ -32,10 +32,13 @@ module IsoDoc
32
32
  #xref: l10n("#{@labels['section_iev']} #{num}"),
33
33
  xref: labelled_autonum(@labels['section_iev'], num),
34
34
  level: 2, type: "clause", elem: @labels["section_iev"] }
35
- t.xpath(ns("./term")).each_with_index do |c, j|
35
+ j = 0
36
+ t.xpath(ns("./term")).each do |c|
37
+ c["unnumbered"] == "true" and next
36
38
  num2 = semx(c, "%02d" % [j + 1])
37
39
  #section_names1(c, "#{num}#{delim_wrap("-")}#{num2}", 3)
38
40
  section_names1(c, num, num2, 3)
41
+ j += 1
39
42
  end
40
43
  end
41
44
  end
@@ -1277,17 +1277,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1277
1277
  </define>
1278
1278
  <define name="validityBegins">
1279
1279
  <element name="validityBegins">
1280
- <ref name="ISO8601DateTime"/>
1280
+ <ref name="ISO8601Date"/>
1281
1281
  </element>
1282
1282
  </define>
1283
1283
  <define name="validityEnds">
1284
1284
  <element name="validityEnds">
1285
- <ref name="ISO8601DateTime"/>
1285
+ <ref name="ISO8601Date"/>
1286
1286
  </element>
1287
1287
  </define>
1288
1288
  <define name="validityRevision">
1289
1289
  <element name="revision">
1290
- <ref name="ISO8601DateTime"/>
1290
+ <ref name="ISO8601Date"/>
1291
1291
  </element>
1292
1292
  </define>
1293
1293
  <define name="TypedTitleString">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.5.11".freeze
3
+ VERSION = "2.5.12".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.11
4
+ version: 2.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-07 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso