metanorma-ietf 2.4.1 → 2.4.2

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: def69cf551c6c50fcb28fcdf04ab02e0d3d9cf83ba3dcd81114c41f71860599f
4
- data.tar.gz: 5afc33bb93c93fbc86565d984562a3a61ed02b700e0a1e66a70f47289ef230c9
3
+ metadata.gz: e0bce55e3d73f441a77b94d2aa6f7f464e727b914dd8e8c6fa67dbf035122d63
4
+ data.tar.gz: 1eaa61e2a47f793b47653f76e8ff6a7fd53a8f7889a06b9e43e61132cb6b066d
5
5
  SHA512:
6
- metadata.gz: 4a2c6f8d47d875c1fb896d1fffdc5d5f789c05a679ab474ae7dfbc52795b9df47eb4763164f08c2da964c0de53ad51f91233ea230a8bce9553a31986f19bf4cd
7
- data.tar.gz: eb7fbd7913907b01e95f07bd2b28058b1d8c953f5f9b8b8a9c81a6c1638319fbb2ce8f593a3d83970b5ea748fbf34b7d0ba60b73ea5fa8f9c1a41e3076aec6ac
6
+ metadata.gz: c8f01b1753308bdb0d335a766fa4ed638a417a81433bb6f6b95a02518674d5eff55b3951db0717e748f7dc8dc3d0def3db27ddadb0f0a36105247f666747099b
7
+ data.tar.gz: af96278d659ea2949ad3aa2a435cdbe17017e171502fdea71cd5c332d13d7f7a2dade54361e8173aaf9b41e0614af7402fed6773d6f978e2388616f929108007
@@ -6,6 +6,8 @@ module Asciidoctor
6
6
  abstract_cleanup(xmldoc)
7
7
  super
8
8
  rfc_anchor_cleanup(xmldoc)
9
+ cref_cleanup(xmldoc)
10
+ xmldoc
9
11
  end
10
12
 
11
13
  def abstract_cleanup(xmldoc)
@@ -15,6 +17,21 @@ module Asciidoctor
15
17
  end
16
18
  end
17
19
 
20
+ def cref_cleanup(xmldoc)
21
+ xmldoc.xpath("//crefref").each do |r|
22
+ if c = xmldoc.at("//review[@id = '#{r.text}']")
23
+ r.replace(c.remove)
24
+ else
25
+ @log.add("Crossrefences", r,
26
+ "No matching review for cref:[#{r.text}]")
27
+ end
28
+ end
29
+ end
30
+
31
+ BCP_KEYWORDS = ["MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
32
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
33
+ "OPTIONAL"].freeze
34
+
18
35
  def bcp14_cleanup(xmldoc)
19
36
  return unless @bcp_bold
20
37
 
@@ -26,12 +43,13 @@ module Asciidoctor
26
43
  end
27
44
 
28
45
  def rfc_anchor_cleanup(xmldoc)
29
- map = {}
30
- xmldoc.xpath("//bibitem[docidentifier/@type = 'rfc-anchor']").each do |b|
31
- next if b.at("./ancestor::bibdata")
46
+ map = xmldoc.xpath("//bibitem[docidentifier/@type = 'rfc-anchor']")
47
+ .each_with_object({}) do |b, m|
48
+ next if b.at("./ancestor::bibdata | ./ancestor::bibitem")
32
49
 
33
- map[b["id"]] = b.at("./docidentifier[@type = 'rfc-anchor']").text
34
- b["id"] = b.at("./docidentifier[@type = 'rfc-anchor']").text
50
+ id = b.at("./docidentifier[@type = 'rfc-anchor']").text
51
+ m[b["id"]] = id
52
+ b["id"] = id
35
53
  end
36
54
  xmldoc.xpath("//eref | //origin").each do |x|
37
55
  map[x["bibitemid"]] and x["bibitemid"] = map[x["bibitemid"]]
@@ -5,10 +5,15 @@ require_relative "./front"
5
5
  require_relative "./blocks"
