metanorma-ietf 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/ietf/biblio.rng +54 -6
- data/lib/asciidoctor/ietf/converter.rb +5 -0
- data/lib/asciidoctor/ietf/front.rb +1 -1
- data/lib/isodoc/ietf/inline.rb +27 -3
- data/lib/isodoc/ietf/metadata.rb +1 -1
- data/lib/isodoc/ietf/references.rb +34 -7
- data/lib/isodoc/ietf/rfc_convert.rb +5 -0
- data/lib/isodoc/ietf/section.rb +3 -5
- data/lib/metanorma/ietf/processor.rb +13 -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: 5810ee943727c95c708a2375a3c38c473ba80c7ed8a0f99449d76de0d73cf514
|
4
|
+
data.tar.gz: 9cdfa5258245b10631c9f44bfc873f27113ef53d92ac3e63a2d92b2277582655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3778ea665033cf2245defda88dc0743dc26db811b5863e4d4a8c5a594958f560b1b807534a3e7e47eb490a18f3b479f6529d809256b5199adaa18ee61c12699
|
7
|
+
data.tar.gz: 5a1f75cfeae796f38f4e117088e6afa52fccc6a536307afa2ce6d4c2839c62ac59eade3be28636c02358cb228268c6439d41220d484ff442302ed75fd16c7441
|
@@ -49,11 +49,17 @@
|
|
49
49
|
</define>
|
50
50
|
<define name="stage">
|
51
51
|
<element name="stage">
|
52
|
+
<optional>
|
53
|
+
<attribute name="abbreviation"/>
|
54
|
+
</optional>
|
52
55
|
<text/>
|
53
56
|
</element>
|
54
57
|
</define>
|
55
58
|
<define name="substage">
|
56
59
|
<element name="substage">
|
60
|
+
<optional>
|
61
|
+
<attribute name="abbreviation"/>
|
62
|
+
</optional>
|
57
63
|
<text/>
|
58
64
|
</element>
|
59
65
|
</define>
|
@@ -452,9 +458,14 @@
|
|
452
458
|
<attribute name="bibitemid">
|
453
459
|
<data type="IDREF"/>
|
454
460
|
</attribute>
|
455
|
-
<
|
456
|
-
<
|
457
|
-
|
461
|
+
<choice>
|
462
|
+
<zeroOrMore>
|
463
|
+
<ref name="locality"/>
|
464
|
+
</zeroOrMore>
|
465
|
+
<zeroOrMore>
|
466
|
+
<ref name="localityStack"/>
|
467
|
+
</zeroOrMore>
|
468
|
+
</choice>
|
458
469
|
<optional>
|
459
470
|
<ref name="date"/>
|
460
471
|
</optional>
|
@@ -469,6 +480,25 @@
|
|
469
480
|
<ref name="BibItemLocality"/>
|
470
481
|
</element>
|
471
482
|
</define>
|
483
|
+
<define name="localityStack">
|
484
|
+
<element name="localityStack">
|
485
|
+
<zeroOrMore>
|
486
|
+
<ref name="locality"/>
|
487
|
+
</zeroOrMore>
|
488
|
+
</element>
|
489
|
+
</define>
|
490
|
+
<define name="sourceLocality">
|
491
|
+
<element name="sourceLocality">
|
492
|
+
<ref name="BibItemLocality"/>
|
493
|
+
</element>
|
494
|
+
</define>
|
495
|
+
<define name="sourceLocalityStack">
|
496
|
+
<element name="sourceLocalityStack">
|
497
|
+
<zeroOrMore>
|
498
|
+
<ref name="sourceLocality"/>
|
499
|
+
</zeroOrMore>
|
500
|
+
</element>
|
501
|
+
</define>
|
472
502
|
<define name="BibItemLocality">
|
473
503
|
<attribute name="type">
|
474
504
|
<ref name="LocalityType"/>
|
@@ -1028,12 +1058,30 @@
|
|
1028
1058
|
<attribute name="type">
|
1029
1059
|
<ref name="DocRelationType"/>
|
1030
1060
|
</attribute>
|
1061
|
+
<optional>
|
1062
|
+
<element name="description">
|
1063
|
+
<ref name="FormattedString"/>
|
1064
|
+
</element>
|
1065
|
+
</optional>
|
1031
1066
|
<element name="bibitem">
|
1032
1067
|
<ref name="BibliographicItem"/>
|
1033
1068
|
</element>
|
1034
|
-
<
|
1035
|
-
<
|
1036
|
-
|
1069
|
+
<choice>
|
1070
|
+
<zeroOrMore>
|
1071
|
+
<ref name="locality"/>
|
1072
|
+
</zeroOrMore>
|
1073
|
+
<zeroOrMore>
|
1074
|
+
<ref name="localityStack"/>
|
1075
|
+
</zeroOrMore>
|
1076
|
+
</choice>
|
1077
|
+
<choice>
|
1078
|
+
<zeroOrMore>
|
1079
|
+
<ref name="sourceLocality"/>
|
1080
|
+
</zeroOrMore>
|
1081
|
+
<zeroOrMore>
|
1082
|
+
<ref name="sourceLocalityStack"/>
|
1083
|
+
</zeroOrMore>
|
1084
|
+
</choice>
|
1037
1085
|
</element>
|
1038
1086
|
</define>
|
1039
1087
|
<define name="version">
|
@@ -22,6 +22,7 @@ module Asciidoctor
|
|
22
22
|
@draft = node.attributes.has_key?("draft")
|
23
23
|
@workgroups = cache_workgroup(node)
|
24
24
|
@bcp_bold = !node.attr?("no-rfc-bold-bcp14")
|
25
|
+
@xinclude = node.attr?("use-xinclude")
|
25
26
|
super
|
26
27
|
end
|
27
28
|
|
@@ -198,6 +199,10 @@ module Asciidoctor
|
|
198
199
|
end
|
199
200
|
end
|
200
201
|
|
202
|
+
def html_extract_attributes(node)
|
203
|
+
super.merge(use_xinclude: node.attr("use-xinclude"))
|
204
|
+
end
|
205
|
+
|
201
206
|
def rfc_converter(node)
|
202
207
|
IsoDoc::Ietf::RfcConvert.new(html_extract_attributes(node))
|
203
208
|
end
|
@@ -2,7 +2,7 @@ module Asciidoctor
|
|
2
2
|
module Ietf
|
3
3
|
class Converter < ::Asciidoctor::Standoc::Converter
|
4
4
|
def relaton_relations
|
5
|
-
%w(included-in described-by derived-from
|
5
|
+
%w(included-in described-by derived-from instance obsoletes updates)
|
6
6
|
end
|
7
7
|
|
8
8
|
def metadata_author(node, xml)
|
data/lib/isodoc/ietf/inline.rb
CHANGED
@@ -110,9 +110,17 @@ module IsoDoc::Ietf
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
def get_linkend(node)
|
114
|
+
contents = node.children.select { |c| !%w{locality localityStack}.include? c.name }.
|
115
|
+
select { |c| !c.text? || /\S/.match(c) }
|
116
|
+
!contents.empty? and
|
117
|
+
return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
|
118
|
+
""
|
119
|
+
end
|
120
|
+
|
113
121
|
def eref_parse(node, out)
|
114
|
-
linkend = node.children.
|
115
|
-
section = eref_clause(node.xpath(ns("./locality")), nil) || ""
|
122
|
+
linkend = node.children.reject { |c| %w{locality localityStack}.include? c.name }
|
123
|
+
section = eref_clause(node.xpath(ns("./locality | ./localityStack")), nil) || ""
|
116
124
|
out.relref **attr_code(target: node["bibitemid"], section: section,
|
117
125
|
displayFormat: node["displayFormat"]) do |l|
|
118
126
|
linkend.each { |n| parse(n, l) }
|
@@ -120,11 +128,27 @@ module IsoDoc::Ietf
|
|
120
128
|
end
|
121
129
|
|
122
130
|
def eref_clause(refs, target)
|
131
|
+
ret = []
|
132
|
+
ret1 = ""
|
133
|
+
refs.each do |l|
|
134
|
+
if l.name == "localityStack"
|
135
|
+
ret << ret1
|
136
|
+
ret1 = ""
|
137
|
+
ret << eref_clause1(l.elements, target)
|
138
|
+
else
|
139
|
+
ret1 += eref_clause1([l], target)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
ret << ret1
|
143
|
+
ret.reject { |c| c.nil? || c.empty? }.join("; ")
|
144
|
+
end
|
145
|
+
|
146
|
+
def eref_clause1(refs, target)
|
123
147
|
refs.each do |l|
|
124
148
|
next unless %w(clause section).include? l["type"]
|
125
149
|
return l&.at(ns("./referenceFrom"))&.text
|
126
150
|
end
|
127
|
-
return
|
151
|
+
return ""
|
128
152
|
end
|
129
153
|
|
130
154
|
def index_parse(node, out)
|
data/lib/isodoc/ietf/metadata.rb
CHANGED
@@ -31,7 +31,13 @@ module IsoDoc::Ietf
|
|
31
31
|
|
32
32
|
def nonstd_bibitem(list, b, ordinal, bibliography)
|
33
33
|
uris = b.xpath(ns("./uri"))
|
34
|
-
|
34
|
+
target = nil
|
35
|
+
uris&.each do |u|
|
36
|
+
if u["type"] == "src" then
|
37
|
+
target = u.text
|
38
|
+
end
|
39
|
+
end
|
40
|
+
list.reference **attr_code(target: target,
|
35
41
|
anchor: b["id"]) do |r|
|
36
42
|
r.front do |f|
|
37
43
|
relaton_to_title(b, f)
|
@@ -40,25 +46,39 @@ module IsoDoc::Ietf
|
|
40
46
|
relaton_to_keyword(b, f)
|
41
47
|
relaton_to_abstract(b, f)
|
42
48
|
end
|
43
|
-
uris
|
49
|
+
uris&.each do |u|
|
44
50
|
r.format nil, **attr_code(target: u.text, type: u["type"])
|
45
51
|
end
|
52
|
+
docidentifiers = b.xpath(ns("./docidentifier"))
|
53
|
+
id = bibitem_ref_code(b) and id.text != "(NO ID)" and
|
54
|
+
r.refcontent render_identifier(id)
|
55
|
+
docidentifiers&.each do |u|
|
56
|
+
if %w(DOI IETF).include? u["type"]
|
57
|
+
r.seriesInfo nil, **attr_code(value: u.text, name: u["type"])
|
58
|
+
end
|
59
|
+
end
|
46
60
|
end
|
47
61
|
end
|
48
62
|
|
49
63
|
def relaton_to_title(b, f)
|
50
|
-
id = bibitem_ref_code(b)
|
51
|
-
identifier = render_identifier(id)
|
52
64
|
title = b&.at(ns("./title")) || b&.at(ns("./formattedref")) or return
|
53
65
|
f.title do |t|
|
54
|
-
t << "#{identifier}, "
|
55
66
|
title.children.each { |n| parse(n, t) }
|
56
67
|
end
|
57
68
|
end
|
58
69
|
|
70
|
+
def bibitem_ref_code(b)
|
71
|
+
id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
|
72
|
+
"or @type = 'ISSN' or @type = 'ISBN' or @type = 'IETF')]"))
|
73
|
+
return id if id
|
74
|
+
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
75
|
+
id << "(NO ID)"
|
76
|
+
id
|
77
|
+
end
|
78
|
+
|
59
79
|
def relaton_to_author(b, f)
|
60
80
|
auths = b.xpath(ns("./contributor[xmlns:role/@type = 'author' or "\
|
61
|
-
|
81
|
+
"xmlns:role/@type = 'editor']"))
|
62
82
|
auths.empty? and auths = b.xpath(ns("./contributor[xmlns:role/@type = "\
|
63
83
|
"'publisher']"))
|
64
84
|
auths.each do |a|
|
@@ -111,7 +131,13 @@ module IsoDoc::Ietf
|
|
111
131
|
def relaton_to_abstract(b, f)
|
112
132
|
b.xpath(ns("./abstract")).each do |k|
|
113
133
|
f.abstract do |abstract|
|
114
|
-
k.
|
134
|
+
if k.at(ns("./p"))
|
135
|
+
k.children.each { |n| parse(n, abstract) }
|
136
|
+
else
|
137
|
+
abstract.t do |t|
|
138
|
+
k.children.each { |n| parse(n, t) }
|
139
|
+
end
|
140
|
+
end
|
115
141
|
end
|
116
142
|
end
|
117
143
|
end
|
@@ -122,6 +148,7 @@ module IsoDoc::Ietf
|
|
122
148
|
end
|
123
149
|
|
124
150
|
def is_ietf(b)
|
151
|
+
return false if !@xinclude
|
125
152
|
url = b.at(ns("./uri[@type = 'xml']")) or return false
|
126
153
|
/xml2rfc\.tools\.ietf\.org/.match(url)
|
127
154
|
end
|
data/lib/isodoc/ietf/section.rb
CHANGED
@@ -75,8 +75,6 @@ module IsoDoc::Ietf
|
|
75
75
|
'xml:lang': docxml&.at(ns("//bibdata/language"))&.text,
|
76
76
|
version: "3",
|
77
77
|
'xmlns:xi': "http://www.w3.org/2001/XInclude",
|
78
|
-
prepTime: sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
|
79
|
-
t.year, t.month, t.day, t.hour, t.min, t.sec),
|
80
78
|
}
|
81
79
|
end
|
82
80
|
|
@@ -88,7 +86,7 @@ module IsoDoc::Ietf
|
|
88
86
|
def make_link(out, isoxml)
|
89
87
|
links = isoxml.xpath(ns(
|
90
88
|
"//bibdata/relation[@type = 'includedIn' or @type = 'describedBy' or "\
|
91
|
-
"@type = 'derivedFrom' or @type = '
|
89
|
+
"@type = 'derivedFrom' or @type = 'instance']")) || return
|
92
90
|
links.each do |l|
|
93
91
|
out.link **{ href: l&.at(ns("./bibitem/docidentifier"))&.text,
|
94
92
|
rel: rel2iana(l["type"]) }
|
@@ -100,7 +98,7 @@ module IsoDoc::Ietf
|
|
100
98
|
when "includedIn" then "item"
|
101
99
|
when "describedBy" then "describedby"
|
102
100
|
when "derivedFrom" then "convertedfrom"
|
103
|
-
when "
|
101
|
+
when "instance" then "alternate"
|
104
102
|
else
|
105
103
|
"alternate"
|
106
104
|
end
|
@@ -114,8 +112,8 @@ module IsoDoc::Ietf
|
|
114
112
|
|
115
113
|
def make_back(out, isoxml)
|
116
114
|
out.back do |back|
|
117
|
-
annex isoxml, back
|
118
115
|
bibliography isoxml, back
|
116
|
+
annex isoxml, back
|
119
117
|
end
|
120
118
|
end
|
121
119
|
|
@@ -17,7 +17,8 @@ module Metanorma
|
|
17
17
|
xml: "xml",
|
18
18
|
rfc: "rfc.xml",
|
19
19
|
html: "html",
|
20
|
-
txt: "txt"
|
20
|
+
txt: "txt",
|
21
|
+
pdf: "pdf"
|
21
22
|
}
|
22
23
|
end
|
23
24
|
|
@@ -68,6 +69,17 @@ module Metanorma
|
|
68
69
|
|
69
70
|
system("xml2rfc --text #{rfcname} -o #{outname}")
|
70
71
|
|
72
|
+
when :pdf
|
73
|
+
unless xml2rfc_present?
|
74
|
+
warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
|
75
|
+
return
|
76
|
+
end
|
77
|
+
|
78
|
+
rfcname = outname.sub(/\.pdf$/, ".rfc.xml")
|
79
|
+
output(isodoc_node, outname, :rfc, options) unless @done_rfc
|
80
|
+
|
81
|
+
system("xml2rfc --pdf #{rfcname} -o #{outname}")
|
82
|
+
|
71
83
|
when :html
|
72
84
|
unless xml2rfc_present?
|
73
85
|
warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
|
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.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|