metanorma-iec 2.5.10 → 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: 377a97d5152785fc4d78b5020b3a4f7a377f1ecffe98ded9da290644a6a43a43
4
- data.tar.gz: 1e9c8b5ec23a5994ad9614b4bc70f8b9e17dd45fe60135450a85ebfd0a2b90e4
3
+ metadata.gz: 293aedaf5e38a5a6144556ee13fffdc271e4477c945cd681728e5e9e9154c01f
4
+ data.tar.gz: 79a0643a146fe752e1895523068f2589da742e391ff1596cb00aabae692e3a59
5
5
  SHA512:
6
- metadata.gz: d29a964bc22ca2df50b19b4fbb157138a70eeca0a2875d93a16d3476c308a4c51c09aa8b1f6ab99c51af4857a24d08905241aed15a1b610316fc873859563c3c
7
- data.tar.gz: 146f19269c143da797305d34b55700c7456813f1d054e0b4c51dd9dd27898dd0b8e70c3bde5a81f183c84f1b53a6652430823e641e4f2e95cc8e8f22791af881
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"
@@ -2172,8 +2172,21 @@
2172
2172
 
2173
2173
  <!-- <xsl:strip-space elements="iec:xref"/> -->
2174
2174
 
2175
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
2176
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
2175
+ <xsl:variable name="namespace_full_">
2176
+ <xsl:choose>
2177
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
2178
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
2179
+ </xsl:choose>
2180
+ </xsl:variable>
2181
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
2182
+
2183
+ <xsl:variable name="root_element_">
2184
+ <xsl:choose>
2185
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
2186
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
2187
+ </xsl:choose>
2188
+ </xsl:variable>
2189
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
2177
2190
 
2178
2191
  <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
2179
2192
 
@@ -3390,6 +3403,9 @@
3390
3403
 
3391
3404
  </xsl:attribute-set>
3392
3405
 
3406
+ <xsl:attribute-set name="related-block-style" use-attribute-sets="preferred-block-style">
3407
+ </xsl:attribute-set>
3408
+
3393
3409
  <xsl:attribute-set name="definition-style">
3394
3410
 
3395
3411
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
@@ -5719,7 +5735,9 @@
5719
5735
  <xsl:with-param name="element">
5720
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 -->
5721
5737
  <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5738
+
5722
5739
  <xsl:copy-of select="$current_fn_number_text"/>
5740
+
5723
5741
  </fo:inline>
5724
5742
  </fo:basic-link>
5725
5743
  </xsl:with-param>
@@ -5738,8 +5756,7 @@
5738
5756
 
5739
5757
  <fo:block-container xsl:use-attribute-sets="fn-container-body-style" role="SKIP">
5740
5758
 
5741
- <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
5742
-
5759
+ <xsl:variable name="fn_block">
5743
5760
  <xsl:call-template name="refine_fn-body-style"/>
5744
5761
 
5745
5762
  <fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style" role="Lbl">
@@ -5747,9 +5764,15 @@
5747
5764
  <xsl:call-template name="refine_fn-body-num-style"/>
5748
5765
 
5749
5766
  <xsl:value-of select="$current_fn_number_text"/>
5767
+
5750
5768
  </fo:inline>
5751
5769
  <xsl:apply-templates/>
5752
- </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
+
5753
5776
  </fo:block-container>
5754
5777
  </fo:footnote-body>
5755
5778
  </fo:footnote>
@@ -7151,6 +7174,12 @@
7151
7174
  </xsl:if>
7152
7175
  </xsl:template>
7153
7176
 
7177
+ <xsl:template match="*[local-name()='strike']">
7178
+ <fo:inline text-decoration="line-through">
7179
+ <xsl:apply-templates/>
7180
+ </fo:inline>
7181
+ </xsl:template>
7182
+
7154
7183
  <xsl:template match="*[local-name() = 'pagebreak']">
7155
7184
  <fo:block break-after="page"/>
7156
7185
  <fo:block> </fo:block>
@@ -11885,14 +11914,17 @@
11885
11914
  </fo:block>
11886
11915
  </xsl:template>
11887
11916
 
11888
- <xsl:template match="*[local-name() = 'domain']">
11917
+ <!-- <xsl:template match="*[local-name() = 'domain']"> -->
11889
11918
  <!-- https://github.com/metanorma/isodoc/issues/607
11890
11919
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
11891
11920
  <xsl:text> </xsl:text> -->
11892
- <xsl:if test="not(@hidden = 'true')">
11921
+ <!-- <xsl:if test="not(@hidden = 'true')">
11893
11922
  <xsl:apply-templates/>
