metanorma-ietf 3.0.14 → 3.1.0

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: 40e5744277a667f2a455b01732d3046b971b970f5595699b70d538878d12955c
4
- data.tar.gz: bef96ca465afbff1b334559292519dd87078f16339ad92195572376e4edd04bf
3
+ metadata.gz: 43f207305bf9db4f24f830dca4e8b4eddc49ccc550704c65f091111225339a5b
4
+ data.tar.gz: fa78827c2391a0c0b4a2b788771da05bed92fae965f8b4a0a944b51a525a1fa2
5
5
  SHA512:
6
- metadata.gz: a49bc780a557a34b826081241e1b65f8a726b8110f3ef6fe847e3d2e17836471b0fb83579d45d9c8c124997887f124b9adb1fba487ff91d429426fd75a6c00d0
7
- data.tar.gz: 053710a2bd8ee14940755433d5daeab3542863d3e1fe467470042a72c44220dc5c526850b2b0120bcfc4237d7000e4089f2203e48529219ab4fe7133ae20f8b9
6
+ metadata.gz: dbb040f4b685c29ee35bccff130f061fdb5665542425ca18aeb366e09afdf39dd645edf0b8bbac2eaa4ffd88f09d27fa65578002d08f13ff52d084b5fe3b81ff
7
+ data.tar.gz: 0221363b8c7b38fb0ba2765ebfaec2312e2868a7c75c59508049bc0d8191e34a226cbb7ec229e066283d20ddb3aefcef69c776ef7095599619431955ecbdd6f7
data/.gitignore CHANGED
@@ -19,7 +19,6 @@
19
19
 
20
20
  .rubocop-https--*
21
21
 
22
- /Gemfile.devel
23
22
  /Gemfile.lock
24
23
  /test.err
25
24
  /test.rfc.xml.err
@@ -99,9 +99,9 @@ module IsoDoc
99
99
  c = a&.xpath("./following-sibling::*")&.remove
100
100
  a = a.remove
101
101
  name and f << name
102
- b.empty? or f << "<preamble>#{b.to_xml}</preamble>"
102
+ b.empty? or f << "<preamble>#{to_xml(b)}</preamble>"
103
103
  a and f << a
104
- c.empty? or f << "<postamble>#{c.to_xml}</postamble>"
104
+ c.empty? or f << "<postamble>#{to_xml(c)}</postamble>"
105
105
  end
106
106
  end
107
107
 
@@ -127,11 +127,11 @@ module IsoDoc
127
127
  # for markup in pseudocode
128
128
  def sourcecode_cleanup(docxml)
129
129
  docxml.xpath("//sourcecode").each do |s|
130
- s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n")
130
+ s.children = to_xml(s.children).gsub(%r{<br/>\n}, "\n")
131
131
  .gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
132
132
  sourcecode_remove_markup(s)
133
- s.children = "<![CDATA[#{HTMLEntities.new.decode(s
134
- .children.to_xml.sub(/\A\n+/, ''))}]]>"
133
+ s.children = "<![CDATA[#{HTMLEntities.new.decode(to_xml(s
134
+ .children).sub(/\A\n+/, ''))}]]>"
135
135
  end
136
136
  end
137
137
 
@@ -14,7 +14,7 @@ module IsoDoc
14
14
  def footnote_cleanup(docxml)
15
15
  fn = footnote_refs_cleanup(docxml)
16
16
  endnotes = make_endnotes(docxml)
