metanorma-ietf 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/ietf/cleanup.rb +3 -3
- data/lib/isodoc/ietf/front.rb +6 -6
- data/lib/isodoc/ietf/references.rb +4 -6
- data/lib/isodoc/ietf/section.rb +150 -150
- data/lib/metanorma/ietf/basicdoc.rng +0 -1
- data/lib/metanorma/ietf/biblio.rng +11 -1
- data/lib/metanorma/ietf/cleanup.rb +2 -0
- data/lib/metanorma/ietf/isodoc.rng +11 -0
- data/lib/metanorma/ietf/validate.rb +16 -1
- data/lib/metanorma/ietf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6684b3f6e7543eb652b530245313c23cdf5e37694caa7887f8205b701c65445
|
4
|
+
data.tar.gz: e653280e65513f5462f7e24a99d23466148a93f9baa3ee298ead13f15ddd6a1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 210560d5093b93d01276d4c7fc97914b7b4b46f68899262019af3491e680dda0c3155ab9daef7035a7ffc0b6fe90350d291183b6546b844155040f59877a9457
|
7
|
+
data.tar.gz: 17be8103a4b71ab1cde206fdc0429379f803d912332f4adba1a31c36d0d6834d317eb1a89e6d4b603de135570260381327a6a605cf2e79d9da5782931b102fe7
|
data/lib/isodoc/ietf/cleanup.rb
CHANGED
@@ -187,10 +187,10 @@ module IsoDoc
|
|
187
187
|
end
|
188
188
|
|
189
189
|
def aside_cleanup(docxml)
|
190
|
-
docxml.xpath("
|
191
|
-
|
190
|
+
docxml.xpath("//*[aside]").each do |p|
|
191
|
+
%w(section).include?(p.name) and next
|
192
192
|
insert = p
|
193
|
-
p.xpath("
|
193
|
+
p.xpath("./aside").each do |a|
|
194
194
|
insert.next = a.remove
|
195
195
|
insert = insert.next_element
|
196
196
|
end
|
data/lib/isodoc/ietf/front.rb
CHANGED
@@ -26,7 +26,7 @@ module IsoDoc::Ietf
|
|
26
26
|
def output_if_translit(text)
|
27
27
|
return nil if text.nil?
|
28
28
|
|
29
|
-
text.transliterate
|
29
|
+
text.transliterate == text ? nil : text.transliterate
|
30
30
|
end
|
31
31
|
|
32
32
|
def title(_isoxml, front)
|
@@ -45,7 +45,7 @@ module IsoDoc::Ietf
|
|
45
45
|
attr_code(value: @meta.get[:docnumber] || "",
|
46
46
|
asciiValue: output_if_translit(@meta.get[:docnumber]),
|
47
47
|
status: @meta.get[:stage],
|
48
|
-
stream: isoxml&.at(ns("//bibdata/series[@type = 'stream']/"\
|
48
|
+
stream: isoxml&.at(ns("//bibdata/series[@type = 'stream']/" \
|
49
49
|
"title"))&.text)
|
50
50
|
end
|
51
51
|
|
@@ -69,10 +69,10 @@ module IsoDoc::Ietf
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def author(isoxml, front)
|
72
|
-
isoxml.xpath(("//xmlns:bibdata/xmlns:contributor[xmlns:role/@type = "\
|
73
|
-
|
72
|
+
isoxml.xpath(("//xmlns:bibdata/xmlns:contributor[xmlns:role/@type = " \
|
73
|
+
"'author' or xmlns:role/@type = 'editor']")).each do |c|
|
74
74
|
role = c.at(ns("./role/@type")).text == "editor" ? "editor" : nil
|
75
|
-
c.at("./organization") and org_author(c, role, front) or
|
75
|
+
(c.at("./organization") and org_author(c, role, front)) or
|
76
76
|
person_author(c, role, front)
|
77
77
|
end
|
78
78
|
end
|
@@ -148,7 +148,7 @@ module IsoDoc::Ietf
|
|
148
148
|
out.postal do |p|
|
149
149
|
if line = addr.at(ns("./formattedAddress"))
|
150
150
|
line.xpath(ns(".//br")).each { |br| br.replace("\n") }
|
151
|
-
line.text.split(
|
151
|
+
line.text.split("\n").each do |l|
|
152
152
|
p.postalLine l, **attr_code(ascii: l.transliterate)
|
153
153
|
end
|
154
154
|
else
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Ietf
|
3
3
|
class RfcConvert < ::IsoDoc::Convert
|
4
|
-
# TODO displayreference will be implemented as combination of autofetch and user-provided citations
|
5
|
-
|
6
4
|
def bibliography(isoxml, out)
|
7
5
|
isoxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
|
8
6
|
i.children = docid_prefix(i["type"], i.text)
|
@@ -113,10 +111,10 @@ module IsoDoc
|
|
113
111
|
end
|
114
112
|
|
115
113
|
def relaton_person_to_author(pers, role, node)
|
116
|
-
full = pers
|
117
|
-
surname = pers
|
118
|
-
initials = pers
|
119
|
-
pers
|
114
|
+
full = pers.at(ns("./completename"))&.text
|
115
|
+
surname = pers.at(ns("./surname"))&.text
|
116
|
+
initials = pers.xpath(ns("./initial"))&.map(&:text)&.join(" ") ||
|
117
|
+
pers.xpath(ns("./forename"))&.map { |i| i.text[0] }&.join(" ")
|
120
118
|
initials = nil if initials.empty?
|
121
119
|
node.author nil, **attr_code(
|
122
120
|
fullname: full,
|
data/lib/isodoc/ietf/section.rb
CHANGED
@@ -1,178 +1,178 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module Ietf
|
3
|
+
class RfcConvert < ::IsoDoc::Convert
|
4
|
+
def common_rfc_pis(node)
|
5
|
+
rfc_pis = {
|
6
|
+
artworkdelimiter: node&.at(ns("//pi/artworkdelimiter"))&.text,
|
7
|
+
artworklines: node&.at(ns("//pi/artworklines"))&.text,
|
8
|
+
authorship: node&.at(ns("//pi/authorship"))&.text,
|
9
|
+
autobreaks: node&.at(ns("//pi/autobreaks"))&.text,
|
10
|
+
background: node&.at(ns("//pi/background"))&.text,
|
11
|
+
colonspace: node&.at(ns("//pi/colonspace"))&.text,
|
12
|
+
comments: node&.at(ns("//pi/comments"))&.text,
|
13
|
+
docmapping: node&.at(ns("//pi/docmapping"))&.text,
|
14
|
+
editing: node&.at(ns("//pi/editing"))&.text,
|
15
|
+
emoticonic: node&.at(ns("//pi/emoticonic"))&.text,
|
16
|
+
footer: node&.at(ns("//pi/footer"))&.text,
|
17
|
+
header: node&.at(ns("//pi/header"))&.text,
|
18
|
+
inline: node&.at(ns("//pi/inline"))&.text,
|
19
|
+
iprnotified: node&.at(ns("//pi/iprnotified"))&.text,
|
20
|
+
linkmailto: node&.at(ns("//pi/linkmailto"))&.text,
|
21
|
+
linefile: node&.at(ns("//pi/linefile"))&.text,
|
22
|
+
notedraftinprogress: node&.at(ns("//pi/notedraftinprogress"))&.text,
|
23
|
+
private: node&.at(ns("//pi/private"))&.text,
|
24
|
+
refparent: node&.at(ns("//pi/refparent"))&.text,
|
25
|
+
rfcedstyle: node&.at(ns("//pi/rfcedstyle"))&.text,
|
26
|
+
slides: node&.at(ns("//pi/slides"))&.text,
|
27
|
+
"text-list-symbols": node&.at(ns("//pi/text-list-symbols"))&.text,
|
28
|
+
tocappendix: node&.at(ns("//pi/tocappendix"))&.text,
|
29
|
+
tocindent: node&.at(ns("//pi/tocindent"))&.text,
|
30
|
+
tocnarrow: node&.at(ns("//pi/tocnarrow"))&.text,
|
31
|
+
tocompact: node&.at(ns("//pi/tocompact"))&.text,
|
32
|
+
topblock: node&.at(ns("//pi/topblock"))&.text,
|
33
|
+
useobject: node&.at(ns("//pi/useobject"))&.text,
|
34
|
+
strict: node&.at(ns("//pi/strict"))&.text || "yes",
|
35
|
+
compact: node&.at(ns("//pi/compact"))&.text || "yes",
|
36
|
+
subcompact: node&.at(ns("//pi/subcompact"))&.text || "no",
|
37
|
+
toc: node&.at(ns("//pi/tocinclude"))&.text,
|
38
|
+
tocdepth: node&.at(ns("//pi/toc-depth"))&.text || "4",
|
39
|
+
symrefs: node&.at(ns("//pi/sym-refs"))&.text || "yes",
|
40
|
+
sortrefs: node&.at(ns("//pi/sort-refs"))&.text || "yes",
|
41
|
+
}
|
42
|
+
attr_code(rfc_pis)
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
def set_pis(node, doc)
|
46
|
+
rfc_pis = common_rfc_pis(node)
|
47
|
+
rfc_pis.each_pair do |k, v|
|
48
|
+
pi = Nokogiri::XML::ProcessingInstruction.new(doc, "rfc",
|
49
|
+
"#{k}=\"#{v}\"")
|
50
|
+
doc.root.add_previous_sibling(pi)
|
51
|
+
end
|
52
|
+
doc.to_xml
|
50
53
|
end
|
51
|
-
doc.to_xml
|
52
|
-
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
55
|
+
def rfc_attributes(docxml)
|
56
|
+
# t = Time.now.getutc
|
57
|
+
obs = xpath_comma(docxml
|
58
|
+
.xpath(ns("//bibdata/relation[@type = 'obsoletes']/bibitem/docidentifier")))
|
59
|
+
upd = xpath_comma(docxml
|
60
|
+
.xpath(ns("//bibdata/relation[@type = 'updates']/bibitem/docidentifier")))
|
61
|
+
{
|
62
|
+
docName: @meta.get[:doctype] == "Internet Draft" ? @meta.get[:docnumber] : nil,
|
63
|
+
number: @meta.get[:doctype].casecmp?("rfc") ? @meta.get[:docnumber] : nil,
|
64
|
+
category: series2category(
|
65
|
+
docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text,
|
66
|
+
),
|
67
|
+
ipr: docxml&.at(ns("//bibdata/ext/ipr"))&.text,
|
68
|
+
consensus: docxml&.at(ns("//bibdata/ext/consensus"))&.text,
|
69
|
+
obsoletes: obs,
|
70
|
+
updates: upd,
|
71
|
+
indexInclude: docxml&.at(ns("//bibdata/ext/indexInclude"))&.text,
|
72
|
+
iprExtract: docxml&.at(ns("//bibdata/ext/iprExtract"))&.text,
|
73
|
+
sortRefs: docxml&.at(ns("//bibdata/ext/sortRefs"))&.text,
|
74
|
+
symRefs: docxml&.at(ns("//bibdata/ext/symRefs"))&.text,
|
75
|
+
tocInclude: docxml&.at(ns("//bibdata/ext/tocInclude"))&.text,
|
76
|
+
tocDepth: docxml&.at(ns("//bibdata/ext/tocDepth"))&.text,
|
77
|
+
submissionType: docxml&.at(ns(
|
78
|
+
"//bibdata/series[@type = 'stream']/title",
|
79
|
+
))&.text || "IETF",
|
80
|
+
"xml:lang": docxml&.at(ns("//bibdata/language"))&.text,
|
81
|
+
version: "3",
|
82
|
+
"xmlns:xi": "http://www.w3.org/2001/XInclude",
|
83
|
+
}
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
"std"
|
86
|
+
def series2category(series)
|
87
|
+
case series&.downcase
|
88
|
+
when "standard", "std", "full-standard" then "std"
|
89
|
+
when "informational", "info", "fyi" then "info"
|
90
|
+
when "experimental", "exp" then "exp"
|
91
|
+
when "bcp" then "bcp"
|
92
|
+
when "historic" then "historic"
|
93
|
+
else
|
94
|
+
"std"
|
95
|
+
end
|
96
96
|
end
|
97
|
-
end
|
98
97
|
|
99
|
-
|
100
|
-
|
98
|
+
def xpath_comma(xpath)
|
99
|
+
return nil if xpath.empty?
|
101
100
|
|
102
|
-
|
103
|
-
|
101
|
+
xpath.map(&:text).join(", ")
|
102
|
+
end
|
104
103
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
104
|
+
def make_link(out, isoxml)
|
105
|
+
links = isoxml
|
106
|
+
.xpath(ns("//bibdata/relation[@type = 'includedIn' or " \
|
107
|
+
"@type = 'describedBy' or @type = 'derivedFrom' or " \
|
108
|
+
"@type = 'instance']")) || return
|
109
|
+
links.each do |l|
|
110
|
+
out.link href: l&.at(ns("./bibitem/docidentifier"))&.text,
|
111
|
+
rel: rel2iana(l["type"])
|
112
|
+
end
|
113
113
|
end
|
114
|
-
end
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
def rel2iana(type)
|
116
|
+
case type
|
117
|
+
when "includedIn" then "item"
|
118
|
+
when "describedBy" then "describedby"
|
119
|
+
when "derivedFrom" then "convertedfrom"
|
120
|
+
when "instance" then "alternate"
|
121
|
+
else
|
122
|
+
"alternate"
|
123
|
+
end
|
124
124
|
end
|
125
|
-
end
|
126
125
|
|
127
|
-
|
128
|
-
|
129
|
-
|
126
|
+
def make_middle(out, isoxml)
|
127
|
+
out.middle do |middle|
|
128
|
+
clause isoxml, middle
|
129
|
+
end
|
130
130
|
end
|
131
|
-
end
|
132
131
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
132
|
+
def make_back(out, isoxml)
|
133
|
+
out.back do |back|
|
134
|
+
bibliography isoxml, back
|
135
|
+
annex isoxml, back
|
136
|
+
end
|
137
137
|
end
|
138
|
-
end
|
139
138
|
|
140
|
-
|
141
|
-
|
139
|
+
def clause_parse_title(_node, div, clause, _out, _heading_attrs = {})
|
140
|
+
return unless clause
|
142
141
|
|
143
|
-
|
144
|
-
|
142
|
+
div.name do |n|
|
143
|
+
clause&.children&.each { |c2| parse(c2, n) }
|
144
|
+
end
|
145
145
|
end
|
146
|
-
end
|
147
146
|
|
148
|
-
|
149
|
-
|
147
|
+
def clause_parse(node, out)
|
148
|
+
return if node.at(ns(".//references"))
|
150
149
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
150
|
+
out.section **attr_code(
|
151
|
+
anchor: node["id"], numbered: node["numbered"],
|
152
|
+
removeInRFC: node["removeInRFC"], toc: node["toc"]
|
153
|
+
) do |div|
|
154
|
+
clause_parse_title(node, div, node.at(ns("./title")), out)
|
155
|
+
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
156
|
+
parse(c1, div)
|
157
|
+
end
|
158
158
|
end
|
159
159
|
end
|
160
|
-
end
|
161
160
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
161
|
+
def clause(isoxml, out)
|
162
|
+
isoxml.xpath("//xmlns:preface/child::*" \
|
163
|
+
"[not(name() = 'abstract' or name() = 'foreword')] " \
|
164
|
+
"| //xmlns:sections/child::*").each do |c|
|
165
|
+
# cdup = c.dup
|
166
|
+
# cdup.xpath(ns(".//references")).each { |r| r.remove }
|
167
|
+
# cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
|
168
|
+
clause_parse(c, out)
|
169
|
+
end
|
170
170
|
end
|
171
|
-
end
|
172
171
|
|
173
|
-
|
174
|
-
|
175
|
-
|
172
|
+
def annex(isoxml, out)
|
173
|
+
isoxml.xpath(ns("//annex")).each do |c|
|
174
|
+
clause_parse(c, out)
|
175
|
+
end
|
176
176
|
end
|
177
177
|
end
|
178
178
|
end
|
@@ -216,6 +216,9 @@
|
|
216
216
|
<optional>
|
217
217
|
<ref name="fullname"/>
|
218
218
|
</optional>
|
219
|
+
<zeroOrMore>
|
220
|
+
<ref name="credential"/>
|
221
|
+
</zeroOrMore>
|
219
222
|
<zeroOrMore>
|
220
223
|
<ref name="affiliation"/>
|
221
224
|
</zeroOrMore>
|
@@ -232,6 +235,11 @@
|
|
232
235
|
<ref name="FullNameType"/>
|
233
236
|
</element>
|
234
237
|
</define>
|
238
|
+
<define name="credential">
|
239
|
+
<element name="credential">
|
240
|
+
<text/>
|
241
|
+
</element>
|
242
|
+
</define>
|
235
243
|
<define name="FullNameType">
|
236
244
|
<choice>
|
237
245
|
<group>
|
@@ -305,7 +313,9 @@
|
|
305
313
|
<zeroOrMore>
|
306
314
|
<ref name="affiliationdescription"/>
|
307
315
|
</zeroOrMore>
|
308
|
-
<
|
316
|
+
<optional>
|
317
|
+
<ref name="organization"/>
|
318
|
+
</optional>
|
309
319
|
</element>
|
310
320
|
</define>
|
311
321
|
<define name="affiliationname">
|
@@ -66,6 +66,7 @@
|
|
66
66
|
<value>caution</value>
|
67
67
|
<value>statement</value>
|
68
68
|
<value>editorial</value>
|
69
|
+
<value>box</value>
|
69
70
|
</choice>
|
70
71
|
</define>
|
71
72
|
<define name="index">
|
@@ -1577,6 +1578,9 @@
|
|
1577
1578
|
<zeroOrMore>
|
1578
1579
|
<ref name="indexsect"/>
|
1579
1580
|
</zeroOrMore>
|
1581
|
+
<optional>
|
1582
|
+
<ref name="colophon"/>
|
1583
|
+
</optional>
|
1580
1584
|
</element>
|
1581
1585
|
</define>
|
1582
1586
|
<define name="misccontainer">
|
@@ -1599,6 +1603,13 @@
|
|
1599
1603
|
</oneOrMore>
|
1600
1604
|
</element>
|
1601
1605
|
</define>
|
1606
|
+
<define name="colophon">
|
1607
|
+
<element name="colophon">
|
1608
|
+
<oneOrMore>
|
1609
|
+
<ref name="content"/>
|
1610
|
+
</oneOrMore>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1602
1613
|
<define name="foreword">
|
1603
1614
|
<element name="foreword">
|
1604
1615
|
<ref name="Content-Section"/>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "metanorma/ietf/data/workgroups"
|
2
|
+
require "metanorma-utils"
|
2
3
|
|
3
4
|
module Metanorma
|
4
5
|
module Ietf
|
@@ -7,6 +8,19 @@ module Metanorma
|
|
7
8
|
super
|
8
9
|
image_validate(doc)
|
9
10
|
workgroup_validate(doc)
|
11
|
+
submission_validate(doc)
|
12
|
+
end
|
13
|
+
|
14
|
+
def ns(path)
|
15
|
+
::Metanorma::Utils::ns(path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def submission_validate(doc)
|
19
|
+
stream = doc.at(("//bibdata/series[@type = 'stream']/title"))&.text
|
20
|
+
status = doc.at(("//bibdata/status/stage"))&.text
|
21
|
+
stream == "editorial" && status != "informational" and
|
22
|
+
@log.add("Document Attributes", nil,
|
23
|
+
"Editorial stream must have Informational status")
|
10
24
|
end
|
11
25
|
|
12
26
|
def image_validate(doc)
|
@@ -24,7 +38,8 @@ module Metanorma
|
|
24
38
|
wg_norm = wg.text.sub(/ (Working|Research) Group$/, "")
|
25
39
|
next if @workgroups.include?(wg_norm)
|
26
40
|
|
27
|
-
@log.add("Document Attributes", nil,
|
41
|
+
@log.add("Document Attributes", nil,
|
42
|
+
"IETF: unrecognised working group #{wg.text}")
|
28
43
|
end
|
29
44
|
end
|
30
45
|
|
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.1.
|
4
|
+
version: 3.1.3
|
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-
|
11
|
+
date: 2023-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mathml2asciimath
|