metanorma-ietf 3.0.13 → 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: 39ea21861ccd96e10a9c03dcfa3672df68347437aed1c307680160a402195b4b
4
- data.tar.gz: effa7116f2bf9f02e880e9fd2d478ef140aa45b520dc14d083dd1c6f409dad0f
3
+ metadata.gz: 43f207305bf9db4f24f830dca4e8b4eddc49ccc550704c65f091111225339a5b
4
+ data.tar.gz: fa78827c2391a0c0b4a2b788771da05bed92fae965f8b4a0a944b51a525a1fa2
5
5
  SHA512:
6
- metadata.gz: bdba57407ebf106d7ca311d94dfee3e778e6f1453de5a09772d42e1f696c6b951be24d2b84764d623fe8d9e3b81d192930881b6c9ed2619a630c30c0b52addce
7
- data.tar.gz: f57b8315d127c4f7dacbd295d6a899855d5d4df1ee262a9e0d993b38126c82f8b4c4c7d22529895b0351a44303efb0f8107b2ed2d0d76b4d027e2790db9a900b
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"],
@@ -101,7 +101,7 @@ module IsoDoc
101
101
 
102
102
  def initialize(options)
103
103
  super
104
- @xinclude = options[:use_xinclude] == "true"
104
+ @xinclude = options[:usexinclude]
105
105
  @format = :rfc
106
106
  @suffix = "rfc.xml"
107
107
  @isodoc = IsoDoc::PresentationXMLConvert.new({})
@@ -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">
@@ -159,7 +159,7 @@ module Metanorma
159
159
  end
160
160
 
161
161
  def html_extract_attributes(node)
162
- super.merge(use_xinclude: node.attr("use-xinclude"))
162
+ super.merge(usexinclude: node.attr("use-xinclude"))
163
163
  end
164
164
 
165
165
  def rfc_converter(node)
@@ -1152,7 +1152,7 @@
1152
1152
  <data type="boolean"/>
1153
1153
  </attribute>
1154
1154
  </optional>
1155
- <ref name="BibliographicItem"/>
1155
+ <ref name="ReducedBibliographicItem"/>
1156
1156
  </element>
1157
1157
  </define>
1158
1158
  <define name="image" combine="choice">
@@ -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.13".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.13
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-07 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