metanorma-ietf 2.4.3 → 2.5.1
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/basicdoc.rng +21 -4
- data/lib/asciidoctor/ietf/cleanup.rb +2 -0
- data/lib/asciidoctor/ietf/ietf.rng +9 -24
- data/lib/asciidoctor/ietf/isodoc.rng +446 -77
- data/lib/asciidoctor/ietf/reqt.rng +23 -2
- data/lib/isodoc/ietf/blocks.rb +3 -2
- data/lib/isodoc/ietf/cleanup.rb +148 -203
- data/lib/isodoc/ietf/cleanup_inline.rb +76 -0
- data/lib/isodoc/ietf/reqt.rb +63 -59
- data/lib/isodoc/ietf/rfc_convert.rb +2 -0
- data/lib/isodoc/ietf/terms.rb +52 -45
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +2 -4
- metadata +7 -34
data/lib/isodoc/ietf/reqt.rb
CHANGED
@@ -1,79 +1,83 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def recommendation_name(node, out, type)
|
9
|
-
label, title, lbl = recommendation_labels(node)
|
10
|
-
out.t **{ keepWithNext: "true" } do |b|
|
11
|
-
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
|
1
|
+
module IsoDoc
|
2
|
+
module Ietf
|
3
|
+
class RfcConvert < ::IsoDoc::Convert
|
4
|
+
def recommendation_labels(node)
|
5
|
+
[node.at(ns("./label")), node.at(ns("./title")),
|
6
|
+
@xrefs.anchor(node["id"], :label, false)]
|
12
7
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
|
9
|
+
def recommendation_name(node, out, type)
|
10
|
+
label, title, lbl = recommendation_labels(node)
|
11
|
+
out.t **{ keepWithNext: "true" } do |b|
|
12
|
+
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
|
13
|
+
end
|
14
|
+
if label || title
|
15
|
+
out.t **{ keepWithNext: "true" } do |b|
|
16
|
+
label and label.children.each { |n| parse(n, b) }
|
17
|
+
b << "#{clausedelim} " if label && title
|
18
|
+
title and title.children.each { |n| parse(n, b) }
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
def recommendation_attributes(node, out)
|
24
|
+
ret = recommendation_attributes1(node)
|
25
|
+
return if ret.empty?
|
26
|
+
|
27
|
+
out.ul do |p|
|
28
|
+
ret.each do |l|
|
29
|
+
p.li do |i|
|
30
|
+
i.em { |_e| i << l }
|
31
|
+
end
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
32
|
-
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
def recommendation_parse(node, out)
|
37
|
+
recommendation_name(node, out, @i18n.recommendation)
|
38
|
+
recommendation_attributes(node, out)
|
39
|
+
node.children.each do |n|
|
40
|
+
parse(n, out) unless %w(label title).include? n.name
|
41
|
+
end
|
39
42
|
end
|
40
|
-
end
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
def requirement_parse(node, out)
|
45
|
+
recommendation_name(node, out, @i18n.requirement)
|
46
|
+
recommendation_attributes(node, out)
|
47
|
+
node.children.each do |n|
|
48
|
+
parse(n, out) unless %w(label title).include? n.name
|
49
|
+
end
|
47
50
|
end
|
48
|
-
end
|
49
51
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
def permission_parse(node, out)
|
53
|
+
recommendation_name(node, out, @i18n.permission)
|
54
|
+
recommendation_attributes(node, out)
|
55
|
+
node.children.each do |n|
|
56
|
+
parse(n, out) unless %w(label title).include? n.name
|
57
|
+
end
|
55
58
|
end
|
56
|
-
end
|
57
59
|
|
58
|
-
|
59
|
-
|
60
|
-
%w(em link eref xref strong tt sup sub strike keyword smallcap
|
61
|
-
br hr bookmark pagebreak stem origin term preferred admitted
|
62
|
-
deprecates domain termsource modification).include? node.first_element_child.name
|
63
|
-
end
|
60
|
+
def inline?(node)
|
61
|
+
return true if node.first_element_child.nil?
|
64
62
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
63
|
+
%w(em link eref xref strong tt sup sub strike keyword smallcap
|
64
|
+
br hr bookmark pagebreak stem origin term preferred admitted
|
65
|
+
deprecates domain termsource modification)
|
66
|
+
.include? node.first_element_child.name
|
67
|
+
end
|
68
|
+
|
69
|
+
def requirement_component_parse(node, out)
|
70
|
+
return if node["exclude"] == "true"
|
71
|
+
|
72
|
+
if inline?(node)
|
73
|
+
out.t do |p|
|
74
|
+
p << "INHERIT: " if node.name == "inherit"
|
75
|
+
node.children.each { |n| parse(n, p) }
|
76
|
+
end
|
77
|
+
else
|
78
|
+
node.children.each { |n| parse(n, out) }
|
72
79
|
end
|
73
|
-
else
|
74
|
-
node.children.each { |n| parse(n, out) }
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
78
83
|
end
|
79
|
-
|
@@ -52,6 +52,8 @@ module IsoDoc::Ietf
|
|
52
52
|
case node.name
|
53
53
|
when "bcp14" then bcp14_parse(node, out)
|
54
54
|
when "concept" then concept_parse(node, out)
|
55
|
+
when "verbal-definition", "non-verbal-representation"
|
56
|
+
node.elements.each { |n| parse(n, out) }
|
55
57
|
else
|
56
58
|
text = node.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
57
59
|
out.t { |p| p << text }
|
data/lib/isodoc/ietf/terms.rb
CHANGED
@@ -1,63 +1,70 @@
|
|
1
|
-
module IsoDoc
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module IsoDoc
|
2
|
+
module Ietf
|
3
|
+
class RfcConvert < ::IsoDoc::Convert
|
4
|
+
def definition_parse(node, out)
|
5
|
+
node.children.each { |n| parse(n, out) }
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def modification_parse(node, out)
|
9
|
+
para = node.at(ns("./p"))
|
10
|
+
out << " -- "
|
11
|
+
para.children.each { |n| parse(n, out) }
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
def deprecated_term_parse(node, out)
|
15
|
+
name = node.at(ns(".//name"))
|
16
|
+
out.t do |p|
|
17
|
+
p << l10n("#{@i18n.deprecated}: ")
|
18
|
+
name.children.each { |c| parse(c, p) }
|
19
|
+
end
|
17
20
|
end
|
18
|
-
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
def admitted_term_parse(node, out)
|
23
|
+
name = node.at(ns(".//name"))
|
24
|
+
out.t do |p|
|
25
|
+
name.children.each { |c| parse(c, p) }
|
26
|
+
end
|
23
27
|
end
|
24
|
-
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
def term_parse(node, out)
|
30
|
+
name = node.at(ns(".//name"))
|
31
|
+
out.name do |p|
|
32
|
+
name.children.each { |n| parse(n, p) }
|
33
|
+
end
|
29
34
|
end
|
30
|
-
end
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
def termnote_parse(node, out)
|
37
|
+
note_parse(node, out)
|
38
|
+
end
|
35
39
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
def termref_parse(node, out)
|
41
|
+
out.t do |p|
|
42
|
+
p << "SOURCE: "
|
43
|
+
node.children.each { |n| parse(n, p) }
|
44
|
+
end
|
40
45
|
end
|
41
|
-
end
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
def termdef_parse(node, out)
|
48
|
+
set_termdomain("")
|
49
|
+
node.xpath(ns("./definition")).size > 1 and
|
50
|
+
IsoDoc::PresentationXMLConvert.new({}).multidef(node)
|
51
|
+
clause_parse(node, out)
|
52
|
+
end
|
47
53
|
|
48
|
-
|
54
|
+
def termdocsource_parse(_node, _out); end
|
49
55
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
56
|
+
def concept_parse(node, out)
|
57
|
+
if d = node.at(ns("./renderterm"))
|
58
|
+
out.em do |em|
|
59
|
+
d.children.each { |n| parse(n, em) }
|
60
|
+
end
|
61
|
+
out << " "
|
54
62
|
end
|
55
|
-
out << " "
|
63
|
+
out << "[term defined in "
|
64
|
+
r = node.at(ns("./xref | ./eref | ./termref"))
|
65
|
+
parse(r, out)
|
66
|
+
out << "]"
|
56
67
|
end
|
57
|
-
out << "[term defined in "
|
58
|
-
r = node.at(ns("./xref | ./eref | ./termref"))
|
59
|
-
parse(r, out)
|
60
|
-
out << "]"
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
data/metanorma-ietf.gemspec
CHANGED
@@ -35,13 +35,11 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
37
37
|
|
38
|
-
spec.add_dependency "isodoc", "~> 1.7.0"
|
39
38
|
spec.add_dependency "mathml2asciimath"
|
40
39
|
spec.add_dependency "metanorma-ietf-data"
|
41
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
42
|
-
spec.add_dependency "open-uri"
|
40
|
+
spec.add_dependency "metanorma-standoc", "~> 1.11.0"
|
43
41
|
|
44
|
-
spec.add_development_dependency "
|
42
|
+
spec.add_development_dependency "debug"
|
45
43
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
46
44
|
spec.add_development_dependency "guard", "~> 2.14"
|
47
45
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.1
|
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-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: isodoc
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.7.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.7.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: mathml2asciimath
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,30 +44,16 @@ dependencies:
|
|
58
44
|
requirements:
|
59
45
|
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
47
|
+
version: 1.11.0
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
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'
|
54
|
+
version: 1.11.0
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
56
|
+
name: debug
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
59
|
- - ">="
|
@@ -286,6 +258,7 @@ files:
|
|
286
258
|
- lib/isodoc/ietf/SVG-1.2-RFC.rng
|
287
259
|
- lib/isodoc/ietf/blocks.rb
|
288
260
|
- lib/isodoc/ietf/cleanup.rb
|
261
|
+
- lib/isodoc/ietf/cleanup_inline.rb
|
289
262
|
- lib/isodoc/ietf/footnotes.rb
|
290
263
|
- lib/isodoc/ietf/front.rb
|
291
264
|
- lib/isodoc/ietf/i18n-en.yaml
|
@@ -329,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
329
302
|
- !ruby/object:Gem::Version
|
330
303
|
version: '0'
|
331
304
|
requirements: []
|
332
|
-
rubygems_version: 3.
|
305
|
+
rubygems_version: 3.2.22
|
333
306
|
signing_key:
|
334
307
|
specification_version: 4
|
335
308
|
summary: metanorma-ietf lets you write IETF documents, such as Internet-Drafts and
|