17
- docxml.xpath("//section[descendant::fn] | "\
17
+ docxml.xpath("//section[descendant::fn] | " \
18
18
  "//abstract[descendant::fn]").each do |s|
19
19
  s.xpath(".//fn").each do |f|
20
20
  ref = f.at(".//ref") and ref.replace("[#{fn[ref.text]}] ")
@@ -2,6 +2,7 @@ module IsoDoc::Ietf
2
2
  class RfcConvert < ::IsoDoc::Convert
3
3
  def footnote_parse(node, out)
4
4
  return table_footnote_parse(node, out) if @in_table || @in_figure
5
+
5
6
  fn = node["reference"]
6
7
  out.fnref fn
7
8
  make_local_footnote(node, fn, out)
@@ -9,6 +10,7 @@ module IsoDoc::Ietf
9
10
 
10
11
  def make_local_footnote(node, fn, out)
11
12
  return if @seen_footnote.include?(fn)
13
+
12
14
  @in_footnote = true
13
15
  out << make_generic_footnote_text(node, fn)
14
16
  @in_footnote = false
@@ -18,13 +20,13 @@ module IsoDoc::Ietf
18
20
  def make_generic_footnote_text(node, fnref)
19
21
  first = node.first_element_child
20
22
  noko do |xml|
21
- xml.fn do |div|
23
+ xml.fn do |_div|
22
24
  xml.t **attr_code(anchor: first ? first["id"] : nil) do |div|
23
25
  div.ref fnref
24
26
  first.name == "p" and first.children.each { |n| parse(n, div) }
25
27
  end
26
- first.name == "p" and
27
- node.elements.drop(1).each { |n| parse(n, xml) } or
28
+ (first.name == "p" and
29
+ node.elements.drop(1).each { |n| parse(n, xml) }) or
28
30
  node.children.each { |n| parse(n, xml) }
29
31
  end
30
32
  end.join
@@ -36,6 +38,7 @@ module IsoDoc::Ietf
36
38
  make_table_footnote_link(out, tid + fn, fn)
37
39
  # do not output footnote text if we have already seen it for this table
38
40
  return if @seen_footnote.include?(tid + fn)
41
+
39
42
  @in_footnote = true
40
43
  out.fn do |a|
41
44
  a << make_table_footnote_text(node, tid + fn, fn)
@@ -44,19 +47,19 @@ module IsoDoc::Ietf
44
47
  @seen_footnote << (tid + fn)
45
48
  end
46
49
 
47
- def make_table_footnote_link(out, fnid, fnref)
50
+ def make_table_footnote_link(out, _fnid, fnref)
48
51
  out << " [#{fnref}]"
49
52
  end
50
53
 
51
- def make_table_footnote_text(node, fnid, fnref)
54
+ def make_table_footnote_text(node, _fnid, fnref)
52
55
  first = node.first_element_child
53
56
  noko do |xml|
54
57
  xml.t **attr_code(anchor: first ? first["id"] : nil) do |div|
55
58
  div << "[#{fnref}] "
56
59
  first.name == "p" and first.children.each { |n| parse(n, div) }
57
60
  end
58
- first.name == "p" and
59
- node.elements.drop(1).each { |n| parse(n, xml) } or
61
+ (first.name == "p" and
62
+ node.elements.drop(1).each { |n| parse(n, xml) }) or
60
63
  node.children.each { |n| parse(n, xml) }
61
64
  end.join
62
65
  end
@@ -64,6 +67,7 @@ module IsoDoc::Ietf
64
67
  def get_table_ancestor_id(node)
65
68
  table = node.ancestors("table") || node.ancestors("figure")
66
69
  return UUIDTools::UUID.random_create.to_s if table.empty?
70
+
67
71
  table.last["id"]
68
72
  end
69
73
  end
@@ -112,7 +112,7 @@ module IsoDoc
112
112
  end
113
113
  contents = no_loc_contents.select { |c| !c.text? || /\S/.match(c) }
114
114
  !contents.empty? and
115
- return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
115
+ return to_xml(Nokogiri::XML::NodeSet.new(node.document, contents))
116
116
  ""
117
117
  end
118
118
 
@@ -120,19 +120,27 @@ module IsoDoc
120
120
  linkend = node.children.reject do |c|
121
121
  %w{locality localityStack}.include? c.name
122
122
  end
123
- relative = node["relative"] ||
124
- node.at(ns(".//locality[@type = 'anchor']/referenceFrom"))&.text || ""
125
- section = @isodoc.eref_localities(
126
- node.xpath(ns("./locality | ./localityStack")), nil, node
127
- )&.sub(/^,/, "")&.sub(/^\s*(Section|Clause)/, "")&.strip&.sub(/,$/, "") || ""
128
123
  # section = "" unless relative.empty?
129
- out.relref **attr_code(target: node["bibitemid"], section: section,
130
- relative: relative,
124
+ out.relref **attr_code(target: node["bibitemid"],
125
+ section: eref_section(node),
126
+ relative: eref_relative(node),
131
127
  displayFormat: node["displayFormat"]) do |l|
132
128
  linkend.each { |n| parse(n, l) }
133
129
  end
134
130
  end
135
131
 
132
+ def eref_relative(node)
133
+ node["relative"] ||
134
+ node.at(ns(".//locality[@type = 'anchor']/referenceFrom"))&.text || ""
135
+ end
136
+
137
+ def eref_section(node)
138
+ @isodoc.eref_localities(
139
+ node.xpath(ns("./locality | ./localityStack")), nil, node
140
+ )&.sub(/^,/, "")&.sub(/^\s*(Sections?|Clauses?)/, "")&.strip
141
+ &.sub(/,$/, "") || ""
142
+ end
143
+
136
144
  def index_parse(node, out)
137
145
  out.iref nil, **attr_code(item: node.at(ns("./primary")).text,
138
146
  primary: node["primary"],
@@ -683,6 +683,9 @@
683
683
  </define>
684
684
  <define name="underline">
685
685
  <element name="underline">
686
+ <optional>
687
+ <attribute name="style"/>
688
+ </optional>
686
689
  <zeroOrMore>
687
690
  <ref name="PureTextElement"/>
688
691
  </zeroOrMore>
@@ -47,7 +47,7 @@
47
47
  </element>
48
48
  </define>
49
49
  <define name="DocumentType">
50
- <value>document</value>
50
+ <text/>
51
51
  </define>
52
52
  <define name="docsubtype">
53
53
  <element name="subdoctype">
@@ -2653,6 +2653,7 @@
2653
2653
  <value>full</value>
2654
2654
  <value>short</value>
2655
2655
  <value>id</value>
2656
+ <value>modspec</value>
2656
2657
  </choice>
2657
2658
  </define>
2658
2659
  <define name="erefTypeWithConnective">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "3.0.14".freeze
3
+ VERSION = "3.1.0".freeze
4
4
  end
5
5
  end
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
 
39
39
  spec.add_dependency "mathml2asciimath"
40
40
  spec.add_dependency "metanorma-ietf-data"
41
- spec.add_dependency "metanorma-standoc", "~> 2.2.4"
41
+ spec.add_dependency "metanorma-standoc", "~> 2.3.0"
42
42
 
43
43
  spec.add_development_dependency "debug"
44
44
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.14
4
+ version: 3.1.0
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-11-21 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mathml2asciimath
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.2.4
47
+ version: 2.3.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.2.4
54
+ version: 2.3.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: debug
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
293
293
  - !ruby/object:Gem::Version
294
294
  version: '0'
295
295
  requirements: []
296
- rubygems_version: 3.3.7
296
+ rubygems_version: 3.3.26
297
297
  signing_key:
298
298
  specification_version: 4
299
299
  summary: metanorma-ietf lets you write IETF documents, such as Internet-Drafts and