6
6
  require_relative "./validate"
7
7
  require_relative "./cleanup"
8
+ require_relative "./macros"
8
9
 
9
10
  module Asciidoctor
10
11
  module Ietf
11
12
  class Converter < ::Asciidoctor::Standoc::Converter
13
+ Asciidoctor::Extensions.register do
14
+ inline_macro Asciidoctor::Ietf::InlineCrefMacro
15
+ end
16
+
12
17
  XML_ROOT_TAG = "ietf-standard".freeze
13
18
  XML_NAMESPACE = "https://www.metanorma.org/ns/ietf".freeze
14
19
 
@@ -113,70 +118,7 @@ module Asciidoctor
113
118
  [t, rel]
114
119
  end
115
120
 
116
- def cleanup(xmldoc)
117
- bcp14_cleanup(xmldoc)
118
- abstract_cleanup(xmldoc)
119
- super
120
- rfc_anchor_cleanup(xmldoc)
121
- end
122
-
123
- BCP_KEYWORDS = ["MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
124
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", "OPTIONAL"].freeze
125
-
126
- def abstract_cleanup(xmldoc)
127
- xmldoc.xpath("//abstract[not(text())]").each do |x|
128
- x.remove
129
- warn "Empty abstract section removed"
130
- end
131
- end
132
-
133
- def bcp14_cleanup(xmldoc)
134
- return unless @bcp_bold
135
- xmldoc.xpath("//strong").each do |s|
136
- next unless BCP_KEYWORDS.include?(s.text)
137
- s.name = "bcp14"
138
- end
139
- end
140
-
141
- def rfc_anchor_cleanup(xmldoc)
142
- map = {}
143
- xmldoc.xpath("//bibitem[docidentifier/@type = 'rfc-anchor']").each do |b|
144
- next if b.at("./ancestor::bibdata | ./ancestor::bibitem")
145
-
146
- map[b["id"]] = b.at("./docidentifier[@type = 'rfc-anchor']").text
147
- b["id"] = b.at("./docidentifier[@type = 'rfc-anchor']").text
148
- end
149
- xmldoc.xpath("//eref | //origin").each do |x|
150
- map[x["bibitemid"]] and x["bibitemid"] = map[x["bibitemid"]]
151
- end
152
- xmldoc
153
- end
154
-
155
- def smartquotes_cleanup(xmldoc)
156
- xmldoc.traverse do |n|
157
- next unless n.text?
158
- n.replace(HTMLEntities.new.encode(
159
- n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'").
160
- gsub(/\u201c|\u201d|\u201e|\u201f/, '"'), :basic))
161
- end
162
- xmldoc
163
- end
164
-
165
- def xref_to_eref(x)
166
- super
167
- x.delete("format")
168
- end
169
-
170
- def xref_cleanup(xmldoc)
171
- super
172
- xmldoc.xpath("//xref").each do |x|
173
- x.delete("displayFormat")
174
- x.delete("relative")
175
- end
176
- end
177
-
178
- def norm_ref_preface(f)
179
- end
121
+ def norm_ref_preface(sect); end
180
122
 
181
123
  def clause_parse(attrs, xml, node)
182
124
  attrs[:numbered] = node.attr("numbered")
@@ -602,7 +602,10 @@
602
602
  </define>
603
603
  </include>
604
604
  <define name="TextElement" combine="choice">
605
- <ref name="bcp14"/>
605
+ <choice>
606
+ <ref name="bcp14"/>
607
+ <ref name="review"/>
608
+ </choice>
606
609
  </define>
607
610
  <define name="bcp14">
608
611
  <element name="bcp14">
@@ -990,6 +990,16 @@
990
990
  <data type="boolean"/>
991
991
  </attribute>
992
992
  </optional>
993
+ <optional>
994
+ <attribute name="linkmention">
995
+ <data type="boolean"/>
996
+ </attribute>
997
+ </optional>
998
+ <optional>
999
+ <attribute name="linkref">
1000
+ <data type="boolean"/>
1001
+ </attribute>
1002
+ </optional>
993
1003
  <optional>
994
1004
  <element name="refterm">
995
1005
  <zeroOrMore>
@@ -1026,6 +1036,7 @@
1026
1036
  <ref name="svgmap"/>
1027
1037
  <ref name="inputform"/>
1028
1038
  <ref name="toc"/>
1039
+ <ref name="passthrough"/>
1029
1040
  </choice>
1030
1041
  </define>
1031
1042
  <define name="toc">
@@ -1033,6 +1044,14 @@
1033
1044
  <ref name="ul"/>
1034
1045
  </element>
1035
1046
  </define>
1047
+ <define name="passthrough">
1048
+ <element name="passthrough">
1049
+ <optional>
1050
+ <attribute name="formats"/>
1051
+ </optional>
1052
+ <text/>
1053
+ </element>
1054
+ </define>
1036
1055
  <define name="inputform">
1037
1056
  <element name="form">
1038
1057
  <attribute name="id">
@@ -1700,7 +1719,9 @@
1700
1719
  <zeroOrMore>
1701
1720
  <ref name="termgrammar"/>
1702
1721
  </zeroOrMore>
1703
- <ref name="definition"/>
1722
+ <oneOrMore>
1723
+ <ref name="termdefinition"/>
1724
+ </oneOrMore>
1704
1725
  <zeroOrMore>
1705
1726
  <ref name="termnote"/>
1706
1727
  </zeroOrMore>
@@ -1763,7 +1784,7 @@
1763
1784
  </oneOrMore>
1764
1785
  </element>
1765
1786
  </define>
1766
- <define name="definition">
1787
+ <define name="termdefinition">
1767
1788
  <element name="definition">
1768
1789
  <oneOrMore>
1769
1790
  <choice>
@@ -1772,6 +1793,9 @@
1772
1793
  <ref name="formula"/>
1773
1794
  </choice>
1774
1795
  </oneOrMore>
1796
+ <zeroOrMore>
1797
+ <ref name="termsource"/>
1798
+ </zeroOrMore>
1775
1799
  </element>
1776
1800
  </define>
1777
1801
  <define name="termnote">
@@ -0,0 +1,17 @@
1
+ require "asciidoctor/extensions"
2
+
3
+ module Asciidoctor
4
+ module Ietf
5
+ class InlineCrefMacro < Asciidoctor::Extensions::InlineMacroProcessor
6
+ use_dsl
7
+ named :cref
8
+ parse_content_as :text
9
+ using_format :short
10
+
11
+ def process(parent, _target, attrs)
12
+ out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
13
+ %{<crefref>#{out}</crefref>}
14
+ end
15
+ end
16
+ end
17
+ end
@@ -64,11 +64,11 @@ module IsoDoc
64
64
  spacing: node["spacing"])
65
65
  end
66
66
 
67
- def dt_parse(dt, term)
68
- if dt.elements.empty?
69
- term << dt.text
67
+ def dt_parse(dterm, term)
68
+ if dterm.elements.empty?
69
+ term << dterm.text
70
70
  else
71
- dt.children.each { |n| parse(n, term) }
71
+ dterm.children.each { |n| parse(n, term) }
72
72
  end
73
73
  end
74
74
 
@@ -108,7 +108,7 @@ module IsoDoc
108
108
  end
109
109
  p << lbl
110
110
  name and !lbl.nil? and p << ": "
111
- name and name.children.each { |n| parse(n, p) }
111
+ name&.children&.each { |e| parse(e, p) }
112
112
  end
113
113
  end
114
114
 
@@ -139,11 +139,11 @@ module IsoDoc
139
139
  @annotation = false
140
140
  end
141
141
 
142
- def formula_where(dl, out)
143
- return unless dl
142
+ def formula_where(dlist, out)
143
+ return unless dlist
144
144
 
145
145
  out.t { |p| p << @i18n.where }
146
- parse(dl, out)
146
+ parse(dlist, out)
147
147
  end
148
148
 
149
149
  def formula_parse1(node, out)
@@ -7,14 +7,32 @@ module IsoDoc::Ietf
7
7
  footnote_cleanup(docxml)
8
8
  sourcecode_cleanup(docxml)
9
9
  annotation_cleanup(docxml)
10
+ li_cleanup(docxml)
10
11
  deflist_cleanup(docxml)
11
12
  bookmark_cleanup(docxml)
12
13
  aside_cleanup(docxml)
13
14
  front_cleanup(docxml)
15
+ u_cleanup(docxml)
14
16
  docxml
15
17
  end
16
18
 
17
- # TODO: insert <u>
19
+ def u_cleanup(xmldoc)
20
+ xmldoc.traverse do |n|
21
+ next unless n.text?
22
+ next if %w(author organization street city region code country
23
+ postalLine email seriesInfo title%).include? n.parent
24
+
25
+ n.replace(n.text.gsub(/[\u0080-\uffff]/, "<u>\\0</u>"))
26
+ end
27
+ end
28
+
29
+ def li_cleanup(xmldoc)
30
+ xmldoc.xpath("//li[t]").each do |li|
31
+ next unless li.elements.size == 1
32
+
33
+ li.children = li.elements[0].children
34
+ end
35
+ end
18
36
 
19
37
  def front_cleanup(xmldoc)
20
38
  xmldoc.xpath("//title").each { |s| s.children = s.text }
@@ -1,167 +1,170 @@
1
1
  require "mathml2asciimath"
2
2
 
3
- module IsoDoc::Ietf
4
- class RfcConvert < ::IsoDoc::Convert
5
- def em_parse(node, out)
6
- out.em do |e|
7
- node.children.each { |n| parse(n, e) }
3
+ module IsoDoc
4
+ module Ietf
5
+ class RfcConvert < ::IsoDoc::Convert
6
+ def em_parse(node, out)
7
+ out.em do |e|
8
+ node.children.each { |n| parse(n, e) }
9
+ end
8
10
  end
9
- end
10
11
 
11
- def sup_parse(node, out)
12
- out.sup do |e|
13
- node.children.each { |n| parse(n, e) }
12
+ def sup_parse(node, out)
13
+ out.sup do |e|
14
+ node.children.each { |n| parse(n, e) }
15
+ end
14
16
  end
15
- end
16
17
 
17
- def sub_parse(node, out)
18
- out.sub do |e|
19
- node.children.each { |n| parse(n, e) }
18
+ def sub_parse(node, out)
19
+ out.sub do |e|
20
+ node.children.each { |n| parse(n, e) }
21
+ end
20
22
  end
21
- end
22
23
 
23
- def tt_parse(node, out)
24
- out.tt do |e|
25
- node.children.each { |n| parse(n, e) }
24
+ def tt_parse(node, out)
25
+ out.tt do |e|
26
+ node.children.each { |n| parse(n, e) }
27
+ end
26
28
  end
27
- end
28
29
 
29
- def strong_parse(node, out)
30
- out.strong do |e|
31
- node.children.each { |n| parse(n, e) }
30
+ def strong_parse(node, out)
31
+ out.strong do |e|
32
+ node.children.each { |n| parse(n, e) }
33
+ end
32
34
  end
33
- end
34
35
 
35
- def bcp14_parse(node, out)
36
- out.bcp14 do |e|
37
- node.children.each { |n| parse(n, e) }
36
+ def bcp14_parse(node, out)
37
+ out.bcp14 do |e|
38
+ node.children.each { |n| parse(n, e) }
39
+ end
38
40
  end
39
- end
40
41
 
41
- def strike_parse(node, out)
42
- node.children.each { |n| parse(n, out) }
43
- end
42
+ def strike_parse(node, out)
43
+ node.children.each { |n| parse(n, out) }
44
+ end
44
45
 
45
- def smallcap_parse(node, out)
46
- node.children.each { |n| parse(n, out) }
47
- end
46
+ def smallcap_parse(node, out)
47
+ node.children.each { |n| parse(n, out) }
48
+ end
48
49
 
49
- def keyword_parse(node, out)
50
- node.children.each { |n| parse(n, out) }
51
- end
50
+ def keyword_parse(node, out)
51
+ node.children.each { |n| parse(n, out) }
52
+ end
52
53
 
53
- def text_parse(node, out)
54
- return if node.nil? || node.text.nil?
55
- text = node.to_s
56
- out << text
57
- end
54
+ def text_parse(node, out)
55
+ return if node.nil? || node.text.nil?
58
56
 
59
- def stem_parse(node, out)
60
- stem = case node["type"]
61
- when "MathML" then MathML2AsciiMath.m2a(node.children.to_xml)
62
- else
63
- HTMLEntities.new.encode(node.text)
64
- end
65
- out << "#{@openmathdelim} #{stem} #{@closemathdelim}"
66
- end
57
+ text = node.to_s
58
+ out << text
59
+ end
67
60
 
68
- def page_break(_out)
69
- end
61
+ def stem_parse(node, out)
62
+ stem = case node["type"]
63
+ when "MathML" then MathML2AsciiMath.m2a(node.children.to_xml)
64
+ else HTMLEntities.new.encode(node.text)
65
+ end
66
+ out << "#{@openmathdelim} #{stem} #{@closemathdelim}"
67
+ end
70
68
 
71
- def pagebreak_parse(_node, _out)
72
- end
69
+ def page_break(_out); end
73
70
 
74
- def br_parse(node, out)
75
- if @sourcecode
71
+ def pagebreak_parse(_node, _out); end
72
+
73
+ def br_parse(_node, out)
76
74
  out.br
77
75
  end
78
- end
79
76
 
80
- def hr_parse(node, out)
81
- end
77
+ def hr_parse(node, out); end
82
78
 
83
- def link_parse(node, out)
84
- out.eref **attr_code(target: node["target"]) do |l|
85
- node.children.each { |n| parse(n, l) }
79
+ def link_parse(node, out)
80
+ out.eref **attr_code(target: node["target"]) do |l|
81
+ node.children.each { |n| parse(n, l) }
82
+ end
86
83
  end
87
- end
88
84
 
89
- def image_parse(node, out, caption)
90
- attrs = { src: node["src"], title: node["title"],
91
- align: node["align"], name: node["filename"],
92
- anchor: node["id"], type: "svg",
93
- alt: node["alt"] }
94
- out.artwork **attr_code(attrs)
95
- image_title_parse(out, caption)
96
- end
85
+ def image_parse(node, out, caption)
86
+ attrs = { src: node["src"], title: node["title"],
87
+ align: node["align"], name: node["filename"],
88
+ anchor: node["id"], type: "svg",
89
+ alt: node["alt"] }
90
+ out.artwork **attr_code(attrs)
91
+ image_title_parse(out, caption)
92
+ end
97
93
 
98
- def image_title_parse(out, caption)
99
- unless caption.nil?
100
- out.t **{ align: "center", keepWithPrevious: "true" } do |p|
101
- p << caption.to_s
94
+ def image_title_parse(out, caption)
95
+ unless caption.nil?
96
+ out.t **{ align: "center", keepWithPrevious: "true" } do |p|
97
+ p << caption.to_s
98
+ end
102
99
  end
103
100
  end
104
- end
105
101
 
106
- def xref_parse(node, out)
107
- out.xref **attr_code(target: node["target"], format: node["format"],
108
- relative: node["relative"]) do |l|
109
- l << get_linkend(node)
110
- end
111
- end
102
+ def xref_parse(node, out)
103
+ out.xref **attr_code(target: node["target"], format: node["format"],
104
+ relative: node["relative"]) do |l|
105
+ l << get_linkend(node)
106
+ end
107
+ end
112
108
 
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
109
+ def get_linkend(node)
110
+ contents = node.children.reject do |c|
111
+ %w{locality localityStack}.include? c.name
112
+ end
113
+ .select { |c| !c.text? || /\S/.match(c) }
114
+ !contents.empty? and
115
+ return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
116
+ ""
117
+ end
120
118
 
121
- def eref_parse(node, out)
122
- linkend = node.children.reject { |c| %w{locality localityStack}.include? c.name }
123
- relative = node["relative"] ||
124
- node.at(ns(".//locality[@type = 'anchor']/referenceFrom"))&.text || ""
125
- section = eref_clause(node.xpath(ns("./locality | ./localityStack")), nil) || ""
126
- section = "" if relative.empty?
127
- out.relref **attr_code(target: node["bibitemid"], section: section,
128
- relative: relative,
129
- displayFormat: node["displayFormat"]) do |l|
130
- linkend.each { |n| parse(n, l) }
131
- end
132
- end
119
+ def eref_parse(node, out)
120
+ linkend = node.children.reject do |c|
121
+ %w{locality localityStack}.include? c.name
122
+ end
123
+ relative = node["relative"] ||
124
+ node.at(ns(".//locality[@type = 'anchor']/referenceFrom"))&.text || ""
125
+ section = eref_clause(node.xpath(ns("./locality | ./localityStack")),
126
+ nil) || ""
127
+ #section = "" unless relative.empty?
128
+ out.relref **attr_code(target: node["bibitemid"], section: section,
129
+ relative: relative,
130
+ displayFormat: node["displayFormat"]) do |l|
131
+ linkend.each { |n| parse(n, l) }
132
+ end
133
+ end
133
134
 
134
- def eref_clause(refs, target)
135
- ret = []
136
- ret1 = ""
137
- refs.each do |l|
138
- if l.name == "localityStack"
139
- ret << ret1
140
- ret1 = ""
141
- ret << eref_clause1(l.elements, target)
142
- else
143
- ret1 += eref_clause1([l], target)
135
+ def eref_clause(refs, target)
136
+ ret = []
137
+ ret1 = ""
138
+ refs.each do |l|
139
+ if l.name == "localityStack"
140
+ ret << ret1
141
+ ret1 = ""
142
+ ret << eref_clause1(l.elements, target)
143
+ else ret1 += eref_clause1([l], target)
144
+ end
144
145
  end
146
+ ret << ret1
147
+ ret.reject { |c| c.nil? || c.empty? }.join("; ")
145
148
  end
146
- ret << ret1
147
- ret.reject { |c| c.nil? || c.empty? }.join("; ")
148
- end
149
149
 
150
- def eref_clause1(refs, target)
151
- refs.each do |l|
152
- next unless %w(clause section).include? l["type"]
153
- return l&.at(ns("./referenceFrom"))&.text
150
+ def eref_clause1(refs, _target)
151
+ refs.each do |l|
152
+ next unless %w(clause section).include? l["type"]
153
+
154
+ return l&.at(ns("./referenceFrom"))&.text
155
+ end
156
+ ""
154
157
  end
155
- return ""
156
- end
157
158
 
158
- def index_parse(node, out)
159
- out.iref nil, **attr_code(item: node.at(ns("./primary")).text, primary: node["primary"],
160
- subitem: node&.at(ns("./secondary"))&.text)
161
- end
159
+ def index_parse(node, out)
160
+ out.iref nil, **attr_code(item: node.at(ns("./primary")).text,
161
+ primary: node["primary"],
162
+ subitem: node&.at(ns("./secondary"))&.text)
163
+ end
162
164
 
163
- def bookmark_parse(node, out)
164
- out.bookmark nil, **attr_code(anchor: node["id"])
165
+ def bookmark_parse(node, out)
166
+ out.bookmark nil, **attr_code(anchor: node["id"])
167
+ end
165
168
  end
166
169
  end
167
170
  end
@@ -55,15 +55,29 @@ module IsoDoc
55
55
  uris&.each do |u|
56
56
  r.format nil, **attr_code(target: u.text, type: u["type"])
57
57
  end
58
- docidentifiers = bib.xpath(ns("./docidentifier"))
59
- id = render_identifier(bibitem_ref_code(bib))
60
- !id[1].nil? && id[1] != "(NO ID)" and r.refcontent id[1]
61
- docidentifiers&.each do |u|
62
- if %w(DOI IETF).include? u["type"]
63
- r.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI /, ""),
64
- name: u["type"])
65
- end
66
- end
58
+ docidentifier_render(bib, r)
59
+ end
60
+ end
61
+
62
+ def docidentifier_render(bib, out)
63
+ docidentifiers = bib.xpath(ns("./docidentifier"))
64
+ id = render_identifier(bibitem_ref_code(bib))
65
+ !id[1].nil? && id[1] != "(NO ID)" and out.refcontent id[1]
66
+ docidentifiers&.each do |u|
67
+ u["type"] == "DOI" and
68
+ out.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI /, ""),
69
+ name: "DOI")
70
+ u["type"] == "IETF" and docidentifier_ietf(u, out)
71
+ end
72
+ end
73
+
74
+ def docidentifier_ietf(ident, out)
75
+ if /^RFC /.match?(ident.text)
76
+ out.seriesInfo nil, **attr_code(value: ident.text.sub(/^RFC 0*/, ""),
77
+ name: "RFC")
78
+ elsif /^I-D\./.match?(ident.text)
79
+ out.seriesInfo nil, **attr_code(value: ident.text.sub(/^I-D\./, ""),
80
+ name: "Internet-Draft")
67
81
  end
