metanorma-ieee 1.1.0 → 1.1.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: 6d2fbf6c197a2071d6e49bae6e0b6823b05beb5115c7d01b6e58a1c02c2ce07a
4
- data.tar.gz: 4d350e96e0519df1173631de9360794fe339a13a6045467fa7438748d624e1c2
3
+ metadata.gz: 1a6256a1c2f7a1bc9b09f325c6f0405efb2697524e23511ceafbae690a3eb98b
4
+ data.tar.gz: 5af212c12b8c7cdba8f222ee84f542196d92afd541df56fa4c368cc3f05710fd
5
5
  SHA512:
6
- metadata.gz: b38d012b072d19846919c862a536a4c4e64449bb4c86d84d2f0c606a50425ab591690788cca61079cab673c64addc81605dfd5f704938833abf5206574f9711e
7
- data.tar.gz: a0e2cd0841ab556a314b488bf2a85d52fa2738d5cac35ae13368640e2fd4702622cc211f2980080b6af4882a1ac76720fb1e424d8d913f9af58157419dfbb7fd
6
+ metadata.gz: e85a872ea89629b68849d43ecd9236b7470964893e4d2f7658436b0f61fb84eb9d9f186a3ca19bc4a5b6ee94b272bfeaada0fb48cbc27f12c2303be8827669c9
7
+ data.tar.gz: 2d8911d33ddb39b3ac6f748d78cb6712e98dc945e7175b6b0bf218b1fa667739c1be7c3beba7cafed9e870fc05f2c500ade54a7a7a383d1cc1b60e70f166473c
@@ -4072,11 +4072,26 @@
4072
4072
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
4073
4073
  </xsl:if>
4074
4074
 
4075
- <xsl:value-of select="."/>
4075
+ <xsl:variable name="font_family" select="."/>
4076
4076
 
4077
- <xsl:if test="$additional_fonts != ''">
4078
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4079
- </xsl:if>
4077
+ <xsl:choose>
4078
+ <xsl:when test="$additional_fonts = ''">
4079
+ <xsl:value-of select="$font_family"/>
4080
+ </xsl:when>
4081
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
4082
+ <xsl:choose>
4083
+ <xsl:when test="contains($font_family, ',')">
4084
+ <xsl:value-of select="substring-before($font_family, ',')"/>
4085
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4086
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
4087
+ </xsl:when>
4088
+ <xsl:otherwise>
4089
+ <xsl:value-of select="$font_family"/>
4090
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4091
+ </xsl:otherwise>
4092
+ </xsl:choose>
4093
+ </xsl:otherwise>
4094
+ </xsl:choose>
4080
4095
  </xsl:attribute>
4081
4096
  </xsl:when>
4082
4097
  <xsl:otherwise>
@@ -6684,21 +6699,21 @@
6684
6699
 
6685
6700
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
6686
6701
 
6687
- <fo:block xsl:use-attribute-sets="table-note-style">
6702
+ <fo:block xsl:use-attribute-sets="table-note-style">
6688
6703
 
6689
- <xsl:call-template name="refine_table-note-style"/>
6704
+ <xsl:call-template name="refine_table-note-style"/>
6690
6705
 
6691
- <!-- Table's note/example name (NOTE, for example) -->
6692
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
6706
+ <!-- Table's note/example name (NOTE, for example) -->
6707
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
6693
6708
 
6694
- <xsl:call-template name="refine_table-note-name-style"/>
6709
+ <xsl:call-template name="refine_table-note-name-style"/>
6695
6710
 
6696
- <xsl:apply-templates select="*[local-name() = 'name']"/>
6711
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
6697
6712
 
6698
- </fo:inline>
6713
+ </fo:inline>
6699
6714
 
6700
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6701
- </fo:block>
6715
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6716
+ </fo:block>
6702
6717
 
6703
6718
  </xsl:template> <!-- table/note -->
6704
6719
 
