metanorma-ietf 3.1.1 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4d0bbd3e456f5931f3ed658e68543d2026df26a3a09c6b30d8a5e79e7111070
4
- data.tar.gz: 0f494d74e351587cc0927be2eefd7c749f36d73572317b1ca294c04c3c80ec2f
3
+ metadata.gz: a6684b3f6e7543eb652b530245313c23cdf5e37694caa7887f8205b701c65445
4
+ data.tar.gz: e653280e65513f5462f7e24a99d23466148a93f9baa3ee298ead13f15ddd6a1c
5
5
  SHA512:
6
- metadata.gz: 4e9c9d9fea112a2a1d82720a98a3dbb945d9ba478429c09a319316e6fb93654c7cdcc8b58274916ae55834f7a799c3e959d9dfbb4ef8806820d29b681a7b565b
7
- data.tar.gz: ba76888850b0540bc9674f5ce5881926227299f7277c807c1d4d46af319029f98eb51a563e21f0f04c1b81748cc10e2e1bc29fac6283c3cd5d08ce5ece2e242e
6
+ metadata.gz: 210560d5093b93d01276d4c7fc97914b7b4b46f68899262019af3491e680dda0c3155ab9daef7035a7ffc0b6fe90350d291183b6546b844155040f59877a9457
7
+ data.tar.gz: 17be8103a4b71ab1cde206fdc0429379f803d912332f4adba1a31c36d0d6834d317eb1a89e6d4b603de135570260381327a6a605cf2e79d9da5782931b102fe7
@@ -187,10 +187,10 @@ module IsoDoc
187
187
  end
188
188
 
189
189
  def aside_cleanup(docxml)
190
- docxml.xpath("//t[descendant::aside] | //table[descendant::aside] | "\
191
- "//figure[descendant::aside]").each do |p|
190
+ docxml.xpath("//*[aside]").each do |p|
191
+ %w(section).include?(p.name) and next
192
192
  insert = p
193
- p.xpath(".//aside").each do |a|
193
+ p.xpath("./aside").each do |a|
194
194
  insert.next = a.remove
195
195
  insert = insert.next_element
196
196
  end
@@ -26,7 +26,7 @@ module IsoDoc::Ietf
26
26
  def output_if_translit(text)
27
27
  return nil if text.nil?
28
28
 
29
- text.transliterate != text ? text.transliterate : nil
29
+ text.transliterate == text ? nil : text.transliterate
30
30
  end
31
31
 
32
32
  def title(_isoxml, front)
