metanorma-ietf 2.3.2 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +3 -5
- data/lib/asciidoctor/ietf/biblio.rng +1 -0
- data/lib/asciidoctor/ietf/ietf.rng +3 -0
- data/lib/asciidoctor/ietf/isodoc.rng +17 -3
- data/lib/asciidoctor/ietf/validate.rb +22 -13
- data/lib/isodoc/ietf/front.rb +56 -46
- data/lib/isodoc/ietf/section.rb +51 -42
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 158e5eef3f87d8f6ce1242339d819343ea8b8ab744f522eafb9c7f16e20f6c55
|
4
|
+
data.tar.gz: '089428469df3542fa94fcb535aa54d0a899b74b3aea35567239f5a24b4525366'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33db0a9a909d0253f3b91fed431e7194c53abab8ae396cea3a6944bcc56d1f2fbade0c79444d7b5d87deeab75a8e33ed1771e574a21fbf77884d9052a3b69a30
|
7
|
+
data.tar.gz: 9217f91cfb840cafb5dcdda4520dfcf378634d568960a02580760fd182f0d7f4f47f23b90b143aeff3209135fc62e3c782eb5d6383b39932149666cbbdc3d7c9
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
|
33
23
|
steps:
|
34
24
|
- uses: actions/checkout@master
|
@@ -68,7 +58,7 @@ jobs:
|
|
68
58
|
with:
|
69
59
|
path: ~/.cache/xml2rfc
|
70
60
|
key: xml2rfc
|
71
|
-
restore-
|
61
|
+
restore-keys: xml2rfc
|
72
62
|
|
73
63
|
- if: matrix.os == 'macos-latest'
|
74
64
|
run: brew install libmagic
|
@@ -88,5 +78,5 @@ jobs:
|
|
88
78
|
with:
|
89
79
|
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
90
80
|
repository: ${{ github.repository }}
|
91
|
-
event-type:
|
81
|
+
event-type: tests-passed
|
92
82
|
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# https://github.com/
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
4
3
|
inherit_from:
|
5
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
5
|
|
7
6
|
# local repo-specific modifications
|
7
|
+
# ...
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
DisplayCopNames: false
|
11
|
-
StyleGuideCopsOnly: false
|
12
10
|
TargetRubyVersion: 2.4
|
@@ -45,6 +45,11 @@
|
|
45
45
|
<optional>
|
46
46
|
<attribute name="alt"/>
|
47
47
|
</optional>
|
48
|
+
<optional>
|
49
|
+
<attribute name="updatetype">
|
50
|
+
<data type="boolean"/>
|
51
|
+
</attribute>
|
52
|
+
</optional>
|
48
53
|
<text/>
|
49
54
|
</element>
|
50
55
|
</define>
|
@@ -543,6 +548,9 @@
|
|
543
548
|
</define>
|
544
549
|
<define name="BibDataExtensionType">
|
545
550
|
<ref name="doctype"/>
|
551
|
+
<optional>
|
552
|
+
<ref name="docsubtype"/>
|
553
|
+
</optional>
|
546
554
|
<optional>
|
547
555
|
<ref name="editorialgroup"/>
|
548
556
|
</optional>
|
@@ -890,6 +898,14 @@
|
|
890
898
|
</define>
|
891
899
|
</include>
|
892
900
|
<!-- end overrides -->
|
901
|
+
<define name="docsubtype">
|
902
|
+
<element name="docsubtype">
|
903
|
+
<ref name="DocumentSubtype"/>
|
904
|
+
</element>
|
905
|
+
</define>
|
906
|
+
<define name="DocumentSubtype">
|
907
|
+
<text/>
|
908
|
+
</define>
|
893
909
|
<define name="colgroup">
|
894
910
|
<element name="colgroup">
|
895
911
|
<oneOrMore>
|
@@ -1191,9 +1207,7 @@
|
|
1191
1207
|
</define>
|
1192
1208
|
<define name="IsoWorkgroup">
|
1193
1209
|
<optional>
|
1194
|
-
<attribute name="number"
|
1195
|
-
<data type="int"/>
|
1196
|
-
</attribute>
|
1210
|
+
<attribute name="number"/>
|
1197
1211
|
</optional>
|
1198
1212
|
<optional>
|
1199
1213
|
<attribute name="type"/>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
|
1
3
|
module Asciidoctor
|
2
4
|
module Ietf
|
3
5
|
class Converter < ::Asciidoctor::Standoc::Converter
|
@@ -10,15 +12,18 @@ module Asciidoctor
|
|
10
12
|
def image_validate(doc)
|
11
13
|
doc.xpath("//image").each do |i|
|
12
14
|
next if i["mimetype"] == "image/svg+xml"
|
15
|
+
|
13
16
|
@log.add("MIME", i, "image #{i['src'][0, 40]} is not SVG!")
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
17
20
|
def workgroup_validate(doc)
|
18
21
|
return if @workgroups.empty?
|
22
|
+
|
19
23
|
doc.xpath("//bibdata/ext/editorialgroup/workgroup").each do |wg|
|
20
24
|
wg_norm = wg.text.sub(/ (Working|Research) Group$/, "")
|
21
25
|
next if @workgroups.include?(wg_norm)
|
26
|
+
|
22
27
|
@log.add("Document Attributes", nil, "IETF: unrecognised working group #{wg.text}")
|
23
28
|
end
|
24
29
|
end
|
@@ -29,25 +34,29 @@ module Asciidoctor
|
|
29
34
|
File.join(File.dirname(__FILE__), "ietf.rng"))
|
30
35
|
end
|
31
36
|
|
37
|
+
def wgcache_name
|
38
|
+
"#{Dir.home}/.metanorma-ietf-workgroup-cache.json"
|
39
|
+
end
|
40
|
+
|
32
41
|
def open_wg_cache(node)
|
33
|
-
|
34
|
-
|
42
|
+
node.attr("flush-caches") == "true" and
|
43
|
+
FileUtils.rm wgcache_name, force: true
|
35
44
|
wg = []
|
36
45
|
if Pathname.new(wgcache_name).file?
|
37
46
|
begin
|
38
47
|
File.open(wgcache_name, "r") { |f| wg = JSON.parse(f.read) }
|
39
48
|
rescue Exception => e
|
40
|
-
|
49
|
+
warn "Cache #{wgcache_name} is invalid, drop it"
|
41
50
|
end
|
42
51
|
end
|
43
52
|
[wg, wgcache_name]
|
44
53
|
end
|
45
54
|
|
46
|
-
def cache_workgroup_ietf(wg,
|
47
|
-
|
48
|
-
|
49
|
-
f.each_line do |
|
50
|
-
|
55
|
+
def cache_workgroup_ietf(wg, _b)
|
56
|
+
warn "Reading workgroups from https://tools.ietf.org/wg/..."
|
57
|
+
URI.open("https://tools.ietf.org/wg/") do |f|
|
58
|
+
f.each_line do |l|
|
59
|
+
l.scan(%r{<td width="50%" style='padding: 0 1ex'>([^<]+)</td>}) do |w|
|
51
60
|
wg << w[0].gsub(/\s+$/, "").gsub(/ Working Group$/, "")
|
52
61
|
end
|
53
62
|
end
|
@@ -55,11 +64,11 @@ module Asciidoctor
|
|
55
64
|
wg
|
56
65
|
end
|
57
66
|
|
58
|
-
def cache_workgroup_irtf(wg,
|
59
|
-
|
60
|
-
|
61
|
-
f.each_line do |
|
62
|
-
|
67
|
+
def cache_workgroup_irtf(wg, _b)
|
68
|
+
warn "Reading workgroups from https://irtf.org/groups..."
|
69
|
+
URI.open("https://irtf.org/groups", ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |f|
|
70
|
+
f.each_line do |l|
|
71
|
+
l.scan(%r{<a title="([^"]+) Research Group"[^>]+>([^<]+)<}) do |w|
|
63
72
|
wg << w[0].gsub(/\s+$/, "")
|
64
73
|
wg << w[1].gsub(/\s+$/, "") # abbrev
|
65
74
|
end
|
data/lib/isodoc/ietf/front.rb
CHANGED
@@ -25,10 +25,11 @@ module IsoDoc::Ietf
|
|
25
25
|
|
26
26
|
def output_if_translit(text)
|
27
27
|
return nil if text.nil?
|
28
|
+
|
28
29
|
text.transliterate != text ? text.transliterate : nil
|
29
30
|
end
|
30
31
|
|
31
|
-
def title(
|
32
|
+
def title(_isoxml, front)
|
32
33
|
title = @meta.get[:doctitle] or return
|
33
34
|
front.title title, **attr_code(abbrev: @meta.get[:docabbrev],
|
34
35
|
ascii: (@meta.get[:docascii] ||
|
@@ -49,18 +50,20 @@ module IsoDoc::Ietf
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def rfc_seriesinfo(isoxml, front)
|
52
|
-
front.seriesInfo **seriesinfo_attr(isoxml).merge({name: "RFC",
|
53
|
-
|
53
|
+
front.seriesInfo **seriesinfo_attr(isoxml).merge({ name: "RFC",
|
54
|
+
asciiName: "RFC" })
|
54
55
|
i = isoxml&.at(ns("//bibdata/series[@type = 'intended']")) and
|
55
56
|
front.seriesInfo nil,
|
56
|
-
|
57
|
-
|
57
|
+
**attr_code(name: "",
|
58
|
+
status: i&.at(ns("./title"))&.text,
|
59
|
+
value: i&.at(ns("./number"))&.text || "")
|
58
60
|
end
|
59
61
|
|
60
62
|
def id_seriesinfo(isoxml, front)
|
61
63
|
front.seriesInfo nil,
|
62
|
-
|
63
|
-
|
64
|
+
**seriesinfo_attr(isoxml)
|
65
|
+
.merge({ name: "Internet-Draft",
|
66
|
+
asciiName: "Internet-Draft" })
|
64
67
|
i = isoxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text and
|
65
68
|
front.seriesInfo **attr_code(name: "", value: "", status: i)
|
66
69
|
end
|
@@ -74,44 +77,49 @@ module IsoDoc::Ietf
|
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
77
|
-
def person_author_attrs(
|
78
|
-
return {} if
|
79
|
-
|
80
|
-
|
81
|
-
|
80
|
+
def person_author_attrs(contrib, role)
|
81
|
+
return {} if contrib.nil?
|
82
|
+
|
83
|
+
full = contrib&.at(ns("./completename"))&.text
|
84
|
+
init = contrib&.at(ns("./initial"))&.text ||
|
85
|
+
contrib&.xpath(ns("./forename"))&.map { |n| n.text[0] }&.join(".")
|
82
86
|
init = nil if init.empty?
|
83
87
|
ret = attr_code(role: role, fullname: full, initials: init,
|
84
|
-
surname:
|
85
|
-
pers_author_attrs1(ret, full, init,
|
86
|
-
end
|
87
|
-
|
88
|
-
def pers_author_attrs1(ret, full, init,
|
89
|
-
full and ret.merge!(
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
surname: contrib&.at(ns("./surname"))&.text)
|
89
|
+
pers_author_attrs1(ret, full, init, contrib)
|
90
|
+
end
|
91
|
+
|
92
|
+
def pers_author_attrs1(ret, full, init, contrib)
|
93
|
+
full and ret.merge!(
|
94
|
+
attr_code(
|
95
|
+
asciiFullname: output_if_translit(full),
|
96
|
+
asciiInitials: output_if_translit(init),
|
97
|
+
asciiSurname: output_if_translit(contrib&.at(ns("./surname"))),
|
98
|
+
),
|
99
|
+
)
|
93
100
|
ret
|
94
101
|
end
|
95
102
|
|
96
|
-
def person_author(
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
103
|
+
def person_author(contrib, role, front)
|
104
|
+
attrs = person_author_attrs(contrib.at(ns("./person/name")), role)
|
105
|
+
front.author **attrs do |a|
|
106
|
+
org = contrib.at(ns("./person/affiliation/organization")) and
|
107
|
+
organization(org, a, contrib.document.at(ns("//showOnFrontPage")))
|
108
|
+
address(contrib.xpath(ns(".//address")),
|
109
|
+
contrib.at(ns(".//phone[not(@type = 'fax')]")),
|
110
|
+
contrib.at(ns(".//phone[@type = 'fax']")),
|
111
|
+
contrib.xpath(ns(".//email")), contrib.xpath(ns(".//uri")), a)
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
107
|
-
def org_author(
|
115
|
+
def org_author(contrib, role, front)
|
108
116
|
front.author **attr_code(role: role) do |a|
|
109
|
-
organization(
|
110
|
-
|
111
|
-
address(
|
112
|
-
|
113
|
-
|
114
|
-
|
117
|
+
organization(contrib.at(ns("./organization")), a,
|
118
|
+
contrib.document.at(ns("//showOnFrontPage")))
|
119
|
+
address(contrib.at(ns(".//address")),
|
120
|
+
contrib.at(ns(".//phone[not(@type = 'fax')]")),
|
121
|
+
contrib.at(ns(".//phone[@type = 'fax']")),
|
122
|
+
contrib.at(ns(".//email")), contrib.at(ns(".//uri")), a)
|
115
123
|
end
|
116
124
|
end
|
117
125
|
|
@@ -120,11 +128,13 @@ module IsoDoc::Ietf
|
|
120
128
|
out.organization name, **attr_code(
|
121
129
|
showOnFrontPage: show&.text, ascii: output_if_translit(name),
|
122
130
|
asciiAbbrev: output_if_translit(org.at(ns("./abbreviation"))),
|
123
|
-
abbrev: org.at(ns("./abbreviation"))
|
131
|
+
abbrev: org.at(ns("./abbreviation"))
|
132
|
+
)
|
124
133
|
end
|
125
134
|
|
126
135
|
def address(addr, phone, fax, email, uri, out)
|
127
136
|
return unless addr || phone || fax || email || uri
|
137
|
+
|
128
138
|
out.address do |a|
|
129
139
|
addr and postal(addr, a)
|
130
140
|
phone and a.phone phone.text
|
@@ -164,10 +174,10 @@ module IsoDoc::Ietf
|
|
164
174
|
def email(email, out)
|
165
175
|
ascii = email.text.transliterate
|
166
176
|
out.email email.text,
|
167
|
-
|
177
|
+
**attr_code(ascii: ascii == email.text ? nil : ascii)
|
168
178
|
end
|
169
179
|
|
170
|
-
def date(
|
180
|
+
def date(_isoxml, front)
|
171
181
|
date = @meta.get[:publisheddate] || @meta.get[:circulateddate] || return
|
172
182
|
date = date.gsub(/T.*$/, "")
|
173
183
|
attr = date_attr(date) || return
|
@@ -176,8 +186,9 @@ module IsoDoc::Ietf
|
|
176
186
|
|
177
187
|
def date_attr(date)
|
178
188
|
return nil if date.nil?
|
189
|
+
|
179
190
|
if date.length == 4 && date =~ /^\d\d\d\d$/ then { year: date }
|
180
|
-
elsif
|
191
|
+
elsif /^\d\d\d\d-?\d\d$/.match?(date)
|
181
192
|
m = /^(?<year>\d\d\d\d)-(?<month>\d\d)$/.match date
|
182
193
|
{ month: Date::MONTHNAMES[(m[:month]).to_i], year: m[:year] }
|
183
194
|
else
|
@@ -185,25 +196,25 @@ module IsoDoc::Ietf
|
|
185
196
|
d = Date.iso8601 date
|
186
197
|
{ day: d.day.to_s.gsub(/^0/, ""), year: d.year,
|
187
198
|
month: Date::MONTHNAMES[d.month] }
|
188
|
-
rescue
|
199
|
+
rescue StandardError
|
189
200
|
nil
|
190
201
|
end
|
191
202
|
end
|
192
203
|
end
|
193
204
|
|
194
|
-
def area(
|
205
|
+
def area(_isoxml, front)
|
195
206
|
@meta.get[:areas].each do |w|
|
196
207
|
front.area w
|
197
208
|
end
|
198
209
|
end
|
199
210
|
|
200
|
-
def workgroup(
|
211
|
+
def workgroup(_isoxml, front)
|
201
212
|
@meta.get[:wg].each do |w|
|
202
213
|
front.workgroup w
|
203
214
|
end
|
204
215
|
end
|
205
216
|
|
206
|
-
def keyword(
|
217
|
+
def keyword(_isoxml, front)
|
207
218
|
@meta.get[:keywords].each do |kw|
|
208
219
|
front.keyword kw
|
209
220
|
end
|
@@ -231,7 +242,6 @@ module IsoDoc::Ietf
|
|
231
242
|
end
|
232
243
|
end
|
233
244
|
|
234
|
-
def boilerplate(isoxml, front)
|
235
|
-
end
|
245
|
+
def boilerplate(isoxml, front); end
|
236
246
|
end
|
237
247
|
end
|
data/lib/isodoc/ietf/section.rb
CHANGED
@@ -2,7 +2,7 @@ module IsoDoc::Ietf
|
|
2
2
|
class RfcConvert < ::IsoDoc::Convert
|
3
3
|
def common_rfc_pis(node)
|
4
4
|
rfc_pis = {
|
5
|
-
|
5
|
+
artworkdelimiter: node&.at(ns("//pi/artworkdelimiter"))&.text,
|
6
6
|
artworklines: node&.at(ns("//pi/artworklines"))&.text,
|
7
7
|
authorship: node&.at(ns("//pi/authorship"))&.text,
|
8
8
|
autobreaks: node&.at(ns("//pi/autobreaks"))&.text,
|
@@ -53,30 +53,32 @@ module IsoDoc::Ietf
|
|
53
53
|
|
54
54
|
def rfc_attributes(docxml)
|
55
55
|
t = Time.now.getutc
|
56
|
-
obs = xpath_comma(docxml
|
57
|
-
"//bibdata/relation[@type = 'obsoletes']/bibitem/docidentifier")))
|
58
|
-
upd = xpath_comma(docxml
|
59
|
-
"//bibdata/relation[@type = 'updates']/bibitem/docidentifier")))
|
56
|
+
obs = xpath_comma(docxml
|
57
|
+
.xpath(ns("//bibdata/relation[@type = 'obsoletes']/bibitem/docidentifier")))
|
58
|
+
upd = xpath_comma(docxml
|
59
|
+
.xpath(ns("//bibdata/relation[@type = 'updates']/bibitem/docidentifier")))
|
60
60
|
{
|
61
|
-
docName:
|
62
|
-
number:
|
63
|
-
category:
|
64
|
-
docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
61
|
+
docName: @meta.get[:doctype] == "Internet Draft" ? @meta.get[:docnumber] : nil,
|
62
|
+
number: @meta.get[:doctype].casecmp?("rfc") ? @meta.get[:docnumber] : nil,
|
63
|
+
category: series2category(
|
64
|
+
docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text,
|
65
|
+
),
|
66
|
+
ipr: docxml&.at(ns("//bibdata/ext/ipr"))&.text,
|
67
|
+
consensus: docxml&.at(ns("//bibdata/ext/consensus"))&.text,
|
68
|
+
obsoletes: obs,
|
69
|
+
updates: upd,
|
70
|
+
indexInclude: docxml&.at(ns("//bibdata/ext/indexInclude"))&.text,
|
71
|
+
iprExtract: docxml&.at(ns("//bibdata/ext/iprExtract"))&.text,
|
72
|
+
sortRefs: docxml&.at(ns("//bibdata/ext/sortRefs"))&.text,
|
73
|
+
symRefs: docxml&.at(ns("//bibdata/ext/symRefs"))&.text,
|
74
|
+
tocInclude: docxml&.at(ns("//bibdata/ext/tocInclude"))&.text,
|
75
|
+
tocDepth: docxml&.at(ns("//bibdata/ext/tocDepth"))&.text,
|
75
76
|
submissionType: docxml&.at(ns(
|
76
|
-
"//bibdata/series[@type = 'stream']/title"
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
"//bibdata/series[@type = 'stream']/title",
|
78
|
+
))&.text || "IETF",
|
79
|
+
'xml:lang': docxml&.at(ns("//bibdata/language"))&.text,
|
80
|
+
version: "3",
|
81
|
+
'xmlns:xi': "http://www.w3.org/2001/XInclude",
|
80
82
|
}
|
81
83
|
end
|
82
84
|
|
@@ -86,7 +88,7 @@ module IsoDoc::Ietf
|
|
86
88
|
when "informational", "info" then "info"
|
87
89
|
when "experimental", "exp" then "exp"
|
88
90
|
when "bcp" then "bcp"
|
89
|
-
when "fyi"
|
91
|
+
when "fyi" then "info"
|
90
92
|
when "full-standard" then "std"
|
91
93
|
when "historic" then "historic"
|
92
94
|
else
|
@@ -96,17 +98,19 @@ module IsoDoc::Ietf
|
|
96
98
|
|
97
99
|
def xpath_comma(xpath)
|
98
100
|
return nil if xpath.empty?
|
99
|
-
|
101
|
+
|
102
|
+
xpath.map(&:text).join(", ")
|
100
103
|
end
|
101
104
|
|
102
105
|
def make_link(out, isoxml)
|
103
|
-
links = isoxml
|
104
|
-
"//bibdata/relation[@type = 'includedIn' or
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
links = isoxml
|
107
|
+
.xpath(ns("//bibdata/relation[@type = 'includedIn' or "\
|
108
|
+
"@type = 'describedBy' or @type = 'derivedFrom' or "\
|
109
|
+
"@type = 'instance']")) || return
|
110
|
+
links.each do |l|
|
111
|
+
out.link **{ href: l&.at(ns("./bibitem/docidentifier"))&.text,
|
112
|
+
rel: rel2iana(l["type"]) }
|
113
|
+
end
|
110
114
|
end
|
111
115
|
|
112
116
|
def rel2iana(type)
|
@@ -115,7 +119,7 @@ module IsoDoc::Ietf
|
|
115
119
|
when "describedBy" then "describedby"
|
116
120
|
when "derivedFrom" then "convertedfrom"
|
117
121
|
when "instance" then "alternate"
|
118
|
-
else
|
122
|
+
else
|
119
123
|
"alternate"
|
120
124
|
end
|
121
125
|
end
|
@@ -133,17 +137,21 @@ module IsoDoc::Ietf
|
|
133
137
|
end
|
134
138
|
end
|
135
139
|
|
136
|
-
def clause_parse_title(
|
137
|
-
return unless
|
140
|
+
def clause_parse_title(_node, div, clause, _out, _heading_attrs = {})
|
141
|
+
return unless clause
|
142
|
+
|
138
143
|
div.name do |n|
|
139
|
-
|
144
|
+
clause&.children&.each { |c2| parse(c2, n) }
|
140
145
|
end
|
141
146
|
end
|
142
147
|
|
143
148
|
def clause_parse(node, out)
|
144
149
|
return if node.at(ns(".//references"))
|
145
|
-
|
146
|
-
|
150
|
+
|
151
|
+
out.section **attr_code(
|
152
|
+
anchor: node["id"], numbered: node["numbered"],
|
153
|
+
removeInRFC: node["removeInRFC"], toc: node["toc"]
|
154
|
+
) do |div|
|
147
155
|
clause_parse_title(node, div, node.at(ns("./title")), out)
|
148
156
|
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
149
157
|
parse(c1, div)
|
@@ -152,11 +160,12 @@ module IsoDoc::Ietf
|
|
152
160
|
end
|
153
161
|
|
154
162
|
def clause(isoxml, out)
|
155
|
-
isoxml.xpath("//xmlns:preface/child::*
|
163
|
+
isoxml.xpath("//xmlns:preface/child::*"\
|
164
|
+
"[not(name() = 'abstract' or name() = 'foreword')] "\
|
156
165
|
"| //xmlns:sections/child::*").each do |c|
|
157
|
-
#cdup = c.dup
|
158
|
-
#cdup.xpath(ns(".//references")).each { |r| r.remove }
|
159
|
-
#cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
|
166
|
+
# cdup = c.dup
|
167
|
+
# cdup.xpath(ns(".//references")).each { |r| r.remove }
|
168
|
+
# cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
|
160
169
|
clause_parse(c, out)
|
161
170
|
end
|
162
171
|
end
|
data/metanorma-ietf.gemspec
CHANGED
@@ -38,7 +38,8 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_dependency "isodoc", "~> 1.6.0"
|
39
39
|
spec.add_dependency "mathml2asciimath"
|
40
40
|
spec.add_dependency "metanorma-standoc", "~> 1.9.0"
|
41
|
-
spec.add_dependency "nokogiri", "~> 1.
|
41
|
+
spec.add_dependency "nokogiri", "~> 1.11.6"
|
42
|
+
spec.add_dependency "open-uri"
|
42
43
|
|
43
44
|
spec.add_development_dependency "byebug"
|
44
45
|
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: 2.3.
|
4
|
+
version: 2.3.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: 2021-
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.11.6
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.11.6
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: open-uri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: byebug
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|