@@ -9816,8 +9831,12 @@
9816
9831
  <xsl:variable name="isAdded" select="../@added"/>
9817
9832
  <xsl:variable name="isDeleted" select="../@deleted"/>
9818
9833
  <xsl:choose>
9819
- <xsl:when test="ancestor::*[local-name() = 'title']">
9834
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
9820
9835
  <fo:inline padding-left="1mm" padding-right="1mm">
9836
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
9837
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
9838
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9839
+ </xsl:if>
9821
9840
  <xsl:variable name="src">
9822
9841
  <xsl:call-template name="image_src"/>
9823
9842
  </xsl:variable>
@@ -9850,7 +9869,7 @@
9850
9869
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
9851
9870
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
9852
9871
 
9853
- <xsl:if test="@width != '' and @width != 'auto'">
9872
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
9854
9873
  <xsl:attribute name="width">
9855
9874
  <xsl:value-of select="@width"/>
9856
9875
  </xsl:attribute>
@@ -4072,11 +4072,26 @@
4072
4072
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
4073
4073
  </xsl:if>
4074
4074
 
4075
- <xsl:value-of select="."/>
4075
+ <xsl:variable name="font_family" select="."/>
4076
4076
 
4077
- <xsl:if test="$additional_fonts != ''">
4078
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4079
- </xsl:if>
4077
+ <xsl:choose>
4078
+ <xsl:when test="$additional_fonts = ''">
4079
+ <xsl:value-of select="$font_family"/>
4080
+ </xsl:when>
4081
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
4082
+ <xsl:choose>
4083
+ <xsl:when test="contains($font_family, ',')">
4084
+ <xsl:value-of select="substring-before($font_family, ',')"/>
4085
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4086
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
4087
+ </xsl:when>
4088
+ <xsl:otherwise>
4089
+ <xsl:value-of select="$font_family"/>
4090
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
4091
+ </xsl:otherwise>
4092
+ </xsl:choose>
4093
+ </xsl:otherwise>
4094
+ </xsl:choose>
4080
4095
  </xsl:attribute>
4081
4096
  </xsl:when>
4082
4097
  <xsl:otherwise>
@@ -6684,21 +6699,21 @@
6684
6699
 
6685
6700
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
6686
6701
 
6687
- <fo:block xsl:use-attribute-sets="table-note-style">
6702
+ <fo:block xsl:use-attribute-sets="table-note-style">
6688
6703
 
6689
- <xsl:call-template name="refine_table-note-style"/>
6704
+ <xsl:call-template name="refine_table-note-style"/>
6690
6705
 
6691
- <!-- Table's note/example name (NOTE, for example) -->
6692
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
6706
+ <!-- Table's note/example name (NOTE, for example) -->
6707
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
6693
6708
 
6694
- <xsl:call-template name="refine_table-note-name-style"/>
6709
+ <xsl:call-template name="refine_table-note-name-style"/>
6695
6710
 
6696
- <xsl:apply-templates select="*[local-name() = 'name']"/>
6711
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
6697
6712
 
6698
- </fo:inline>
6713
+ </fo:inline>
6699
6714
 
6700
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6701
- </fo:block>
6715
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6716
+ </fo:block>
6702
6717
 
6703
6718
  </xsl:template> <!-- table/note -->
6704
6719
 
@@ -9816,8 +9831,12 @@
9816
9831
  <xsl:variable name="isAdded" select="../@added"/>
9817
9832
  <xsl:variable name="isDeleted" select="../@deleted"/>
9818
9833
  <xsl:choose>
9819
- <xsl:when test="ancestor::*[local-name() = 'title']">
9834
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
9820
9835
  <fo:inline padding-left="1mm" padding-right="1mm">
9836
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
9837
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
9838
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9839
+ </xsl:if>
9821
9840
  <xsl:variable name="src">
9822
9841
  <xsl:call-template name="image_src"/>
9823
9842
  </xsl:variable>