11894
11923
  </xsl:if>
11895
- </xsl:template>
11924
+ </xsl:template> -->
11925
+
11926
+ <!-- https://github.com/metanorma/isodoc/issues/632#issuecomment-2567163931 -->
11927
+ <xsl:template match="*[local-name() = 'domain']"/>
11896
11928
 
11897
11929
  <xsl:template match="*[local-name() = 'admitted']">
11898
11930
  <fo:block xsl:use-attribute-sets="admitted-style">
@@ -11907,9 +11939,11 @@
11907
11939
  </xsl:template>
11908
11940
 
11909
11941
  <xsl:template name="setStyle_preferred">
11910
- <xsl:if test="*[local-name() = 'strong']">
11911
- <xsl:attribute name="font-weight">normal</xsl:attribute>
11912
- </xsl:if>
11942
+
11943
+ <xsl:if test="*[local-name() = 'strong']">
11944
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
11945
+ </xsl:if>
11946
+
11913
11947
  </xsl:template>
11914
11948
 
11915
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. -->
@@ -11919,6 +11953,17 @@
11919
11953
  </xsl:template>
11920
11954
  <!-- End Preferred, admitted, deprecated -->
11921
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
+
11922
11967
  <!-- ========== -->
11923
11968
  <!-- definition -->
11924
11969
  <!-- ========== -->
@@ -12829,6 +12874,7 @@
12829
12874
 
12830
12875
  <!-- Normative references -->
12831
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 -->
12832
12878
 
12833
12879
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
12834
12880
 
@@ -13545,7 +13591,8 @@
13545
13591
  <!-- add @id - first element with @id plus '_element_name' -->
13546
13592
  <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
13547
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>
13548
- <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>
13549
13596
  </xsl:if>
13550
13597
  </xsl:template>
13551
13598
 
@@ -13602,6 +13649,31 @@
13602
13649
  <xsl:template match="*[local-name() = 'name'][following-sibling::*[1][local-name() = 'fmt-name']]" mode="update_xml_pres"/>
13603
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"/>
13604
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"/>
13605
13677
 
13606
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">
13607
13679
  <xsl:copy>
@@ -13646,6 +13718,94 @@
13646
13718
  </xsl:element>
13647
13719
  </xsl:template>
13648
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
+
13649
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">
13650
13810
  <xsl:apply-templates mode="update_xml_step1"/>
13651
13811
  </xsl:template>
@@ -14784,7 +14944,7 @@
14784
14944
  </xsl:template>
14785
14945
 
14786
14946
  <xsl:template name="namespaceCheck">
14787
- <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
14947
+ <xsl:variable name="documentNS" select="$namespace_full"/> <!-- namespace-uri(/*) -->
14788
14948
  <xsl:variable name="XSLNS">
14789
14949
 
14790
14950
  <xsl:value-of select="document('')//*/namespace::iec"/>
@@ -14874,6 +15034,9 @@
14874
15034
  <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
14875
15035
  <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14876
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>
14877
15040
  <xsl:when test="$formatted = 'true'">
14878
15041
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14879
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
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -1271,17 +1277,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1271
1277
  </define>
1272
1278
  <define name="validityBegins">
1273
1279
  <element name="validityBegins">
1274
- <ref name="ISO8601DateTime"/>
1280
+ <ref name="ISO8601Date"/>
1275
1281
  </element>
1276
1282
  </define>
1277
1283
  <define name="validityEnds">
1278
1284
  <element name="validityEnds">
1279
- <ref name="ISO8601DateTime"/>
1285
+ <ref name="ISO8601Date"/>
1280
1286
  </element>
1281
1287
  </define>
1282
1288
  <define name="validityRevision">
1283
1289
  <element name="revision">
1284
- <ref name="ISO8601DateTime"/>
1290
+ <ref name="ISO8601Date"/>
1285
1291
  </element>
1286
1292
  </define>
1287
1293
  <define name="TypedTitleString">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.5.10".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.10
4
+ version: 2.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-23 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
@@ -273,7 +273,7 @@ homepage: https://github.com/metanorma/metanorma-iec
273
273
  licenses:
274
274
  - BSD-2-Clause
275
275
  metadata: {}
276
- post_install_message:
276
+ post_install_message:
277
277
  rdoc_options: []
278
278
  require_paths:
279
279
  - lib
@@ -289,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  version: '0'
290
290
  requirements: []
291
291
  rubygems_version: 3.3.27
292
- signing_key:
292
+ signing_key:
293
293
  specification_version: 4
294
294
  summary: metanorma-iec lets you write IEC standards in AsciiDoc.
295
295
  test_files: []