68
82
  end
69
83
 
@@ -165,7 +165,7 @@ module IsoDoc
165
165
  def seriesInfo_check(xml)
166
166
  ret = []
167
167
  xml.root["ipr"] == "none" and return []
168
- rfcinfo = xml.at("//seriesInfo[@name = 'RFC']")
168
+ rfcinfo = xml.at("//front//seriesInfo[@name = 'RFC']")
169
169
  rfcnumber = xml.root["number"]
170
170
  rfcinfo && rfcnumber && rfcnumber != rfcinfo["value"] and
171
171
  ret << "Mismatch between <rfc number='#{rfcnumber}'> "\
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.4.1".freeze
3
+ VERSION = "2.4.2".freeze
4
4
  end
5
5
  end
@@ -37,9 +37,8 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_dependency "isodoc", "~> 1.7.0"
39
39
  spec.add_dependency "mathml2asciimath"
40
- spec.add_dependency "metanorma-standoc", "~> 1.10.0"
41
40
  spec.add_dependency "metanorma-ietf-data"
42
- spec.add_dependency "nokogiri", "~> 1.11.6"
41
+ spec.add_dependency "metanorma-standoc", "~> 1.10.0"
43
42
  spec.add_dependency "open-uri"
44
43
 
45
44
  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.4.1
4
+ version: 2.4.2
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-08-30 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: metanorma-standoc
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 1.10.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 1.10.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: metanorma-ietf-data
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,19 +53,19 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: nokogiri
56
+ name: metanorma-standoc
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 1.11.6
61
+ version: 1.10.0
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 1.11.6
68
+ version: 1.10.0
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: open-uri
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -294,6 +280,7 @@ files:
294
280
  - lib/asciidoctor/ietf/front.rb
295
281
  - lib/asciidoctor/ietf/ietf.rng
296
282
  - lib/asciidoctor/ietf/isodoc.rng
283
+ - lib/asciidoctor/ietf/macros.rb
297
284
  - lib/asciidoctor/ietf/reqt.rng
298
285
  - lib/asciidoctor/ietf/validate.rb
299
286
  - lib/isodoc/ietf/SVG-1.2-RFC.rng