@@ -45,7 +45,7 @@ module IsoDoc::Ietf
45
45
  attr_code(value: @meta.get[:docnumber] || "",
46
46
  asciiValue: output_if_translit(@meta.get[:docnumber]),
47
47
  status: @meta.get[:stage],
48
- stream: isoxml&.at(ns("//bibdata/series[@type = 'stream']/"\
48
+ stream: isoxml&.at(ns("//bibdata/series[@type = 'stream']/" \
49
49
  "title"))&.text)
50
50
  end
51
51
 
@@ -69,10 +69,10 @@ module IsoDoc::Ietf
69
69
  end
70
70
 
71
71
  def author(isoxml, front)
72
- isoxml.xpath(("//xmlns:bibdata/xmlns:contributor[xmlns:role/@type = "\
73
- "'author' or xmlns:role/@type = 'editor']")).each do |c|
72
+ isoxml.xpath(("//xmlns:bibdata/xmlns:contributor[xmlns:role/@type = " \
73
+ "'author' or xmlns:role/@type = 'editor']")).each do |c|
74
74
  role = c.at(ns("./role/@type")).text == "editor" ? "editor" : nil
75
- c.at("./organization") and org_author(c, role, front) or
75
+ (c.at("./organization") and org_author(c, role, front)) or
76
76
  person_author(c, role, front)
77
77
  end
78
78
  end
@@ -148,7 +148,7 @@ module IsoDoc::Ietf
148
148
  out.postal do |p|
149
149
  if line = addr.at(ns("./formattedAddress"))
150
150
  line.xpath(ns(".//br")).each { |br| br.replace("\n") }
151
- line.text.split(/\n/).each do |l|
151
+ line.text.split("\n").each do |l|
152
152
  p.postalLine l, **attr_code(ascii: l.transliterate)
153
153
  end
154
154
  else
@@ -1,5 +1,5 @@
1
- term_def_boilerplate:
2
- no_terms_boilerplate:
3
- internal_terms_boilerplate:
4
- external_terms_boilerplate:
5
- internal_external_terms_boilerplate:
1
+ term_def_boilerplate: ""
2
+ no_terms_boilerplate: ""
3
+ internal_terms_boilerplate: ""
4
+ external_terms_boilerplate: ""
5
+ internal_external_terms_boilerplate: ""
@@ -1,16 +1,14 @@
1
1
  module IsoDoc
2
2
  module Ietf
3
3
  class RfcConvert < ::IsoDoc::Convert
4
- # TODO displayreference will be implemented as combination of autofetch and user-provided citations
5
-
6
4
  def bibliography(isoxml, out)
7
5
  isoxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
8
6
  i.children = docid_prefix(i["type"], i.text)
9
7
  end
10
- isoxml.xpath(ns("//bibliography/references | "\
11
- "//bibliography/clause[.//references] | "\
12
- "//annex/clause[.//references] | "\
13
- "//annex/references | "\
8
+ isoxml.xpath(ns("//bibliography/references | " \
9
+ "//bibliography/clause[.//references] | " \
10
+ "//annex/clause[.//references] | " \
11
+ "//annex/references | " \
14
12
  "//sections/clause[.//references]")).each do |f|
15
13
  bibliography1(f, out)
16
14
  end
@@ -64,15 +62,15 @@ module IsoDoc
64
62
  !id[:sdo].nil? && id[:sdo] != "(NO ID)" and out.refcontent id[:sdo]
65
63
  docidentifiers&.each do |u|
66
64
  u["type"] == "DOI" and
67
- out.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI /, ""),
65
+ out.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI[  ]/, ""),
68
66
  name: "DOI")
69
67
  %w(IETF RFC).include?(u["type"]) and docidentifier_ietf(u, out)
70
68
  end
71
69
  end
72
70
 
73
71
  def docidentifier_ietf(ident, out)
74
- if /^RFC /.match?(ident.text)
75
- out.seriesInfo nil, **attr_code(value: ident.text.sub(/^RFC 0*/, ""),
72
+ if /^RFC[  ]/.match?(ident.text)
73
+ out.seriesInfo nil, **attr_code(value: ident.text.sub(/^RFC[  ]0*/, ""),
76
74
  name: "RFC")
77
75
  elsif /^I-D\./.match?(ident.text)
78
76
  out.seriesInfo nil, **attr_code(value: ident.text.sub(/^I-D\./, ""),
@@ -99,26 +97,24 @@ module IsoDoc
99
97
  end
100
98
 
101
99
  def relaton_to_author(bib, node)
102
- auths = bib.xpath(ns("./contributor[xmlns:role/@type = 'author' or "\
100
+ auths = bib.xpath(ns("./contributor[xmlns:role/@type = 'author' or " \
103
101
  "xmlns:role/@type = 'editor']"))
104
102
  auths.empty? and
105
- auths = bib.xpath(ns("./contributor[xmlns:role/@type = "\
103
+ auths = bib.xpath(ns("./contributor[xmlns:role/@type = " \
106
104
  "'publisher']"))
107
105
  auths.each do |a|
108
106
  role = a.at(ns("./role[@type = 'editor']")) ? "editor" : nil
109
- p = a&.at(ns("./person/name")) and
110
- relaton_person_to_author(p, role, node) or
107
+ (p = a&.at(ns("./person/name")) and
108
+ relaton_person_to_author(p, role, node)) or
111
109
  relaton_org_to_author(a&.at(ns("./organization")), role, node)
112
110
  end
113
111
  end
114
112
 
115
113
  def relaton_person_to_author(pers, role, node)
116
- full = pers&.at(ns("./completename"))&.text
117
- surname = pers&.at(ns("./surname"))&.text
118
- initials = pers&.xpath(ns("./initial"))&.map do |i|
119
- i.text
120
- end&.join(" ") ||
121
- pers&.xpath(ns("./forename"))&.map { |i| i.text[0] }&.join(" ")
114
+ full = pers.at(ns("./completename"))&.text
115
+ surname = pers.at(ns("./surname"))&.text
116
+ initials = pers.xpath(ns("./initial"))&.map(&:text)&.join(" ") ||
117
+ pers.xpath(ns("./forename"))&.map { |i| i.text[0] }&.join(" ")
122
118
  initials = nil if initials.empty?
123
119
  node.author nil, **attr_code(
124
120
  fullname: full,
@@ -143,9 +139,8 @@ module IsoDoc
143
139
  date = bib.at(ns("./date[@type = 'published']")) ||
144
140
  bib.at(ns("./date[@type = 'issued']")) ||
145
141
  bib.at(ns("./date[@type = 'circulated']"))
146
- return unless date
147
-
148
- attr = date_attr(date&.at(ns("./on | ./from"))&.text) || return
142
+ date or return
143
+ attr = date_attr(date.at(ns("./on | ./from"))&.text) or return
149
144
  node.date **attr_code(attr)
150
145
  end
151
146
 
@@ -1,178 +1,178 @@
1
- module IsoDoc::Ietf
2
- class RfcConvert < ::IsoDoc::Convert
3
- def common_rfc_pis(node)
4
- rfc_pis = {
5
- artworkdelimiter: node&.at(ns("//pi/artworkdelimiter"))&.text,
6
- artworklines: node&.at(ns("//pi/artworklines"))&.text,
7
- authorship: node&.at(ns("//pi/authorship"))&.text,
8
- autobreaks: node&.at(ns("//pi/autobreaks"))&.text,
9
- background: node&.at(ns("//pi/background"))&.text,
10
- colonspace: node&.at(ns("//pi/colonspace"))&.text,
11
- comments: node&.at(ns("//pi/comments"))&.text,
12
- docmapping: node&.at(ns("//pi/docmapping"))&.text,
13
- editing: node&.at(ns("//pi/editing"))&.text,
14
- emoticonic: node&.at(ns("//pi/emoticonic"))&.text,
15
- footer: node&.at(ns("//pi/footer"))&.text,
16
- header: node&.at(ns("//pi/header"))&.text,
17
- inline: node&.at(ns("//pi/inline"))&.text,
18
- iprnotified: node&.at(ns("//pi/iprnotified"))&.text,
19
- linkmailto: node&.at(ns("//pi/linkmailto"))&.text,
20
- linefile: node&.at(ns("//pi/linefile"))&.text,
21
- notedraftinprogress: node&.at(ns("//pi/notedraftinprogress"))&.text,
22
- private: node&.at(ns("//pi/private"))&.text,
23
- refparent: node&.at(ns("//pi/refparent"))&.text,
24
- rfcedstyle: node&.at(ns("//pi/rfcedstyle"))&.text,
25
- slides: node&.at(ns("//pi/slides"))&.text,
26
- "text-list-symbols": node&.at(ns("//pi/text-list-symbols"))&.text,
27
- tocappendix: node&.at(ns("//pi/tocappendix"))&.text,
28
- tocindent: node&.at(ns("//pi/tocindent"))&.text,
29
- tocnarrow: node&.at(ns("//pi/tocnarrow"))&.text,
30
- tocompact: node&.at(ns("//pi/tocompact"))&.text,
31
- topblock: node&.at(ns("//pi/topblock"))&.text,
32
- useobject: node&.at(ns("//pi/useobject"))&.text,
33
- strict: node&.at(ns("//pi/strict"))&.text || "yes",
34
- compact: node&.at(ns("//pi/compact"))&.text || "yes",
35
- subcompact: node&.at(ns("//pi/subcompact"))&.text || "no",
36
- toc: node&.at(ns("//pi/tocinclude"))&.text,
37
- tocdepth: node&.at(ns("//pi/toc-depth"))&.text || "4",
38
- symrefs: node&.at(ns("//pi/sym-refs"))&.text || "yes",
39
- sortrefs: node&.at(ns("//pi/sort-refs"))&.text || "yes",
40
- }
41
- attr_code(rfc_pis)
42
- end
1
+ module IsoDoc
2
+ module Ietf
3
+ class RfcConvert < ::IsoDoc::Convert
4
+ def common_rfc_pis(node)
5
+ rfc_pis = {
6
+ artworkdelimiter: node&.at(ns("//pi/artworkdelimiter"))&.text,
7
+ artworklines: node&.at(ns("//pi/artworklines"))&.text,
8
+ authorship: node&.at(ns("//pi/authorship"))&.text,
9
+ autobreaks: node&.at(ns("//pi/autobreaks"))&.text,
10
+ background: node&.at(ns("//pi/background"))&.text,
11
+ colonspace: node&.at(ns("//pi/colonspace"))&.text,
12
+ comments: node&.at(ns("//pi/comments"))&.text,
13
+ docmapping: node&.at(ns("//pi/docmapping"))&.text,
14
+ editing: node&.at(ns("//pi/editing"))&.text,
15
+ emoticonic: node&.at(ns("//pi/emoticonic"))&.text,
16
+ footer: node&.at(ns("//pi/footer"))&.text,
17
+ header: node&.at(ns("//pi/header"))&.text,
18
+ inline: node&.at(ns("//pi/inline"))&.text,
19
+ iprnotified: node&.at(ns("//pi/iprnotified"))&.text,
20
+ linkmailto: node&.at(ns("//pi/linkmailto"))&.text,
21
+ linefile: node&.at(ns("//pi/linefile"))&.text,
22
+ notedraftinprogress: node&.at(ns("//pi/notedraftinprogress"))&.text,
23
+ private: node&.at(ns("//pi/private"))&.text,
24
+ refparent: node&.at(ns("//pi/refparent"))&.text,
25
+ rfcedstyle: node&.at(ns("//pi/rfcedstyle"))&.text,
26
+ slides: node&.at(ns("//pi/slides"))&.text,
27
+ "text-list-symbols": node&.at(ns("//pi/text-list-symbols"))&.text,
28
+ tocappendix: node&.at(ns("//pi/tocappendix"))&.text,
29
+ tocindent: node&.at(ns("//pi/tocindent"))&.text,
30
+ tocnarrow: node&.at(ns("//pi/tocnarrow"))&.text,
31
+ tocompact: node&.at(ns("//pi/tocompact"))&.text,
32
+ topblock: node&.at(ns("//pi/topblock"))&.text,
33
+ useobject: node&.at(ns("//pi/useobject"))&.text,
34
+ strict: node&.at(ns("//pi/strict"))&.text || "yes",
35
+ compact: node&.at(ns("//pi/compact"))&.text || "yes",
36
+ subcompact: node&.at(ns("//pi/subcompact"))&.text || "no",
37
+ toc: node&.at(ns("//pi/tocinclude"))&.text,
38
+ tocdepth: node&.at(ns("//pi/toc-depth"))&.text || "4",
39
+ symrefs: node&.at(ns("//pi/sym-refs"))&.text || "yes",
40
+ sortrefs: node&.at(ns("//pi/sort-refs"))&.text || "yes",
41
+ }
42
+ attr_code(rfc_pis)
43
+ end
43
44
 
44
- def set_pis(node, doc)
45
- rfc_pis = common_rfc_pis(node)
46
- rfc_pis.each_pair do |k, v|
47
- pi = Nokogiri::XML::ProcessingInstruction.new(doc, "rfc",
48
- "#{k}=\"#{v}\"")
49
- doc.root.add_previous_sibling(pi)
45
+ def set_pis(node, doc)
46
+ rfc_pis = common_rfc_pis(node)
47
+ rfc_pis.each_pair do |k, v|
48
+ pi = Nokogiri::XML::ProcessingInstruction.new(doc, "rfc",
49
+ "#{k}=\"#{v}\"")
50
+ doc.root.add_previous_sibling(pi)
51
+ end
52
+ doc.to_xml
50
53
  end
51
- doc.to_xml
52
- end
53
54
 
54
- def rfc_attributes(docxml)
55
- t = Time.now.getutc
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
- {
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,
76
- submissionType: docxml&.at(ns(
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",
82
- }
83
- end
55
+ def rfc_attributes(docxml)
56
+ # t = Time.now.getutc
57
+ obs = xpath_comma(docxml
58
+ .xpath(ns("//bibdata/relation[@type = 'obsoletes']/bibitem/docidentifier")))
59
+ upd = xpath_comma(docxml
60
+ .xpath(ns("//bibdata/relation[@type = 'updates']/bibitem/docidentifier")))
61
+ {
62
+ docName: @meta.get[:doctype] == "Internet Draft" ? @meta.get[:docnumber] : nil,
63
+ number: @meta.get[:doctype].casecmp?("rfc") ? @meta.get[:docnumber] : nil,
64
+ category: series2category(
65
+ docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text,
66
+ ),
67
+ ipr: docxml&.at(ns("//bibdata/ext/ipr"))&.text,
68
+ consensus: docxml&.at(ns("//bibdata/ext/consensus"))&.text,
69
+ obsoletes: obs,
70
+ updates: upd,
71
+ indexInclude: docxml&.at(ns("//bibdata/ext/indexInclude"))&.text,
72
+ iprExtract: docxml&.at(ns("//bibdata/ext/iprExtract"))&.text,
73
+ sortRefs: docxml&.at(ns("//bibdata/ext/sortRefs"))&.text,
74
+ symRefs: docxml&.at(ns("//bibdata/ext/symRefs"))&.text,
75
+ tocInclude: docxml&.at(ns("//bibdata/ext/tocInclude"))&.text,
76
+ tocDepth: docxml&.at(ns("//bibdata/ext/tocDepth"))&.text,
77
+ submissionType: docxml&.at(ns(
78
+ "//bibdata/series[@type = 'stream']/title",
79
+ ))&.text || "IETF",
80
+ "xml:lang": docxml&.at(ns("//bibdata/language"))&.text,
81
+ version: "3",
82
+ "xmlns:xi": "http://www.w3.org/2001/XInclude",
83
+ }
84
+ end
84
85
 
85
- def series2category(series)
86
- case series&.downcase
87
- when "standard", "std" then "std"
88
- when "informational", "info" then "info"
89
- when "experimental", "exp" then "exp"
90
- when "bcp" then "bcp"
91
- when "fyi" then "info"
92
- when "full-standard" then "std"
93
- when "historic" then "historic"
94
- else
95
- "std"
86
+ def series2category(series)
87
+ case series&.downcase
88
+ when "standard", "std", "full-standard" then "std"
89
+ when "informational", "info", "fyi" then "info"
90
+ when "experimental", "exp" then "exp"
91
+ when "bcp" then "bcp"
92
+ when "historic" then "historic"
93
+ else
94
+ "std"
95
+ end
96
96
  end
97
- end
98
97
 
99
- def xpath_comma(xpath)
100
- return nil if xpath.empty?
98
+ def xpath_comma(xpath)
99
+ return nil if xpath.empty?
101
100
 
102
- xpath.map(&:text).join(", ")
103
- end
101
+ xpath.map(&:text).join(", ")
102
+ end
104
103
 
105
- def make_link(out, isoxml)
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"]) }
104
+ def make_link(out, isoxml)
105
+ links = isoxml
106
+ .xpath(ns("//bibdata/relation[@type = 'includedIn' or " \
107
+ "@type = 'describedBy' or @type = 'derivedFrom' or " \
108
+ "@type = 'instance']")) || return
109
+ links.each do |l|
110
+ out.link href: l&.at(ns("./bibitem/docidentifier"))&.text,
111
+ rel: rel2iana(l["type"])
112
+ end
113
113
  end
114
- end
115
114
 
116
- def rel2iana(type)
117
- case type
118
- when "includedIn" then "item"
119
- when "describedBy" then "describedby"
120
- when "derivedFrom" then "convertedfrom"
121
- when "instance" then "alternate"
122
- else
123
- "alternate"
115
+ def rel2iana(type)
116
+ case type
117
+ when "includedIn" then "item"
118
+ when "describedBy" then "describedby"
119
+ when "derivedFrom" then "convertedfrom"
120
+ when "instance" then "alternate"
121
+ else
122
+ "alternate"
123
+ end
124
124
  end
125
- end
126
125
 
127
- def make_middle(out, isoxml)
128
- out.middle do |middle|
129
- clause isoxml, middle
126
+ def make_middle(out, isoxml)
127
+ out.middle do |middle|
128
+ clause isoxml, middle
129
+ end
130
130
  end
131
- end
132
131
 
133
- def make_back(out, isoxml)
134
- out.back do |back|
135
- bibliography isoxml, back
136
- annex isoxml, back
132
+ def make_back(out, isoxml)
133
+ out.back do |back|
134
+ bibliography isoxml, back
135
+ annex isoxml, back
136
+ end
137
137
  end
138
- end
139
138
 
140
- def clause_parse_title(_node, div, clause, _out, _heading_attrs = {})
141
- return unless clause
139
+ def clause_parse_title(_node, div, clause, _out, _heading_attrs = {})
140
+ return unless clause
142
141
 
143
- div.name do |n|
144
- clause&.children&.each { |c2| parse(c2, n) }
142
+ div.name do |n|
143
+ clause&.children&.each { |c2| parse(c2, n) }
144
+ end
145
145
  end
146
- end
147
146
 
148
- def clause_parse(node, out)
149
- return if node.at(ns(".//references"))
147
+ def clause_parse(node, out)
148
+ return if node.at(ns(".//references"))
150
149
 
151
- out.section **attr_code(
152
- anchor: node["id"], numbered: node["numbered"],
153
- removeInRFC: node["removeInRFC"], toc: node["toc"]
154
- ) do |div|
155
- clause_parse_title(node, div, node.at(ns("./title")), out)
156
- node.children.reject { |c1| c1.name == "title" }.each do |c1|
157
- parse(c1, div)
150
+ out.section **attr_code(
151
+ anchor: node["id"], numbered: node["numbered"],
152
+ removeInRFC: node["removeInRFC"], toc: node["toc"]
153
+ ) do |div|
154
+ clause_parse_title(node, div, node.at(ns("./title")), out)
155
+ node.children.reject { |c1| c1.name == "title" }.each do |c1|
156
+ parse(c1, div)
157
+ end
158
158
  end
159
159
  end
160
- end
161
160
 
162
- def clause(isoxml, out)
163
- isoxml.xpath("//xmlns:preface/child::*"\
164
- "[not(name() = 'abstract' or name() = 'foreword')] "\
165
- "| //xmlns:sections/child::*").each do |c|
166
- # cdup = c.dup
167
- # cdup.xpath(ns(".//references")).each { |r| r.remove }
168
- # cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
169
- clause_parse(c, out)
161
+ def clause(isoxml, out)
162
+ isoxml.xpath("//xmlns:preface/child::*" \
163
+ "[not(name() = 'abstract' or name() = 'foreword')] " \
164
+ "| //xmlns:sections/child::*").each do |c|
165
+ # cdup = c.dup
166
+ # cdup.xpath(ns(".//references")).each { |r| r.remove }
167
+ # cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
168
+ clause_parse(c, out)
169
+ end
170
170
  end
171
- end
172
171
 
173
- def annex(isoxml, out)
174
- isoxml.xpath(ns("//annex")).each do |c|
175
- clause_parse(c, out)
172
+ def annex(isoxml, out)
173
+ isoxml.xpath(ns("//annex")).each do |c|
174
+ clause_parse(c, out)
175
+ end
176
176
  end
177
177
  end
178
178
  end
@@ -1,43 +1,45 @@
1
- module IsoDoc::Ietf
2
- class RfcConvert < ::IsoDoc::Convert
3
- def table_attrs(node)
4
- attr_code(anchor: node["id"], align: node["align"])
5
- end
1
+ module IsoDoc
2
+ module Ietf
3
+ class RfcConvert < ::IsoDoc::Convert
4
+ def table_attrs(node)
5
+ attr_code(anchor: node["id"], align: node["align"])
6
+ end
6
7
 
7
- def table_parse(node, out)
8
- @in_table = true
9
- out.table **table_attrs(node) do |t|
10
- table_title_parse(node, out)
11
- thead_parse(node, t)
12
- tbody_parse(node, t)
13
- tfoot_parse(node, t)
8
+ def table_parse(node, out)
9
+ @in_table = true
10
+ out.table **table_attrs(node) do |t|
11
+ table_title_parse(node, out)
12
+ thead_parse(node, t)
13
+ tbody_parse(node, t)
14
+ tfoot_parse(node, t)
15
+ end
16
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
17
+ node.xpath(ns("./note")).each { |n| parse(n, out) }
18
+ @in_table = false
14
19
  end
15
- (dl = node.at(ns("./dl"))) && parse(dl, out)
16
- node.xpath(ns("./note")).each { |n| parse(n, out) }
17
- @in_table = false
18
- end
19
20
 
20
- def table_title_parse(node, out)
21
- name = node.at(ns("./name")) || return
22
- out.name do |p|
23
- name.children.each { |n| parse(n, p) }
21
+ def table_title_parse(node, out)
22
+ name = node.at(ns("./name")) || return
23
+ out.name do |p|
24
+ name.children.each { |n| parse(n, p) }
25
+ end
24
26
  end
25
- end
26
27
 
27
- def tr_parse(node, out, ord, totalrows, header)
28
- out.tr do |r|
29
- node.elements.each do |td|
30
- attrs = make_tr_attr(td, ord, totalrows - 1, header)
31
- r.send td.name, **attrs do |entry|
32
- td.children.each { |n| parse(n, entry) }
28
+ def tr_parse(node, out, ord, totalrows, header)
29
+ out.tr do |r|
30
+ node.elements.each do |td|
31
+ attrs = make_tr_attr(td, ord, totalrows - 1, header)
32
+ r.send td.name, **attrs do |entry|
33
+ td.children.each { |n| parse(n, entry) }
34
+ end
33
35
  end
34
36
  end
35
37
  end
36
- end
37
38
 
38
- def make_tr_attr(td, row, totalrows, header)
39
- attr_code(rowspan: td["rowspan"], colspan: td["colspan"],
40
- align: td["align"] )
39
+ def make_tr_attr(cell, _row, _totalrows, _header)
40
+ attr_code(rowspan: cell["rowspan"], colspan: cell["colspan"],
41
+ align: cell["align"])
42
+ end
41
43
  end
42
44
  end
43
45
  end
@@ -522,7 +522,6 @@
522
522
  <value>tip</value>
523
523
  <value>important</value>
524
524
  <value>caution</value>
525
- <value>statement</value>
526
525
  </choice>
527
526
  </define>
528
527
  <define name="figure">
@@ -216,6 +216,9 @@
216
216
  <optional>
217
217
  <ref name="fullname"/>
218
218
  </optional>
219
+ <zeroOrMore>
220
+ <ref name="credential"/>
221
+ </zeroOrMore>
219
222
  <zeroOrMore>
220
223
  <ref name="affiliation"/>
221
224
  </zeroOrMore>
@@ -232,6 +235,11 @@
232
235
  <ref name="FullNameType"/>
233
236
  </element>
234
237
  </define>
238
+ <define name="credential">
239
+ <element name="credential">
240
+ <text/>
241
+ </element>
242
+ </define>
235
243
  <define name="FullNameType">
236
244
  <choice>
237
245
  <group>
@@ -305,7 +313,9 @@
305
313
  <zeroOrMore>
306
314
  <ref name="affiliationdescription"/>
307
315
  </zeroOrMore>
308
- <ref name="organization"/>
316
+ <optional>
317
+ <ref name="organization"/>
318
+ </optional>
309
319
  </element>
310
320
  </define>
311
321
  <define name="affiliationname">
@@ -1316,7 +1326,7 @@
1316
1326
  <value>commentaryOf</value>
1317
1327
  <value>hasCommentary</value>
1318
1328
  <value>related</value>
1319
- <value>complements</value>
1329
+ <value>hasComplement</value>
1320
1330
  <value>complementOf</value>
1321
1331
  <value>obsoletes</value>
1322
1332
  <value>obsoletedBy</value>
@@ -83,6 +83,8 @@ module Metanorma
83
83
  end
84
84
 
85
85
  def section_names_refs_cleanup(xml); end
86
+
87
+ def note_cleanup(xmldoc); end
86
88
  end
87
89
  end
88
90
  end
@@ -66,6 +66,7 @@
66
66
  <value>caution</value>
67
67
  <value>statement</value>
68
68
  <value>editorial</value>
69
+ <value>box</value>
69
70
  </choice>
70
71
  </define>
71
72
  <define name="index">
@@ -1577,10 +1578,13 @@
1577
1578
  <zeroOrMore>
1578
1579
  <ref name="indexsect"/>
1579
1580
  </zeroOrMore>
1581
+ <optional>
1582
+ <ref name="colophon"/>
1583
+ </optional>
1580
1584
  </element>
1581
1585
  </define>
1582
1586
  <define name="misccontainer">
1583
- <element name="misc-container">
1587
+ <element name="metanorma-extension">
1584
1588
  <oneOrMore>
1585
1589
  <ref name="AnyElement"/>
1586
1590
  </oneOrMore>
@@ -1599,6 +1603,13 @@
1599
1603
  </oneOrMore>
1600
1604
  </element>
1601
1605
  </define>
1606
+ <define name="colophon">
1607
+ <element name="colophon">
1608
+ <oneOrMore>
1609
+ <ref name="content"/>
1610
+ </oneOrMore>
1611
+ </element>
1612
+ </define>
1602
1613
  <define name="foreword">
1603
1614
  <element name="foreword">
1604
1615
  <ref name="Content-Section"/>
@@ -1,4 +1,5 @@
1
1
  require "metanorma/ietf/data/workgroups"
2
+ require "metanorma-utils"
2
3
 
3
4
  module Metanorma
4
5
  module Ietf
@@ -7,6 +8,19 @@ module Metanorma
7
8
  super
8
9
  image_validate(doc)
9
10
  workgroup_validate(doc)
11
+ submission_validate(doc)
12
+ end
13
+
14
+ def ns(path)
15
+ ::Metanorma::Utils::ns(path)
16
+ end
17
+
18
+ def submission_validate(doc)
19
+ stream = doc.at(("//bibdata/series[@type = 'stream']/title"))&.text
20
+ status = doc.at(("//bibdata/status/stage"))&.text
21
+ stream == "editorial" && status != "informational" and
22
+ @log.add("Document Attributes", nil,
23
+ "Editorial stream must have Informational status")
10
24
  end
11
25
 
12
26
  def image_validate(doc)
@@ -24,7 +38,8 @@ module Metanorma
24
38
  wg_norm = wg.text.sub(/ (Working|Research) Group$/, "")
25
39
  next if @workgroups.include?(wg_norm)
26
40
 
27
- @log.add("Document Attributes", nil, "IETF: unrecognised working group #{wg.text}")
41
+ @log.add("Document Attributes", nil,
42
+ "IETF: unrecognised working group #{wg.text}")
28
43
  end
29
44
  end
30
45
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "3.1.1".freeze
3
+ VERSION = "3.1.3".freeze
4
4
  end
5
5
  end
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: 3.1.1
4
+ version: 3.1.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: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mathml2asciimath