metanorma-ietf 2.3.0 → 2.3.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/front.rb +2 -2
- data/lib/isodoc/ietf/blocks.rb +14 -8
- data/lib/isodoc/ietf/cleanup.rb +22 -17
- data/lib/metanorma/ietf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0009480252eb6b82ab3d795efc48b9fc3146a1790dedb07ab40b415c0085dde2'
|
4
|
+
data.tar.gz: 1ff86a356bcc191b07b5302439f88b134b69a02a9ab26db48fe85feed2a16cfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 061bf172d476731cd3885c49b825751c8d68dc458f0d591b48df8b47cc0f5fffcb2016e1934f3ade8f21fa55f13ecdcd68a2b2590eea198870ad3c0d7af9a95a
|
7
|
+
data.tar.gz: 684c4f1e6f6701fa54bf3b903a28ada68be7352fe99b4aa23036c6bd96c288cf15628b778689adfb516154bdb5cfaaf130ebf8bae8e5a78090bc08a7a157a439
|
@@ -14,7 +14,7 @@ module Asciidoctor
|
|
14
14
|
csv_split(publishers)&.each do |p|
|
15
15
|
xml.contributor do |c|
|
16
16
|
c.role **{ type: "publisher" }
|
17
|
-
c.organization { |a| organization(a, p) }
|
17
|
+
c.organization { |a| organization(a, p, true) }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -25,7 +25,7 @@ module Asciidoctor
|
|
25
25
|
xml.copyright do |c|
|
26
26
|
c.from (node.attr("copyright-year") || Date.today.year)
|
27
27
|
c.owner do |owner|
|
28
|
-
owner.organization { |o| organization(o, p) }
|
28
|
+
owner.organization { |o| organization(o, p, true) }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/isodoc/ietf/blocks.rb
CHANGED
@@ -43,7 +43,7 @@ module IsoDoc::Ietf
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def ol_attrs(node)
|
46
|
-
{ anchor: node["id"],
|
46
|
+
{ anchor: node["id"],
|
47
47
|
spacing: node["spacing"],
|
48
48
|
type: ol_style(node["type"]),
|
49
49
|
group: node["group"],
|
@@ -75,6 +75,7 @@ module IsoDoc::Ietf
|
|
75
75
|
n = @xrefs.get[node["id"]]
|
76
76
|
return l10n("#{@i18n.note}: ") if n.nil? || n[:label].nil? ||
|
77
77
|
n[:label].empty?
|
78
|
+
|
78
79
|
l10n("#{@i18n.note} #{n[:label]}: ")
|
79
80
|
end
|
80
81
|
|
@@ -99,7 +100,7 @@ module IsoDoc::Ietf
|
|
99
100
|
def example_label(node, div, name)
|
100
101
|
n = @xrefs.get[node["id"]]
|
101
102
|
div.t **attr_code(anchor: node["id"], keepWithNext: "true") do |p|
|
102
|
-
lbl =
|
103
|
+
lbl = n.nil? || n[:label].nil? || n[:label].empty? ? @i18n.example :
|
103
104
|
l10n("#{@i18n.example} #{n[:label]}")
|
104
105
|
p << lbl
|
105
106
|
name and !lbl.nil? and p << ": "
|
@@ -110,9 +111,10 @@ module IsoDoc::Ietf
|
|
110
111
|
def sourcecode_parse(node, out)
|
111
112
|
out.sourcecode **attr_code(
|
112
113
|
anchor: node["id"], type: node["lang"], name: node["filename"],
|
113
|
-
markers: node["markers"], src: node["src"]
|
114
|
-
|
115
|
-
|
114
|
+
markers: node["markers"], src: node["src"]
|
115
|
+
) do |s|
|
116
|
+
node.children.each { |x| parse(x, s) unless x.name == "name" }
|
117
|
+
end
|
116
118
|
end
|
117
119
|
|
118
120
|
def pre_parse(node, out)
|
@@ -135,6 +137,7 @@ module IsoDoc::Ietf
|
|
135
137
|
|
136
138
|
def formula_where(dl, out)
|
137
139
|
return unless dl
|
140
|
+
|
138
141
|
out.t { |p| p << @i18n.where }
|
139
142
|
parse(dl, out)
|
140
143
|
end
|
@@ -142,7 +145,7 @@ module IsoDoc::Ietf
|
|
142
145
|
def formula_parse1(node, out)
|
143
146
|
out.t **attr_code(anchor: node["id"]) do |p|
|
144
147
|
parse(node.at(ns("./stem")), p)
|
145
|
-
lbl = @xrefs.anchor(node[
|
148
|
+
lbl = @xrefs.anchor(node["id"], :label, false)
|
146
149
|
lbl.nil? or
|
147
150
|
p << " (#{lbl})"
|
148
151
|
end
|
@@ -153,6 +156,7 @@ module IsoDoc::Ietf
|
|
153
156
|
formula_where(node.at(ns("./dl")), out)
|
154
157
|
node.children.each do |n|
|
155
158
|
next if %w(stem dl).include? n.name
|
159
|
+
|
156
160
|
parse(n, out)
|
157
161
|
end
|
158
162
|
end
|
@@ -172,7 +176,7 @@ module IsoDoc::Ietf
|
|
172
176
|
end
|
173
177
|
|
174
178
|
def admonition_name_parse(_node, div, name)
|
175
|
-
div.t **{keepWithNext: "true" } do |p|
|
179
|
+
div.t **{ keepWithNext: "true" } do |p|
|
176
180
|
name.children.each { |n| parse(n, p) }
|
177
181
|
end
|
178
182
|
end
|
@@ -196,8 +200,9 @@ module IsoDoc::Ietf
|
|
196
200
|
end
|
197
201
|
end
|
198
202
|
|
199
|
-
def figure_name_parse(
|
203
|
+
def figure_name_parse(_node, div, name)
|
200
204
|
return if name.nil?
|
205
|
+
|
201
206
|
div.name do |n|
|
202
207
|
name.children.each { |n| parse(n, div) }
|
203
208
|
end
|
@@ -210,6 +215,7 @@ module IsoDoc::Ietf
|
|
210
215
|
def figure_parse(node, out)
|
211
216
|
return pseudocode_parse(node, out) if node["class"] == "pseudocode" ||
|
212
217
|
node["type"] == "pseudocode"
|
218
|
+
|
213
219
|
@in_figure = true
|
214
220
|
out.figure **attr_code(anchor: node["id"]) do |div|
|
215
221
|
figure_name_parse(node, div, node.at(ns("./name")))
|
data/lib/isodoc/ietf/cleanup.rb
CHANGED
@@ -15,14 +15,14 @@ module IsoDoc::Ietf
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# TODO: insert <u>
|
18
|
-
|
18
|
+
|
19
19
|
def front_cleanup(xmldoc)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
20
|
+
xmldoc.xpath("//title").each { |s| s.children = s.text }
|
21
|
+
xmldoc.xpath("//reference/front[not(author)]").each do |f|
|
22
|
+
insert = f.at("./seriesInfo[last()]") || f.at("./title")
|
23
|
+
insert.next = "<author surname='Unknown'/>"
|
25
24
|
end
|
25
|
+
end
|
26
26
|
|
27
27
|
def table_footnote_cleanup(docxml)
|
28
28
|
docxml.xpath("//table[descendant::fn]").each do |t|
|
@@ -54,9 +54,11 @@ module IsoDoc::Ietf
|
|
54
54
|
docxml.xpath("//figure[descendant::figure]").each do |f|
|
55
55
|
insert = f
|
56
56
|
f.xpath(".//figure").each do |a|
|
57
|
+
title = f.at("./name") and a.children.first.previous = title.remove
|
57
58
|
insert.next = a.remove
|
58
59
|
insert = insert.next_element
|
59
60
|
end
|
61
|
+
f.remove
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
@@ -126,8 +128,10 @@ module IsoDoc::Ietf
|
|
126
128
|
|
127
129
|
def make_endnotes(docxml)
|
128
130
|
return unless docxml.at("//fn")
|
129
|
-
|
130
|
-
|
131
|
+
|
132
|
+
unless endnotes = docxml.at("//back")
|
133
|
+
docxml << "<back/>" and endnotes = docxml.at("//back")
|
134
|
+
end
|
131
135
|
endnotes << "<section><name>Endnotes</name></section>"
|
132
136
|
endnotes = docxml.at("//back/section[last()]")
|
133
137
|
end
|
@@ -138,7 +142,7 @@ module IsoDoc::Ietf
|
|
138
142
|
t.xpath(".//artwork").each_with_index do |a, i|
|
139
143
|
insert.next = a.dup
|
140
144
|
insert = insert.next
|
141
|
-
a.replace("[IMAGE #{i+1}]")
|
145
|
+
a.replace("[IMAGE #{i + 1}]")
|
142
146
|
end
|
143
147
|
end
|
144
148
|
end
|
@@ -146,8 +150,8 @@ module IsoDoc::Ietf
|
|
146
150
|
# for markup in pseudocode
|
147
151
|
def sourcecode_cleanup(docxml)
|
148
152
|
docxml.xpath("//sourcecode").each do |s|
|
149
|
-
s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n")
|
150
|
-
gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
|
153
|
+
s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n")
|
154
|
+
.gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
|
151
155
|
sourcecode_remove_markup(s)
|
152
156
|
text = HTMLEntities.new.decode(s.children.to_xml.sub(/\A\n+/, ""))
|
153
157
|
s.children = "<![CDATA[#{text}]]>"
|
@@ -158,8 +162,10 @@ module IsoDoc::Ietf
|
|
158
162
|
s.traverse do |n|
|
159
163
|
next if n.text?
|
160
164
|
next if %w(name callout annotation note sourcecode).include? n.name
|
161
|
-
|
162
|
-
|
165
|
+
|
166
|
+
case n.name
|
167
|
+
when "br" then n.replace("\n")
|
168
|
+
when "t" then n.replace("\n\n#{n.children}")
|
163
169
|
else
|
164
170
|
n.replace(n.children)
|
165
171
|
end
|
@@ -169,6 +175,7 @@ module IsoDoc::Ietf
|
|
169
175
|
def annotation_cleanup(docxml)
|
170
176
|
docxml.xpath("//reference").each do |r|
|
171
177
|
next unless r&.next_element&.name == "aside"
|
178
|
+
|
172
179
|
aside = r.next_element
|
173
180
|
aside.name = "annotation"
|
174
181
|
aside.traverse do |n|
|
@@ -176,7 +183,7 @@ module IsoDoc::Ietf
|
|
176
183
|
end
|
177
184
|
r << aside
|
178
185
|
end
|
179
|
-
docxml.xpath("//references/aside").each
|
186
|
+
docxml.xpath("//references/aside").each(&:remove)
|
180
187
|
end
|
181
188
|
|
182
189
|
def deflist_cleanup(docxml)
|
@@ -203,9 +210,7 @@ module IsoDoc::Ietf
|
|
203
210
|
end
|
204
211
|
|
205
212
|
def bookmark_cleanup(docxml)
|
206
|
-
docxml.xpath("//bookmark").each
|
207
|
-
b.remove
|
208
|
-
end
|
213
|
+
docxml.xpath("//bookmark").each(&:remove)
|
209
214
|
end
|
210
215
|
|
211
216
|
def aside_cleanup(docxml)
|
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.3.
|
4
|
+
version: 2.3.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-04-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc
|