@@ -9850,7 +9869,7 @@
9850
9869
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
9851
9870
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
9852
9871
 
9853
- <xsl:if test="@width != '' and @width != 'auto'">
9872
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
9854
9873
  <xsl:attribute name="width">
9855
9874
  <xsl:value-of select="@width"/>
9856
9875
  </xsl:attribute>
@@ -24,6 +24,47 @@ module IsoDoc
24
24
  def fileloc(loc)
25
25
  File.join(File.dirname(__FILE__), loc)
26
26
  end
27
+
28
+ def std_docid_semantic(id)
29
+ id.nil? and return nil
30
+ ret = Nokogiri::XML.fragment(id)
31
+ ret.traverse do |x|
32
+ x.text? or next
33
+ x.replace(std_docid_semantic1(x.text))
34
+ end
35
+ to_xml(ret)
36
+ end
37
+
38
+ def std_docid_semantic1(id)
39
+ ids = id.split(/\p{Zs}/)
40
+ agency?(ids[0].sub(/\/.*$/, "")) or return id
41
+ std_docid_semantic_full(id)
42
+ end
43
+
44
+ # AGENCY+ TYPE NUMBER YEAR
45
+ def std_docid_semantic_full(ident)
46
+ m = ident.match(%r{(?<text>[^0-9]+\p{Zs})
47
+ (?<num>[0-9]+)
48
+ (?:[:](?<yr>(?:19|20)\d\d))?}x)
49
+ m or return ident
50
+ ret = std_docid_sdo(m[:text]) +
51
+ "<span class='std_docNumber'>#{m[:num]}</span>"
52
+ m[:yr] and ret += ":<span class='std_year'>#{m[:yr]}</span>"
53
+ ret
54
+ end
55
+
56
+ def std_docid_sdo(text)
57
+ found = false
58
+ text.split(%r{([\p{Zs}|/]+)}).reverse.map do |x|
59
+ if /[A-Za-z]/.match?(x)
60
+ k = if found || agency?(x) then "std_publisher"
61
+ else "std_documentType"
62
+ end
63
+ found = true
64
+ "<span class='#{k}'>#{x}</span>"
65
+ else x end
66
+ end.reverse.join
67
+ end
27
68
  end
28
69
  end
29
70
  end
@@ -29,7 +29,7 @@ module IsoDoc
29
29
  b.at(ns("./formattedref")))&.text,
30
30
  author: @author[b["id"]] || (b.at(ns("./title")) ||
31
31
  b.at(ns("./formattedref")))&.text,
