metanorma-ietf 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +0 -1
- data/.github/workflows/windows.yml +0 -1
- data/lib/asciidoctor/ietf/front.rb +3 -3
- data/lib/asciidoctor/ietf/isodoc.rng +12 -6
- data/lib/isodoc/ietf/blocks.rb +6 -4
- data/lib/isodoc/ietf/cleanup.rb +2 -1
- data/lib/isodoc/ietf/front.rb +14 -9
- data/lib/isodoc/ietf/reqt.rb +8 -3
- data/lib/isodoc/ietf/rfc_convert.rb +4 -4
- data/lib/isodoc/ietf/section.rb +6 -5
- data/lib/isodoc/ietf/terms.rb +1 -1
- data/lib/metanorma/ietf/processor.rb +4 -5
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08a3fef1af7e02a0c603e1304ccd50b2122efb82fb744f2f31e651fe90c13622'
|
4
|
+
data.tar.gz: 18eaa00b783bfb0308a5fc088ad78562b4ed6f21a950b0494603dc5d47c0933a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dff850b703e42b2f6ee3fe5a7408a6b8fc33eb05bd6987b48761ee5def3d62ba3acebc0332768de34b5b84201e4003adaddf4cfe70dde1b6c7aadda2eb21fb7
|
7
|
+
data.tar.gz: 6ab998721ba99fb4a82589c9cd3aa25e090b86535e6b8ecb953a6679b70910cf4165e5bf15787154fffb52090ccb2299476e913f35df444d0d8e5c160361dffc
|
data/.github/workflows/macos.yml
CHANGED
@@ -11,7 +11,7 @@ module Asciidoctor
|
|
11
11
|
|
12
12
|
def metadata_publisher(node, xml)
|
13
13
|
publishers = node.attr("publisher") || "IETF"
|
14
|
-
publishers
|
14
|
+
csv_split(publishers)&.each do |p|
|
15
15
|
xml.contributor do |c|
|
16
16
|
c.role **{ type: "publisher" }
|
17
17
|
c.organization { |a| organization(a, p) }
|
@@ -20,8 +20,8 @@ module Asciidoctor
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def metadata_copyright(node, xml)
|
23
|
-
publishers = node.attr("publisher") || "IETF"
|
24
|
-
publishers
|
23
|
+
publishers = node.attr("copyright-holder") || node.attr("publisher") || "IETF"
|
24
|
+
csv_split(publishers)&.each do |p|
|
25
25
|
xml.copyright do |c|
|
26
26
|
c.from (node.attr("copyright-year") || Date.today.year)
|
27
27
|
c.owner do |owner|
|
@@ -922,6 +922,9 @@
|
|
922
922
|
<optional>
|
923
923
|
<attribute name="script"/>
|
924
924
|
</optional>
|
925
|
+
<optional>
|
926
|
+
<attribute name="type"/>
|
927
|
+
</optional>
|
925
928
|
<optional>
|
926
929
|
<attribute name="obligation">
|
927
930
|
<choice>
|
@@ -961,9 +964,6 @@
|
|
961
964
|
</define>
|
962
965
|
<define name="content-subsection">
|
963
966
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
967
|
<ref name="Content-Section"/>
|
968
968
|
</element>
|
969
969
|
</define>
|
@@ -992,6 +992,9 @@
|
|
992
992
|
</choice>
|
993
993
|
</attribute>
|
994
994
|
</optional>
|
995
|
+
<optional>
|
996
|
+
<attribute name="type"/>
|
997
|
+
</optional>
|
995
998
|
<optional>
|
996
999
|
<ref name="section-title"/>
|
997
1000
|
</optional>
|
@@ -1011,9 +1014,6 @@
|
|
1011
1014
|
</define>
|
1012
1015
|
<define name="clause">
|
1013
1016
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1017
|
<ref name="Clause-Section"/>
|
1018
1018
|
</element>
|
1019
1019
|
</define>
|
@@ -1042,6 +1042,9 @@
|
|
1042
1042
|
</choice>
|
1043
1043
|
</attribute>
|
1044
1044
|
</optional>
|
1045
|
+
<optional>
|
1046
|
+
<attribute name="type"/>
|
1047
|
+
</optional>
|
1045
1048
|
<optional>
|
1046
1049
|
<ref name="section-title"/>
|
1047
1050
|
</optional>
|
@@ -1180,6 +1183,9 @@
|
|
1180
1183
|
<optional>
|
1181
1184
|
<attribute name="script"/>
|
1182
1185
|
</optional>
|
1186
|
+
<optional>
|
1187
|
+
<attribute name="type"/>
|
1188
|
+
</optional>
|
1183
1189
|
<optional>
|
1184
1190
|
<attribute name="obligation">
|
1185
1191
|
<choice>
|
data/lib/isodoc/ietf/blocks.rb
CHANGED
@@ -72,7 +72,9 @@ module IsoDoc::Ietf
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def note_label(node)
|
75
|
-
|
75
|
+
n = @xrefs.get[node["id"]]
|
76
|
+
return l10n("#{@i18n.note}: ") if n.nil? || n[:label].nil? || n[:label].empty?
|
77
|
+
l10n("#{@i18n.note} #{n[:label]}: ")
|
76
78
|
end
|
77
79
|
|
78
80
|
def note_parse(node, out)
|
@@ -96,8 +98,8 @@ module IsoDoc::Ietf
|
|
96
98
|
def example_label(node, div, name)
|
97
99
|
n = @xrefs.get[node["id"]]
|
98
100
|
div.t **attr_code(anchor: node["id"], keepWithNext: "true") do |p|
|
99
|
-
lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @
|
100
|
-
l10n("#{@
|
101
|
+
lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @i18n.example :
|
102
|
+
l10n("#{@i18n.example} #{n[:label]}")
|
101
103
|
p << lbl
|
102
104
|
name and !lbl.nil? and p << ": "
|
103
105
|
name and name.children.each { |n| parse(n, p) }
|
@@ -137,7 +139,7 @@ module IsoDoc::Ietf
|
|
137
139
|
|
138
140
|
def formula_where(dl, out)
|
139
141
|
return unless dl
|
140
|
-
out.t { |p| p << @
|
142
|
+
out.t { |p| p << @i18n.where }
|
141
143
|
parse(dl, out)
|
142
144
|
end
|
143
145
|
|
data/lib/isodoc/ietf/cleanup.rb
CHANGED
@@ -157,7 +157,8 @@ module IsoDoc::Ietf
|
|
157
157
|
s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n").
|
158
158
|
gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
|
159
159
|
sourcecode_remove_markup(s)
|
160
|
-
|
160
|
+
text = HTMLEntities.new.decode(s.children.to_xml.sub(/\A\n+/, ""))
|
161
|
+
s.children = "<![CDATA[#{text}]]>"
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
data/lib/isodoc/ietf/front.rb
CHANGED
@@ -23,11 +23,16 @@ module IsoDoc::Ietf
|
|
23
23
|
super
|
24
24
|
end
|
25
25
|
|
26
|
+
def output_if_translit(text)
|
27
|
+
return nil if text.nil?
|
28
|
+
text.transliterate != text ? text.transliterate : nil
|
29
|
+
end
|
30
|
+
|
26
31
|
def title(isoxml, front)
|
27
32
|
title = @meta.get[:doctitle] or return
|
28
33
|
front.title title, **attr_code(abbrev: @meta.get[:docabbrev],
|
29
|
-
ascii: @meta.get[:docascii] ||
|
30
|
-
title
|
34
|
+
ascii: (@meta.get[:docascii] ||
|
35
|
+
output_if_translit(title)))
|
31
36
|
end
|
32
37
|
|
33
38
|
def seriesinfo(isoxml, front)
|
@@ -37,7 +42,7 @@ module IsoDoc::Ietf
|
|
37
42
|
|
38
43
|
def seriesinfo_attr(isoxml)
|
39
44
|
attr_code(value: @meta.get[:docnumber] || "",
|
40
|
-
asciiValue: @meta.get[:docnumber]
|
45
|
+
asciiValue: output_if_translit(@meta.get[:docnumber]),
|
41
46
|
status: @meta.get[:stage],
|
42
47
|
stream: isoxml&.at(ns("//bibdata/series[@type = 'stream']/"\
|
43
48
|
"title"))&.text)
|
@@ -82,9 +87,9 @@ module IsoDoc::Ietf
|
|
82
87
|
|
83
88
|
def pers_author_attrs1(ret, full, init, c)
|
84
89
|
full and ret.merge!(attr_code(
|
85
|
-
asciiFullname: full
|
86
|
-
asciiInitials: init
|
87
|
-
asciiSurname: c&.at(ns("./surname"))
|
90
|
+
asciiFullname: output_if_translit(full),
|
91
|
+
asciiInitials: output_if_translit(init),
|
92
|
+
asciiSurname: output_if_translit(c&.at(ns("./surname")))))
|
88
93
|
ret
|
89
94
|
end
|
90
95
|
|
@@ -113,8 +118,8 @@ module IsoDoc::Ietf
|
|
113
118
|
def organization(org, out, show)
|
114
119
|
name = org.at(ns("./name"))&.text
|
115
120
|
out.organization name, **attr_code(
|
116
|
-
showOnFrontPage: show&.text, ascii: name
|
117
|
-
asciiAbbrev: org
|
121
|
+
showOnFrontPage: show&.text, ascii: output_if_translit(name),
|
122
|
+
asciiAbbrev: output_if_translit(org.at(ns("./abbreviation"))),
|
118
123
|
abbrev: org.at(ns("./abbreviation")))
|
119
124
|
end
|
120
125
|
|
@@ -163,7 +168,7 @@ module IsoDoc::Ietf
|
|
163
168
|
|
164
169
|
def date(isoxml, front)
|
165
170
|
date = @meta.get[:publisheddate] || @meta.get[:circulateddate] || return
|
166
|
-
date.gsub
|
171
|
+
date = date.gsub(/T.*$/, "")
|
167
172
|
attr = date_attr(date) || return
|
168
173
|
front.date **attr_code(attr)
|
169
174
|
end
|
data/lib/isodoc/ietf/reqt.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
module IsoDoc::Ietf
|
2
2
|
class RfcConvert < ::IsoDoc::Convert
|
3
|
+
def recommendation_labels(node)
|
4
|
+
[node.at(ns("./label")), node.at(ns("./title")),
|
5
|
+
@xrefs.anchor(node['id'], :label, false)]
|
6
|
+
end
|
7
|
+
|
3
8
|
def recommendation_name(node, out, type)
|
4
9
|
label, title, lbl = recommendation_labels(node)
|
5
10
|
out.t **{ keepWithNext: "true" } do |b|
|
@@ -27,7 +32,7 @@ module IsoDoc::Ietf
|
|
27
32
|
end
|
28
33
|
|
29
34
|
def recommendation_parse(node, out)
|
30
|
-
recommendation_name(node, out, @
|
35
|
+
recommendation_name(node, out, @i18n.recommendation)
|
31
36
|
recommendation_attributes(node, out)
|
32
37
|
node.children.each do |n|
|
33
38
|
parse(n, out) unless %w(label title).include? n.name
|
@@ -35,7 +40,7 @@ module IsoDoc::Ietf
|
|
35
40
|
end
|
36
41
|
|
37
42
|
def requirement_parse(node, out)
|
38
|
-
recommendation_name(node, out, @
|
43
|
+
recommendation_name(node, out, @i18n.requirement)
|
39
44
|
recommendation_attributes(node, out)
|
40
45
|
node.children.each do |n|
|
41
46
|
parse(n, out) unless %w(label title).include? n.name
|
@@ -43,7 +48,7 @@ module IsoDoc::Ietf
|
|
43
48
|
end
|
44
49
|
|
45
50
|
def permission_parse(node, out)
|
46
|
-
recommendation_name(node, out, @
|
51
|
+
recommendation_name(node, out, @i18n.permission)
|
47
52
|
recommendation_attributes(node, out)
|
48
53
|
node.children.each do |n|
|
49
54
|
parse(n, out) unless %w(label title).include? n.name
|
@@ -27,12 +27,12 @@ module IsoDoc::Ietf
|
|
27
27
|
set_pis(docxml, Nokogiri::XML(xml))
|
28
28
|
end
|
29
29
|
|
30
|
-
def metadata_init(lang, script,
|
31
|
-
@meta = Metadata.new(lang, script,
|
30
|
+
def metadata_init(lang, script, i18n)
|
31
|
+
@meta = Metadata.new(lang, script, i18n)
|
32
32
|
end
|
33
33
|
|
34
|
-
def xref_init(lang, script, klass,
|
35
|
-
@xrefs = Xref.new(lang, script, klass,
|
34
|
+
def xref_init(lang, script, klass, i18n, options)
|
35
|
+
@xrefs = Xref.new(lang, script, klass, i18n, options)
|
36
36
|
end
|
37
37
|
|
38
38
|
def extract_delims(text)
|
data/lib/isodoc/ietf/section.rb
CHANGED
@@ -63,6 +63,7 @@ module IsoDoc::Ietf
|
|
63
63
|
category: series2category(
|
64
64
|
docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text),
|
65
65
|
ipr: docxml&.at(ns("//bibdata/ext/ipr"))&.text,
|
66
|
+
consensus: docxml&.at(ns("//bibdata/ext/consensus"))&.text,
|
66
67
|
obsoletes: obs,
|
67
68
|
updates: upd,
|
68
69
|
indexInclude: docxml&.at(ns("//bibdata/ext/indexInclude"))&.text,
|
@@ -81,11 +82,11 @@ module IsoDoc::Ietf
|
|
81
82
|
|
82
83
|
def series2category(series)
|
83
84
|
case series&.downcase
|
84
|
-
when "standard" then "std"
|
85
|
-
when "informational" then "info"
|
86
|
-
when "experimental" then "exp"
|
85
|
+
when "standard", "std" then "std"
|
86
|
+
when "informational", "info" then "info"
|
87
|
+
when "experimental", "exp" then "exp"
|
87
88
|
when "bcp" then "bcp"
|
88
|
-
when "fyi" then "info"
|
89
|
+
when "fyi", "info" then "info"
|
89
90
|
when "full-standard" then "std"
|
90
91
|
when "historic" then "historic"
|
91
92
|
else
|
@@ -132,7 +133,7 @@ module IsoDoc::Ietf
|
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
135
|
-
def clause_parse_title(node, div, c1, out)
|
136
|
+
def clause_parse_title(node, div, c1, out, _heading_attrs = {})
|
136
137
|
return unless c1
|
137
138
|
div.name do |n|
|
138
139
|
c1&.children&.each { |c2| parse(c2, n) }
|
data/lib/isodoc/ietf/terms.rb
CHANGED
@@ -26,11 +26,6 @@ module Metanorma
|
|
26
26
|
"Metanorma::Ietf #{::Metanorma::Ietf::VERSION}"
|
27
27
|
end
|
28
28
|
|
29
|
-
def input_to_isodoc(file, filename)
|
30
|
-
# This is XML RFC v3 output in text
|
31
|
-
Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
|
32
|
-
end
|
33
|
-
|
34
29
|
def extract_options(isodocxml)
|
35
30
|
{}
|
36
31
|
end
|
@@ -48,6 +43,10 @@ module Metanorma
|
|
48
43
|
nil
|
49
44
|
end
|
50
45
|
|
46
|
+
def use_presentation_xml(ext)
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
51
50
|
def xml2rfc_present?
|
52
51
|
!which("xml2rfc").nil?
|
53
52
|
end
|
data/metanorma-ietf.gemspec
CHANGED
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
37
37
|
|
38
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
39
|
-
spec.add_dependency "isodoc", "~> 1.
|
38
|
+
spec.add_dependency "metanorma-standoc", "~> 1.5.0"
|
39
|
+
spec.add_dependency "isodoc", "~> 1.2.0"
|
40
40
|
spec.add_dependency "mathml2asciimath"
|
41
41
|
|
42
42
|
spec.add_development_dependency "byebug"
|
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.1
|
4
|
+
version: 2.2.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: 2020-
|
11
|
+
date: 2020-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: isodoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mathml2asciimath
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|