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.
@@ -1,79 +1,83 @@
1
- module IsoDoc::Ietf
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
-
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
- if label || title
14
- out.t **{ keepWithNext: "true" } do |b|
15
- label and label.children.each { |n| parse(n,b) }
16
- b << "#{clausedelim} " if label && title
17
- title and title.children.each { |n| parse(n,b) }
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
- def recommendation_attributes(node, out)
23
- ret = recommendation_attributes1(node)
24
- return if ret.empty?
25
- out.ul do |p|
26
- ret.each do |l|
27
- p.li do |i|
28
- i.em { |e| i << l }
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
- def recommendation_parse(node, out)
35
- recommendation_name(node, out, @i18n.recommendation)
36
- recommendation_attributes(node, out)
37
- node.children.each do |n|
38
- parse(n, out) unless %w(label title).include? n.name
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
- def requirement_parse(node, out)
43
- recommendation_name(node, out, @i18n.requirement)
44
- recommendation_attributes(node, out)
45
- node.children.each do |n|
46
- parse(n, out) unless %w(label title).include? n.name
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
- def permission_parse(node, out)
51
- recommendation_name(node, out, @i18n.permission)
52
- recommendation_attributes(node, out)
53
- node.children.each do |n|
54
- parse(n, out) unless %w(label title).include? n.name
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
- def inline?(node)
59
- return true if node.first_element_child.nil?
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
- def requirement_component_parse(node, out)
66
- return if node["exclude"] == "true"
67
- out1 = out
68
- if inline?(node)
69
- out.t do |p|
70
- p << "INHERIT: " if node.name == "inherit"
71
- node.children.each { |n| parse(n, p) }
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(/</, "&lt;").gsub(/>/, "&gt;")
57
59
  out.t { |p| p << text }
@@ -1,63 +1,70 @@
1
- module IsoDoc::Ietf
2
- class RfcConvert < ::IsoDoc::Convert
3
- def definition_parse(node, out)
4
- node.children.each { |n| parse(n, out) }
5
- end
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
- def modification_parse(node, out)
8
- para = node.at(ns("./p"))
9
- out << " -- "
10
- para.children.each { |n| parse(n, out) }
11
- end
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
- def deprecated_term_parse(node, out)
14
- out.t do |p|
15
- p << l10n("#{@i18n.deprecated}: ")
16
- node.children.each { |c| parse(c, p) }
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
- def admitted_term_parse(node, out)
21
- out.t do |p|
22
- node.children.each { |c| parse(c, p) }
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
- def term_parse(node, out)
27
- out.name do |p|
28
- node.children.each { |n| parse(n, p) }
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
- def termnote_parse(node, out)
33
- note_parse(node, out)
34
- end
36
+ def termnote_parse(node, out)
37
+ note_parse(node, out)
38
+ end
35
39
 
36
- def termref_parse(node, out)
37
- out.t do |p|
38
- p << "SOURCE: "
39
- node.children.each { |n| parse(n, p) }
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
- def termdef_parse(node, out)
44
- set_termdomain("")
45
- clause_parse(node, out)
46
- end
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
- def termdocsource_parse(_node, _out); end
54
+ def termdocsource_parse(_node, _out); end
49
55
 
50
- def concept_parse(node, out)
51
- if d = node.at(ns("./renderterm"))
52
- out.em do |em|
53
- d.children.each { |n| parse(n, em) }
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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.4.3".freeze
3
+ VERSION = "2.5.1".freeze
4
4
  end
5
5
  end
@@ -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.10.0"
42
- spec.add_dependency "open-uri"
40
+ spec.add_dependency "metanorma-standoc", "~> 1.11.0"
43
41
 
44
- spec.add_development_dependency "byebug"
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.3
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-09-29 00:00:00.000000000 Z
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.10.0
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.10.0
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: byebug
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.1.4
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