32
- ord: b.at(ns("./docidentifier[@type = 'metanorma' or "\
32
+ ord: b.at(ns("./docidentifier[@type = 'metanorma' or " \
33
33
  "@type = 'metanorma-ordinal']"))&.text }
34
34
  end
35
35
  end
@@ -78,6 +78,10 @@ module IsoDoc
78
78
  end
79
79
  idx
80
80
  end
81
+
82
+ def expand_citeas(text)
83
+ std_docid_semantic(super)
84
+ end
81
85
  end
82
86
  end
83
87
  end
@@ -79,20 +79,6 @@ module IsoDoc
79
79
  prefix_name(elem, block_delim, lbl, "name")
80
80
  end
81
81
 
82
- def display_order(docxml)
83
- i = 0
84
- i = display_order_xpath(docxml, "//preface/*", i)
85
- i = display_order_at(docxml, "//clause[@type = 'overview']", i)
86
- i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
87
- i = display_order_at(docxml, "//sections/terms | " \
88
- "//sections/clause[descendant::terms]", i)
89
- i = display_order_at(docxml, "//sections/definitions", i)
90
- i = display_order_xpath(docxml, @xrefs.klass.middle_clause(docxml), i)
91
- i = display_order_xpath(docxml, "//annex", i)
92
- i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
93
- display_order_xpath(docxml, "//indexsect", i)
94
- end
95
-
96
82
  def annex1(elem)
97
83
  lbl = @xrefs.anchor(elem["id"], :label)
98
84
  if t = elem.at(ns("./title"))
@@ -11,34 +11,21 @@ module IsoDoc
11
11
  @hierarchical_assets = options[:hierarchicalassets]
12
12
  end
13
13
 
14
- def initial_anchor_names(doc)
15
- if @parse_settings.empty? || @parse_settings[:clauses]
16
- doc.xpath(ns("//preface/*")).each do |c|
17
- c.element? and preface_names(c)
18
- end
19
- end
20
- if @parse_settings.empty?
21
- if @hierarchical_assets
22
- hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
23
- "Preface")
24
- else
25
- sequential_asset_names(doc.xpath(ns("//preface/*")))
26
- end
27
- end
28
- if @parse_settings.empty? || @parse_settings[:clauses]
29
- n = Counter.new
30
- n = section_names(doc.at(ns("//clause[@type = 'overview']")), n, 1)
31
- n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
32
- n = section_names(doc.at(ns("//sections/terms | " \
33
- "//sections/clause[descendant::terms]")), n, 1)
34
- n = section_names(doc.at(ns("//sections/definitions")), n, 1)
35
- clause_names(doc, n)
36
- end
14
+ def clause_order_main(docxml)
15
+ [
16
+ { path: "//clause[@type = 'overview']" },
17
+ { path: @klass.norm_ref_xpath },
18
+ { path: "//sections/terms | " \
19
+ "//sections/clause[descendant::terms]" },
20
+ { path: "//sections/definitions | " \
21
+ "//sections/clause[descendant::definitions][not(descendant::terms)]" },
22
+ { path: @klass.middle_clause(docxml), multi: true },
23
+ ]
37
24
  end
38
25
 
39
26
  def middle_sections
40
27
  " #{@klass.norm_ref_xpath} | " \
41
- "//sections/terms | //preface/clause | " \
28
+ "//sections/terms | " \
42
29
  "//sections/definitions | //clause[parent::sections]"
43
30
  end
44
31
 
@@ -47,10 +34,13 @@ module IsoDoc
47
34
  "#{@klass.norm_ref_xpath} | //sections/terms | " \
48
35
  "//sections/definitions | //clause[parent::sections]"
49
36
  if @hierarchical_assets
37
+ hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
38
+ "Preface")
50
39
  doc.xpath(ns(middle_sections)).each do |c|
51
40
  hierarchical_asset_names(c, @anchors[c["id"]][:label])
52
41
  end
53
42
  else
43
+ sequential_asset_names(doc.xpath(ns("//preface/*")))
54
44
  sequential_asset_names(doc.xpath(ns(middle_sections)))
55
45
  end
56
46
  end
@@ -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.3 -->
20
+ <!-- VERSION v1.2.4 -->
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">
@@ -2068,6 +2068,9 @@
2068
2068
  </define>
2069
2069
  <define name="termdefinition">
2070
2070
  <element name="definition">
2071
+ <optional>
2072
+ <attribute name="type"/>
2073
+ </optional>
2071
2074
  <choice>
2072
2075
  <ref name="verbaldefinition"/>
2073
2076
  <ref name="nonverbalrep"/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IEEE
3
- VERSION = "1.1.0".freeze
3
+ VERSION = "1.1.1".freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
27
27
 
28
- spec.add_dependency "metanorma-standoc", "~> 2.5.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 2.5.4"
29
29
  spec.add_dependency "mnconvert", "~> 1.20"
30
30
  #spec.add_dependency "pubid-ieee", "~> 0.1.1"
31
31
  #spec.add_dependency "pubid-iso", "~> 0.5.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.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: 2023-08-07 00:00:00.000000000 Z
11
+ date: 2023-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.5.0
19
+ version: 2.5.4
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.5.0
26
+ version: 2.5.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement