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 +4 -4
- data/.gitignore +0 -1
- data/lib/isodoc/ietf/cleanup.rb +5 -5
- data/lib/isodoc/ietf/cleanup_inline.rb +1 -1
- data/lib/isodoc/ietf/footnotes.rb +11 -7
- data/lib/isodoc/ietf/inline.rb +16 -8
- data/lib/metanorma/ietf/basicdoc.rng +3 -0
- data/lib/metanorma/ietf/biblio-standoc.rng +1 -1
- data/lib/metanorma/ietf/isodoc.rng +1 -0
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43f207305bf9db4f24f830dca4e8b4eddc49ccc550704c65f091111225339a5b
|
4
|
+
data.tar.gz: fa78827c2391a0c0b4a2b788771da05bed92fae965f8b4a0a944b51a525a1fa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbb040f4b685c29ee35bccff130f061fdb5665542425ca18aeb366e09afdf39dd645edf0b8bbac2eaa4ffd88f09d27fa65578002d08f13ff52d084b5fe3b81ff
|
7
|
+
data.tar.gz: 0221363b8c7b38fb0ba2765ebfaec2312e2868a7c75c59508049bc0d8191e34a226cbb7ec229e066283d20ddb3aefcef69c776ef7095599619431955ecbdd6f7
|
data/.gitignore
CHANGED
data/lib/isodoc/ietf/cleanup.rb
CHANGED
@@ -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
|
102
|
+
b.empty? or f << "<preamble>#{to_xml(b)}</preamble>"
|
103
103
|
a and f << a
|
104
|
-
c.empty? or f << "<postamble>#{c
|
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.
|
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.
|
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 |
|
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,
|
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,
|
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
|
data/lib/isodoc/ietf/inline.rb
CHANGED
@@ -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)
|
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"],
|
130
|
-
|
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"],
|
data/metanorma-ietf.gemspec
CHANGED
@@ -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.
|
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
|
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
|
+
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.
|
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.
|
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.
|
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
|