metanorma-ietf 2.3.2 → 2.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -13
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -6
- data/lib/asciidoctor/ietf/biblio.rng +1 -0
- data/lib/asciidoctor/ietf/cleanup.rb +85 -0
- data/lib/asciidoctor/ietf/converter.rb +19 -27
- data/lib/asciidoctor/ietf/ietf.rng +3 -0
- data/lib/asciidoctor/ietf/isodoc.rng +66 -10
- data/lib/asciidoctor/ietf/validate.rb +22 -13
- data/lib/isodoc/ietf/cleanup.rb +16 -5
- data/lib/isodoc/ietf/front.rb +56 -46
- data/lib/isodoc/ietf/references.rb +20 -15
- data/lib/isodoc/ietf/rfc_convert.rb +6 -4
- data/lib/isodoc/ietf/section.rb +51 -42
- data/lib/isodoc/ietf/terms.rb +13 -2
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +5 -4
- metadata +24 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a19bfaee2381bda7dd532941697aa43f6c9804940b9c2f82897f6950d195cc7
|
4
|
+
data.tar.gz: ba4c70b46014f9c41c4971e99da7608df7f2780855bbdbd005e6e4c542dda215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3eafc5eccb17ceaa77851f1aef2d66ea2fd6b39213b2537643571ee4f3b827a1b5b4d2fc2f9e3622649302661285035a483567b90d32cdddc693ca0d62f86d
|
7
|
+
data.tar.gz: 41c2f933072a61553455c06ac46ce40cd49e81fa86e162740b179a3099ad033eafd9a09723cbfe05c6d7b86227bf5fbd2e4121d4c92e6f625927a535e53ee58e
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
|
33
23
|
steps:
|
34
24
|
- uses: actions/checkout@master
|
@@ -68,7 +58,7 @@ jobs:
|
|
68
58
|
with:
|
69
59
|
path: ~/.cache/xml2rfc
|
70
60
|
key: xml2rfc
|
71
|
-
restore-
|
61
|
+
restore-keys: xml2rfc
|
72
62
|
|
73
63
|
- if: matrix.os == 'macos-latest'
|
74
64
|
run: brew install libmagic
|
@@ -88,5 +78,5 @@ jobs:
|
|
88
78
|
with:
|
89
79
|
token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
|
90
80
|
repository: ${{ github.repository }}
|
91
|
-
event-type:
|
81
|
+
event-type: tests-passed
|
92
82
|
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# https://github.com/
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
4
3
|
inherit_from:
|
5
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
5
|
|
7
6
|
# local repo-specific modifications
|
7
|
+
# ...
|
8
8
|
|
9
9
|
AllCops:
|
10
|
-
|
11
|
-
StyleGuideCopsOnly: false
|
12
|
-
TargetRubyVersion: 2.4
|
10
|
+
TargetRubyVersion: 2.5
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Ietf
|
3
|
+
class Converter < ::Asciidoctor::Standoc::Converter
|
4
|
+
def cleanup(xmldoc)
|
5
|
+
bcp14_cleanup(xmldoc)
|
6
|
+
abstract_cleanup(xmldoc)
|
7
|
+
super
|
8
|
+
rfc_anchor_cleanup(xmldoc)
|
9
|
+
end
|
10
|
+
|
11
|
+
BCP_KEYWORDS =
|
12
|
+
["MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
13
|
+
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", "OPTIONAL"].freeze
|
14
|
+
|
15
|
+
def abstract_cleanup(xmldoc)
|
16
|
+
xmldoc.xpath("//abstract[not(text())]").each do |x|
|
17
|
+
x.remove
|
18
|
+
warn "Empty abstract section removed"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def bcp14_cleanup(xmldoc)
|
23
|
+
return unless @bcp_bold
|
24
|
+
|
25
|
+
xmldoc.xpath("//strong").each do |s|
|
26
|
+
next unless BCP_KEYWORDS.include?(s.text)
|
27
|
+
|
28
|
+
s.name = "bcp14"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def rfc_anchor_cleanup(xmldoc)
|
33
|
+
map = {}
|
34
|
+
xmldoc.xpath("//bibitem[docidentifier/@type = 'rfc-anchor']").each do |b|
|
35
|
+
next if b.at("./ancestor::bibdata")
|
36
|
+
|
37
|
+
map[b["id"]] = b.at("./docidentifier[@type = 'rfc-anchor']").text
|
38
|
+
b["id"] = b.at("./docidentifier[@type = 'rfc-anchor']").text
|
39
|
+
end
|
40
|
+
xmldoc.xpath("//eref | //origin").each do |x|
|
41
|
+
map[x["bibitemid"]] and x["bibitemid"] = map[x["bibitemid"]]
|
42
|
+
end
|
43
|
+
xmldoc
|
44
|
+
end
|
45
|
+
|
46
|
+
def smartquotes_cleanup(xmldoc)
|
47
|
+
xmldoc.traverse do |n|
|
48
|
+
next unless n.text?
|
49
|
+
|
50
|
+
n.replace(HTMLEntities.new.encode(
|
51
|
+
n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'")
|
52
|
+
.gsub(/\u201c|\u201d|\u201e|\u201f/, '"'), :basic
|
53
|
+
))
|
54
|
+
end
|
55
|
+
xmldoc
|
56
|
+
end
|
57
|
+
|
58
|
+
def xref_to_eref(xref)
|
59
|
+
super
|
60
|
+
xref.delete("format")
|
61
|
+
end
|
62
|
+
|
63
|
+
def xref_cleanup(xmldoc)
|
64
|
+
super
|
65
|
+
xmldoc.xpath("//xref").each do |x|
|
66
|
+
x.delete("displayFormat")
|
67
|
+
x.delete("relative")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def quotesource_cleanup(xmldoc)
|
72
|
+
xmldoc.xpath("//quote/source | //terms/source").each do |x|
|
73
|
+
if x["target"]&.match?(URI::DEFAULT_PARSER.make_regexp)
|
74
|
+
x["uri"] = x["target"]
|
75
|
+
x.delete("target")
|
76
|
+
else
|
77
|
+
xref_to_eref(x)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def section_names_refs_cleanup(xml); end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -4,6 +4,7 @@ require "isodoc/ietf/rfc_convert"
|
|
4
4
|
require_relative "./front"
|
5
5
|
require_relative "./blocks"
|
6
6
|
require_relative "./validate"
|
7
|
+
require_relative "./cleanup"
|
7
8
|
|
8
9
|
module Asciidoctor
|
9
10
|
module Ietf
|
@@ -22,13 +23,13 @@ module Asciidoctor
|
|
22
23
|
@draft = node.attributes.has_key?("draft")
|
23
24
|
@workgroups = cache_workgroup(node)
|
24
25
|
@bcp_bold = !node.attr?("no-rfc-bold-bcp14")
|
25
|
-
@xinclude = node.attr?("use-xinclude")
|
26
|
+
@xinclude = node.attr?("use-xinclude")
|
26
27
|
super
|
27
28
|
end
|
28
29
|
|
29
30
|
def outputs(node, ret)
|
30
|
-
File.open(@filename
|
31
|
-
rfc_converter(node).convert(@filename
|
31
|
+
File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
|
32
|
+
rfc_converter(node).convert("#{@filename}.xml")
|
32
33
|
end
|
33
34
|
|
34
35
|
def doctype(node)
|
@@ -63,12 +64,12 @@ module Asciidoctor
|
|
63
64
|
f, c = xref_text(node)
|
64
65
|
f1, c = eref_text(node) if f.nil?
|
65
66
|
t, rel = xref_rel(node)
|
67
|
+
attrs = { target: t, type: "inline", displayFormat: f1, format: f,
|
68
|
+
relative: rel }
|
66
69
|
noko do |xml|
|
67
|
-
xml.xref **attr_code(
|
68
|
-
|
69
|
-
|
70
|
-
x << c
|
71
|
-
end
|
70
|
+
xml.xref **attr_code(attrs) do |x|
|
71
|
+
x << c
|
72
|
+
end
|
72
73
|
end.join
|
73
74
|
end
|
74
75
|
|
@@ -140,7 +141,8 @@ module Asciidoctor
|
|
140
141
|
def rfc_anchor_cleanup(xmldoc)
|
141
142
|
map = {}
|
142
143
|
xmldoc.xpath("//bibitem[docidentifier/@type = 'rfc-anchor']").each do |b|
|
143
|
-
next if b.at("./ancestor::bibdata")
|
144
|
+
next if b.at("./ancestor::bibdata | ./ancestor::bibitem")
|
145
|
+
|
144
146
|
map[b["id"]] = b.at("./docidentifier[@type = 'rfc-anchor']").text
|
145
147
|
b["id"] = b.at("./docidentifier[@type = 'rfc-anchor']").text
|
146
148
|
end
|
@@ -194,34 +196,24 @@ module Asciidoctor
|
|
194
196
|
clause_parse(attrs, xml, node)
|
195
197
|
end
|
196
198
|
|
197
|
-
def quotesource_cleanup(xmldoc)
|
198
|
-
xmldoc.xpath("//quote/source | //terms/source").each do |x|
|
199
|
-
if x["target"] =~ URI::DEFAULT_PARSER.make_regexp
|
200
|
-
x["uri"] = x["target"]
|
201
|
-
x.delete("target")
|
202
|
-
else
|
203
|
-
xref_to_eref(x)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
199
|
def inline_indexterm(node)
|
209
200
|
noko do |xml|
|
210
201
|
node.type == :visible and xml << node.text.sub(/^primary:(?=\S)/, "")
|
211
202
|
terms = (node.attr("terms") || [node.text]).map { |x| xml_encode(x) }
|
212
|
-
if /^primary:\S/.match(terms[0])
|
203
|
+
if /^primary:\S/.match?(terms[0])
|
213
204
|
terms[0].sub!(/^primary:/, "")
|
214
205
|
has_primary = true
|
215
206
|
end
|
216
|
-
|
217
|
-
i.primary { |x| x << terms[0] }
|
218
|
-
a = terms.dig(1) and i.secondary { |x| x << a }
|
219
|
-
a = terms.dig(2) and i.tertiary { |x| x << a }
|
220
|
-
end
|
207
|
+
inline_indexterm1(has_primary, terms, xml)
|
221
208
|
end.join
|
222
209
|
end
|
223
210
|
|
224
|
-
def
|
211
|
+
def inline_indexterm1(has_primary, terms, xml)
|
212
|
+
xml.index **attr_code(primary: has_primary) do |i|
|
213
|
+
i.primary { |x| x << terms[0] }
|
214
|
+
a = terms[1] and i.secondary { |x| x << a }
|
215
|
+
a = terms[2] and i.tertiary { |x| x << a }
|
216
|
+
end
|
225
217
|
end
|
226
218
|
|
227
219
|
def html_extract_attributes(node)
|
@@ -45,6 +45,11 @@
|
|
45
45
|
<optional>
|
46
46
|
<attribute name="alt"/>
|
47
47
|
</optional>
|
48
|
+
<optional>
|
49
|
+
<attribute name="updatetype">
|
50
|
+
<data type="boolean"/>
|
51
|
+
</attribute>
|
52
|
+
</optional>
|
48
53
|
<text/>
|
49
54
|
</element>
|
50
55
|
</define>
|
@@ -199,6 +204,18 @@
|
|
199
204
|
</zeroOrMore>
|
200
205
|
</element>
|
201
206
|
</define>
|
207
|
+
<define name="dt">
|
208
|
+
<element name="dt">
|
209
|
+
<optional>
|
210
|
+
<attribute name="id">
|
211
|
+
<data type="ID"/>
|
212
|
+
</attribute>
|
213
|
+
</optional>
|
214
|
+
<zeroOrMore>
|
215
|
+
<ref name="TextElement"/>
|
216
|
+
</zeroOrMore>
|
217
|
+
</element>
|
218
|
+
</define>
|
202
219
|
<define name="example">
|
203
220
|
<element name="example">
|
204
221
|
<attribute name="id">
|
@@ -543,6 +560,9 @@
|
|
543
560
|
</define>
|
544
561
|
<define name="BibDataExtensionType">
|
545
562
|
<ref name="doctype"/>
|
563
|
+
<optional>
|
564
|
+
<ref name="docsubtype"/>
|
565
|
+
</optional>
|
546
566
|
<optional>
|
547
567
|
<ref name="editorialgroup"/>
|
548
568
|
</optional>
|
@@ -890,6 +910,14 @@
|
|
890
910
|
</define>
|
891
911
|
</include>
|
892
912
|
<!-- end overrides -->
|
913
|
+
<define name="docsubtype">
|
914
|
+
<element name="subdoctype">
|
915
|
+
<ref name="DocumentSubtype"/>
|
916
|
+
</element>
|
917
|
+
</define>
|
918
|
+
<define name="DocumentSubtype">
|
919
|
+
<text/>
|
920
|
+
</define>
|
893
921
|
<define name="colgroup">
|
894
922
|
<element name="colgroup">
|
895
923
|
<oneOrMore>
|
@@ -939,7 +967,34 @@
|
|
939
967
|
<define name="concept">
|
940
968
|
<element name="concept">
|
941
969
|
<optional>
|
942
|
-
<attribute name="
|
970
|
+
<attribute name="ital">
|
971
|
+
<data type="boolean"/>
|
972
|
+
</attribute>
|
973
|
+
</optional>
|
974
|
+
<optional>
|
975
|
+
<attribute name="ref">
|
976
|
+
<data type="boolean"/>
|
977
|
+
</attribute>
|
978
|
+
</optional>
|
979
|
+
<optional>
|
980
|
+
<element name="refterm">
|
981
|
+
<zeroOrMore>
|
982
|
+
<choice>
|
983
|
+
<ref name="PureTextElement"/>
|
984
|
+
<ref name="stem"/>
|
985
|
+
</choice>
|
986
|
+
</zeroOrMore>
|
987
|
+
</element>
|
988
|
+
</optional>
|
989
|
+
<optional>
|
990
|
+
<element name="renderterm">
|
991
|
+
<zeroOrMore>
|
992
|
+
<choice>
|
993
|
+
<ref name="PureTextElement"/>
|
994
|
+
<ref name="stem"/>
|
995
|
+
</choice>
|
996
|
+
</zeroOrMore>
|
997
|
+
</element>
|
943
998
|
</optional>
|
944
999
|
<choice>
|
945
1000
|
<ref name="eref"/>
|
@@ -965,6 +1020,9 @@
|
|
965
1020
|
</attribute>
|
966
1021
|
<attribute name="name"/>
|
967
1022
|
<attribute name="action"/>
|
1023
|
+
<optional>
|
1024
|
+
<attribute name="class"/>
|
1025
|
+
</optional>
|
968
1026
|
<zeroOrMore>
|
969
1027
|
<choice>
|
970
1028
|
<ref name="TextElement"/>
|
@@ -1191,9 +1249,7 @@
|
|
1191
1249
|
</define>
|
1192
1250
|
<define name="IsoWorkgroup">
|
1193
1251
|
<optional>
|
1194
|
-
<attribute name="number"
|
1195
|
-
<data type="int"/>
|
1196
|
-
</attribute>
|
1252
|
+
<attribute name="number"/>
|
1197
1253
|
</optional>
|
1198
1254
|
<optional>
|
1199
1255
|
<attribute name="type"/>
|
@@ -1459,26 +1515,26 @@
|
|
1459
1515
|
<optional>
|
1460
1516
|
<ref name="section-title"/>
|
1461
1517
|
</optional>
|
1462
|
-
<
|
1518
|
+
<choice>
|
1463
1519
|
<choice>
|
1464
1520
|
<group>
|
1465
|
-
<
|
1521
|
+
<oneOrMore>
|
1466
1522
|
<ref name="BasicBlock"/>
|
1467
|
-
</
|
1523
|
+
</oneOrMore>
|
1468
1524
|
<zeroOrMore>
|
1469
1525
|
<ref name="note"/>
|
1470
1526
|
</zeroOrMore>
|
1471
1527
|
</group>
|
1472
1528
|
<ref name="amend"/>
|
1473
1529
|
</choice>
|
1474
|
-
<
|
1530
|
+
<oneOrMore>
|
1475
1531
|
<choice>
|
1476
1532
|
<ref name="clause-subsection"/>
|
1477
1533
|
<ref name="terms"/>
|
1478
1534
|
<ref name="definitions"/>
|
1479
1535
|
</choice>
|
1480
|
-
</
|
1481
|
-
</
|
1536
|
+
</oneOrMore>
|
1537
|
+
</choice>
|
1482
1538
|
</define>
|
1483
1539
|
<define name="Annex-Section">
|
1484
1540
|
<optional>
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
|
1
3
|
module Asciidoctor
|
2
4
|
module Ietf
|
3
5
|
class Converter < ::Asciidoctor::Standoc::Converter
|
@@ -10,15 +12,18 @@ module Asciidoctor
|
|
10
12
|
def image_validate(doc)
|
11
13
|
doc.xpath("//image").each do |i|
|
12
14
|
next if i["mimetype"] == "image/svg+xml"
|
15
|
+
|
13
16
|
@log.add("MIME", i, "image #{i['src'][0, 40]} is not SVG!")
|
14
17
|
end
|
15
18
|
end
|
16
19
|
|
17
20
|
def workgroup_validate(doc)
|
18
21
|
return if @workgroups.empty?
|
22
|
+
|
19
23
|
doc.xpath("//bibdata/ext/editorialgroup/workgroup").each do |wg|
|
20
24
|
wg_norm = wg.text.sub(/ (Working|Research) Group$/, "")
|
21
25
|
next if @workgroups.include?(wg_norm)
|
26
|
+
|
22
27
|
@log.add("Document Attributes", nil, "IETF: unrecognised working group #{wg.text}")
|
23
28
|
end
|
24
29
|
end
|
@@ -29,25 +34,29 @@ module Asciidoctor
|
|
29
34
|
File.join(File.dirname(__FILE__), "ietf.rng"))
|
30
35
|
end
|
31
36
|
|
37
|
+
def wgcache_name
|
38
|
+
"#{Dir.home}/.metanorma-ietf-workgroup-cache.json"
|
39
|
+
end
|
40
|
+
|
32
41
|
def open_wg_cache(node)
|
33
|
-
|
34
|
-
|
42
|
+
node.attr("flush-caches") == "true" and
|
43
|
+
FileUtils.rm wgcache_name, force: true
|
35
44
|
wg = []
|
36
45
|
if Pathname.new(wgcache_name).file?
|
37
46
|
begin
|
38
47
|
File.open(wgcache_name, "r") { |f| wg = JSON.parse(f.read) }
|
39
48
|
rescue Exception => e
|
40
|
-
|
49
|
+
warn "Cache #{wgcache_name} is invalid, drop it"
|
41
50
|
end
|
42
51
|
end
|
43
52
|
[wg, wgcache_name]
|
44
53
|
end
|
45
54
|
|
46
|
-
def cache_workgroup_ietf(wg,
|
47
|
-
|
48
|
-
|
49
|
-
f.each_line do |
|
50
|
-
|
55
|
+
def cache_workgroup_ietf(wg, _b)
|
56
|
+
warn "Reading workgroups from https://tools.ietf.org/wg/..."
|
57
|
+
URI.open("https://tools.ietf.org/wg/") do |f|
|
58
|
+
f.each_line do |l|
|
59
|
+
l.scan(%r{<td width="50%" style='padding: 0 1ex'>([^<]+)</td>}) do |w|
|
51
60
|
wg << w[0].gsub(/\s+$/, "").gsub(/ Working Group$/, "")
|
52
61
|
end
|
53
62
|
end
|
@@ -55,11 +64,11 @@ module Asciidoctor
|
|
55
64
|
wg
|
56
65
|
end
|
57
66
|
|
58
|
-
def cache_workgroup_irtf(wg,
|
59
|
-
|
60
|
-
|
61
|
-
f.each_line do |
|
62
|
-
|
67
|
+
def cache_workgroup_irtf(wg, _b)
|
68
|
+
warn "Reading workgroups from https://irtf.org/groups..."
|
69
|
+
URI.open("https://irtf.org/groups", ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE) do |f|
|
70
|
+
f.each_line do |l|
|
71
|
+
l.scan(%r{<a title="([^"]+) Research Group"[^>]+>([^<]+)<}) do |w|
|
63
72
|
wg << w[0].gsub(/\s+$/, "")
|
64
73
|
wg << w[1].gsub(/\s+$/, "") # abbrev
|
65
74
|
end
|
data/lib/isodoc/ietf/cleanup.rb
CHANGED
@@ -48,6 +48,17 @@ module IsoDoc::Ietf
|
|
48
48
|
figure_postamble(docxml)
|
49
49
|
figure_unnest(docxml)
|
50
50
|
figure_footnote_cleanup(docxml)
|
51
|
+
figure_data_uri(docxml)
|
52
|
+
end
|
53
|
+
|
54
|
+
def figure_data_uri(docxml)
|
55
|
+
docxml.xpath("//artwork").each do |a|
|
56
|
+
next unless %r{^data:image/svg\+xml;base64}.match?(a["src"])
|
57
|
+
|
58
|
+
f = Metanorma::Utils::save_dataimage(a["src"])
|
59
|
+
a.delete("src")
|
60
|
+
a.children = File.read(f).sub(%r{<\?.+\?>}, "")
|
61
|
+
end
|
51
62
|
end
|
52
63
|
|
53
64
|
def figure_unnest(docxml)
|
@@ -133,7 +144,7 @@ module IsoDoc::Ietf
|
|
133
144
|
docxml << "<back/>" and endnotes = docxml.at("//back")
|
134
145
|
end
|
135
146
|
endnotes << "<section><name>Endnotes</name></section>"
|
136
|
-
|
147
|
+
docxml.at("//back/section[last()]")
|
137
148
|
end
|
138
149
|
|
139
150
|
def image_cleanup(docxml)
|
@@ -153,13 +164,13 @@ module IsoDoc::Ietf
|
|
153
164
|
s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n")
|
154
165
|
.gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
|
155
166
|
sourcecode_remove_markup(s)
|
156
|
-
|
157
|
-
|
167
|
+
s.children = "<![CDATA[#{HTMLEntities.new.decode(s
|
168
|
+
.children.to_xml.sub(/\A\n+/, ''))}]]>"
|
158
169
|
end
|
159
170
|
end
|
160
171
|
|
161
|
-
def sourcecode_remove_markup(
|
162
|
-
|
172
|
+
def sourcecode_remove_markup(node)
|
173
|
+
node.traverse do |n|
|
163
174
|
next if n.text?
|
164
175
|
next if %w(name callout annotation note sourcecode).include? n.name
|
165
176
|
|
data/lib/isodoc/ietf/front.rb
CHANGED
@@ -25,10 +25,11 @@ module IsoDoc::Ietf
|
|
25
25
|
|
26
26
|
def output_if_translit(text)
|
27
27
|
return nil if text.nil?
|
28
|
+
|
28
29
|
text.transliterate != text ? text.transliterate : nil
|
29
30
|
end
|
30
31
|
|
31
|
-
def title(
|
32
|
+
def title(_isoxml, front)
|
32
33
|
title = @meta.get[:doctitle] or return
|
33
34
|
front.title title, **attr_code(abbrev: @meta.get[:docabbrev],
|
34
35
|
ascii: (@meta.get[:docascii] ||
|
@@ -49,18 +50,20 @@ module IsoDoc::Ietf
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def rfc_seriesinfo(isoxml, front)
|
52
|
-
front.seriesInfo **seriesinfo_attr(isoxml).merge({name: "RFC",
|
53
|
-
|
53
|
+
front.seriesInfo **seriesinfo_attr(isoxml).merge({ name: "RFC",
|
54
|
+
asciiName: "RFC" })
|
54
55
|
i = isoxml&.at(ns("//bibdata/series[@type = 'intended']")) and
|
55
56
|
front.seriesInfo nil,
|
56
|
-
|
57
|
-
|
57
|
+
**attr_code(name: "",
|
58
|
+
status: i&.at(ns("./title"))&.text,
|
59
|
+
value: i&.at(ns("./number"))&.text || "")
|
58
60
|
end
|
59
61
|
|
60
62
|
def id_seriesinfo(isoxml, front)
|
61
63
|
front.seriesInfo nil,
|
62
|
-
|
63
|
-
|
64
|
+
**seriesinfo_attr(isoxml)
|
65
|
+
.merge({ name: "Internet-Draft",
|
66
|
+
asciiName: "Internet-Draft" })
|
64
67
|
i = isoxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text and
|
65
68
|
front.seriesInfo **attr_code(name: "", value: "", status: i)
|
66
69
|
end
|
@@ -74,44 +77,49 @@ module IsoDoc::Ietf
|
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
77
|
-
def person_author_attrs(
|
78
|
-
return {} if
|
79
|
-
|
80
|
-
|
81
|
-
|
80
|
+
def person_author_attrs(contrib, role)
|
81
|
+
return {} if contrib.nil?
|
82
|
+
|
83
|
+
full = contrib&.at(ns("./completename"))&.text
|
84
|
+
init = contrib&.at(ns("./initial"))&.text ||
|
85
|
+
contrib&.xpath(ns("./forename"))&.map { |n| n.text[0] }&.join(".")
|
82
86
|
init = nil if init.empty?
|
83
87
|
ret = attr_code(role: role, fullname: full, initials: init,
|
84
|
-
surname:
|
85
|
-
pers_author_attrs1(ret, full, init,
|
86
|
-
end
|
87
|
-
|
88
|
-
def pers_author_attrs1(ret, full, init,
|
89
|
-
full and ret.merge!(
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
surname: contrib&.at(ns("./surname"))&.text)
|
89
|
+
pers_author_attrs1(ret, full, init, contrib)
|
90
|
+
end
|
91
|
+
|
92
|
+
def pers_author_attrs1(ret, full, init, contrib)
|
93
|
+
full and ret.merge!(
|
94
|
+
attr_code(
|
95
|
+
asciiFullname: output_if_translit(full),
|
96
|
+
asciiInitials: output_if_translit(init),
|
97
|
+
asciiSurname: output_if_translit(contrib&.at(ns("./surname"))),
|
98
|
+
),
|
99
|
+
)
|
93
100
|
ret
|
94
101
|
end
|
95
102
|
|
96
|
-
def person_author(
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
103
|
+
def person_author(contrib, role, front)
|
104
|
+
attrs = person_author_attrs(contrib.at(ns("./person/name")), role)
|
105
|
+
front.author **attrs do |a|
|
106
|
+
org = contrib.at(ns("./person/affiliation/organization")) and
|
107
|
+
organization(org, a, contrib.document.at(ns("//showOnFrontPage")))
|
108
|
+
address(contrib.xpath(ns(".//address")),
|
109
|
+
contrib.at(ns(".//phone[not(@type = 'fax')]")),
|
110
|
+
contrib.at(ns(".//phone[@type = 'fax']")),
|
111
|
+
contrib.xpath(ns(".//email")), contrib.xpath(ns(".//uri")), a)
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
107
|
-
def org_author(
|
115
|
+
def org_author(contrib, role, front)
|
108
116
|
front.author **attr_code(role: role) do |a|
|
109
|
-
organization(
|
110
|
-
|
111
|
-
address(
|
112
|
-
|
113
|
-
|
114
|
-
|
117
|
+
organization(contrib.at(ns("./organization")), a,
|
118
|
+
contrib.document.at(ns("//showOnFrontPage")))
|
119
|
+
address(contrib.at(ns(".//address")),
|
120
|
+
contrib.at(ns(".//phone[not(@type = 'fax')]")),
|
121
|
+
contrib.at(ns(".//phone[@type = 'fax']")),
|
122
|
+
contrib.at(ns(".//email")), contrib.at(ns(".//uri")), a)
|
115
123
|
end
|
116
124
|
end
|
117
125
|
|
@@ -120,11 +128,13 @@ module IsoDoc::Ietf
|
|
120
128
|
out.organization name, **attr_code(
|
121
129
|
showOnFrontPage: show&.text, ascii: output_if_translit(name),
|
122
130
|
asciiAbbrev: output_if_translit(org.at(ns("./abbreviation"))),
|
123
|
-
abbrev: org.at(ns("./abbreviation"))
|
131
|
+
abbrev: org.at(ns("./abbreviation"))
|
132
|
+
)
|
124
133
|
end
|
125
134
|
|
126
135
|
def address(addr, phone, fax, email, uri, out)
|
127
136
|
return unless addr || phone || fax || email || uri
|
137
|
+
|
128
138
|
out.address do |a|
|
129
139
|
addr and postal(addr, a)
|
130
140
|
phone and a.phone phone.text
|
@@ -164,10 +174,10 @@ module IsoDoc::Ietf
|
|
164
174
|
def email(email, out)
|
165
175
|
ascii = email.text.transliterate
|
166
176
|
out.email email.text,
|
167
|
-
|
177
|
+
**attr_code(ascii: ascii == email.text ? nil : ascii)
|
168
178
|
end
|
169
179
|
|
170
|
-
def date(
|
180
|
+
def date(_isoxml, front)
|
171
181
|
date = @meta.get[:publisheddate] || @meta.get[:circulateddate] || return
|
172
182
|
date = date.gsub(/T.*$/, "")
|
173
183
|
attr = date_attr(date) || return
|
@@ -176,8 +186,9 @@ module IsoDoc::Ietf
|
|
176
186
|
|
177
187
|
def date_attr(date)
|
178
188
|
return nil if date.nil?
|
189
|
+
|
179
190
|
if date.length == 4 && date =~ /^\d\d\d\d$/ then { year: date }
|
180
|
-
elsif
|
191
|
+
elsif /^\d\d\d\d-?\d\d$/.match?(date)
|
181
192
|
m = /^(?<year>\d\d\d\d)-(?<month>\d\d)$/.match date
|
182
193
|
{ month: Date::MONTHNAMES[(m[:month]).to_i], year: m[:year] }
|
183
194
|
else
|
@@ -185,25 +196,25 @@ module IsoDoc::Ietf
|
|
185
196
|
d = Date.iso8601 date
|
186
197
|
{ day: d.day.to_s.gsub(/^0/, ""), year: d.year,
|
187
198
|
month: Date::MONTHNAMES[d.month] }
|
188
|
-
rescue
|
199
|
+
rescue StandardError
|
189
200
|
nil
|
190
201
|
end
|
191
202
|
end
|
192
203
|
end
|
193
204
|
|
194
|
-
def area(
|
205
|
+
def area(_isoxml, front)
|
195
206
|
@meta.get[:areas].each do |w|
|
196
207
|
front.area w
|
197
208
|
end
|
198
209
|
end
|
199
210
|
|
200
|
-
def workgroup(
|
211
|
+
def workgroup(_isoxml, front)
|
201
212
|
@meta.get[:wg].each do |w|
|
202
213
|
front.workgroup w
|
203
214
|
end
|
204
215
|
end
|
205
216
|
|
206
|
-
def keyword(
|
217
|
+
def keyword(_isoxml, front)
|
207
218
|
@meta.get[:keywords].each do |kw|
|
208
219
|
front.keyword kw
|
209
220
|
end
|
@@ -231,7 +242,6 @@ module IsoDoc::Ietf
|
|
231
242
|
end
|
232
243
|
end
|
233
244
|
|
234
|
-
def boilerplate(isoxml, front)
|
235
|
-
end
|
245
|
+
def boilerplate(isoxml, front); end
|
236
246
|
end
|
237
247
|
end
|
@@ -3,6 +3,9 @@ module IsoDoc::Ietf
|
|
3
3
|
# TODO displayreference will be implemented as combination of autofetch and user-provided citations
|
4
4
|
|
5
5
|
def bibliography(isoxml, out)
|
6
|
+
isoxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
|
7
|
+
i.children = docid_prefix(i["type"], i.text)
|
8
|
+
end
|
6
9
|
isoxml.xpath(ns("//bibliography/references | "\
|
7
10
|
"//bibliography/clause[.//references] | "\
|
8
11
|
"//annex/clause[.//references] | "\
|
@@ -31,22 +34,21 @@ module IsoDoc::Ietf
|
|
31
34
|
i = 0
|
32
35
|
f.xpath(ns("./bibitem | ./note")).each do |b|
|
33
36
|
next if implicit_reference(b)
|
37
|
+
|
34
38
|
i += 1 if b.name == "bibitem"
|
35
39
|
if b.name == "note" then note_parse(b, div)
|
36
|
-
elsif
|
40
|
+
elsif is_ietf(b) then ietf_bibitem_entry(div, b, i)
|
37
41
|
else
|
38
42
|
nonstd_bibitem(div, b, i, biblio)
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
43
|
-
def nonstd_bibitem(list, b,
|
47
|
+
def nonstd_bibitem(list, b, _ordinal, _bibliography)
|
44
48
|
uris = b.xpath(ns("./uri"))
|
45
49
|
target = nil
|
46
50
|
uris&.each do |u|
|
47
|
-
if u["type"] == "src"
|
48
|
-
target = u.text
|
49
|
-
end
|
51
|
+
target = u.text if u["type"] == "src"
|
50
52
|
end
|
51
53
|
list.reference **attr_code(target: target,
|
52
54
|
anchor: b["id"]) do |r|
|
@@ -66,7 +68,8 @@ module IsoDoc::Ietf
|
|
66
68
|
r.refcontent id[1]
|
67
69
|
docidentifiers&.each do |u|
|
68
70
|
if %w(DOI IETF).include? u["type"]
|
69
|
-
r.seriesInfo nil, **attr_code(value: u.text
|
71
|
+
r.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI /, ""),
|
72
|
+
name: u["type"])
|
70
73
|
end
|
71
74
|
end
|
72
75
|
end
|
@@ -86,7 +89,7 @@ module IsoDoc::Ietf
|
|
86
89
|
"'publisher']"))
|
87
90
|
auths.each do |a|
|
88
91
|
role = a.at(ns("./role[@type = 'editor']")) ? "editor" : nil
|
89
|
-
p = a&.at(ns("./person/name")) and
|
92
|
+
p = a&.at(ns("./person/name")) and
|
90
93
|
relaton_person_to_author(p, role, f) or
|
91
94
|
relaton_org_to_author(a&.at(ns("./organization")), role, f)
|
92
95
|
end
|
@@ -99,17 +102,17 @@ module IsoDoc::Ietf
|
|
99
102
|
p&.xpath(ns("./forename"))&.map { |i| i.text[0] }&.join(" ")
|
100
103
|
initials = nil if initials.empty?
|
101
104
|
f.author nil,
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
105
|
+
**attr_code(fullname: fullname, asciiFullname: fullname&.transliterate,
|
106
|
+
role: role, surname: surname, initials: initials,
|
107
|
+
asciiSurname: fullname ? surname&.transliterate : nil,
|
108
|
+
asciiInitials: fullname ? initials&.transliterate : nil)
|
106
109
|
end
|
107
110
|
|
108
|
-
def relaton_org_to_author(o,
|
111
|
+
def relaton_org_to_author(o, _role, f)
|
109
112
|
name = o&.at(ns("./name"))&.text
|
110
113
|
abbrev = o&.at(ns("./abbreviation"))&.text
|
111
|
-
f.author do |
|
112
|
-
f.organization name, **attr_code(ascii: name&.transliterate,
|
114
|
+
f.author do |_a|
|
115
|
+
f.organization name, **attr_code(ascii: name&.transliterate,
|
113
116
|
abbrev: abbrev)
|
114
117
|
end
|
115
118
|
end
|
@@ -119,6 +122,7 @@ module IsoDoc::Ietf
|
|
119
122
|
b.at(ns("./date[@type = 'issued']")) ||
|
120
123
|
b.at(ns("./date[@type = 'circulated']"))
|
121
124
|
return unless date
|
125
|
+
|
122
126
|
attr = date_attr(date&.at(ns("./on | ./from"))&.text) || return
|
123
127
|
f.date **attr_code(attr)
|
124
128
|
end
|
@@ -145,13 +149,14 @@ module IsoDoc::Ietf
|
|
145
149
|
end
|
146
150
|
end
|
147
151
|
|
148
|
-
def ietf_bibitem_entry(div, b,
|
152
|
+
def ietf_bibitem_entry(div, b, _i)
|
149
153
|
url = b&.at(ns("./uri[@type = 'xml']"))&.text
|
150
154
|
div << "<xi:include href='#{url}'/>"
|
151
155
|
end
|
152
156
|
|
153
157
|
def is_ietf(b)
|
154
158
|
return false if !@xinclude
|
159
|
+
|
155
160
|
url = b.at(ns("./uri[@type = 'xml']")) or return false
|
156
161
|
/xml2rfc\.tools\.ietf\.org/.match(url)
|
157
162
|
end
|
@@ -15,7 +15,7 @@ require_relative "./init"
|
|
15
15
|
|
16
16
|
module IsoDoc::Ietf
|
17
17
|
class RfcConvert < ::IsoDoc::Convert
|
18
|
-
def convert1(docxml,
|
18
|
+
def convert1(docxml, _filename, _dir)
|
19
19
|
@xrefs.parse docxml
|
20
20
|
info docxml, nil
|
21
21
|
xml = noko do |xml|
|
@@ -51,6 +51,7 @@ module IsoDoc::Ietf
|
|
51
51
|
def error_parse(node, out)
|
52
52
|
case node.name
|
53
53
|
when "bcp14" then bcp14_parse(node, out)
|
54
|
+
when "concept" then concept_parse(node, out)
|
54
55
|
else
|
55
56
|
text = node.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
56
57
|
out.t { |p| p << text }
|
@@ -59,6 +60,7 @@ module IsoDoc::Ietf
|
|
59
60
|
|
60
61
|
def omit_docid_prefix(prefix)
|
61
62
|
return true if prefix == "IETF"
|
63
|
+
|
62
64
|
super
|
63
65
|
end
|
64
66
|
|
@@ -67,9 +69,9 @@ module IsoDoc::Ietf
|
|
67
69
|
end
|
68
70
|
|
69
71
|
def postprocess(result, filename, _dir)
|
70
|
-
result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
|
71
|
-
sub(/<!DOCTYPE[^>]+>\n/, "")
|
72
|
-
sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
|
72
|
+
result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
|
73
|
+
.sub(/<!DOCTYPE[^>]+>\n/, "")
|
74
|
+
.sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
|
73
75
|
File.open(filename, "w:UTF-8") { |f| f.write(result) }
|
74
76
|
schema_validate(filename)
|
75
77
|
@files_to_delete.each { |f| FileUtils.rm_rf f }
|
data/lib/isodoc/ietf/section.rb
CHANGED
@@ -2,7 +2,7 @@ module IsoDoc::Ietf
|
|
2
2
|
class RfcConvert < ::IsoDoc::Convert
|
3
3
|
def common_rfc_pis(node)
|
4
4
|
rfc_pis = {
|
5
|
-
|
5
|
+
artworkdelimiter: node&.at(ns("//pi/artworkdelimiter"))&.text,
|
6
6
|
artworklines: node&.at(ns("//pi/artworklines"))&.text,
|
7
7
|
authorship: node&.at(ns("//pi/authorship"))&.text,
|
8
8
|
autobreaks: node&.at(ns("//pi/autobreaks"))&.text,
|
@@ -53,30 +53,32 @@ module IsoDoc::Ietf
|
|
53
53
|
|
54
54
|
def rfc_attributes(docxml)
|
55
55
|
t = Time.now.getutc
|
56
|
-
obs = xpath_comma(docxml
|
57
|
-
"//bibdata/relation[@type = 'obsoletes']/bibitem/docidentifier")))
|
58
|
-
upd = xpath_comma(docxml
|
59
|
-
"//bibdata/relation[@type = 'updates']/bibitem/docidentifier")))
|
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
60
|
{
|
61
|
-
docName:
|
62
|
-
number:
|
63
|
-
category:
|
64
|
-
docxml&.at(ns("//bibdata/series[@type = 'intended']/title"))&.text
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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,
|
75
76
|
submissionType: docxml&.at(ns(
|
76
|
-
"//bibdata/series[@type = 'stream']/title"
|
77
|
-
|
78
|
-
|
79
|
-
|
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",
|
80
82
|
}
|
81
83
|
end
|
82
84
|
|
@@ -86,7 +88,7 @@ module IsoDoc::Ietf
|
|
86
88
|
when "informational", "info" then "info"
|
87
89
|
when "experimental", "exp" then "exp"
|
88
90
|
when "bcp" then "bcp"
|
89
|
-
when "fyi"
|
91
|
+
when "fyi" then "info"
|
90
92
|
when "full-standard" then "std"
|
91
93
|
when "historic" then "historic"
|
92
94
|
else
|
@@ -96,17 +98,19 @@ module IsoDoc::Ietf
|
|
96
98
|
|
97
99
|
def xpath_comma(xpath)
|
98
100
|
return nil if xpath.empty?
|
99
|
-
|
101
|
+
|
102
|
+
xpath.map(&:text).join(", ")
|
100
103
|
end
|
101
104
|
|
102
105
|
def make_link(out, isoxml)
|
103
|
-
links = isoxml
|
104
|
-
"//bibdata/relation[@type = 'includedIn' or
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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"]) }
|
113
|
+
end
|
110
114
|
end
|
111
115
|
|
112
116
|
def rel2iana(type)
|
@@ -115,7 +119,7 @@ module IsoDoc::Ietf
|
|
115
119
|
when "describedBy" then "describedby"
|
116
120
|
when "derivedFrom" then "convertedfrom"
|
117
121
|
when "instance" then "alternate"
|
118
|
-
else
|
122
|
+
else
|
119
123
|
"alternate"
|
120
124
|
end
|
121
125
|
end
|
@@ -133,17 +137,21 @@ module IsoDoc::Ietf
|
|
133
137
|
end
|
134
138
|
end
|
135
139
|
|
136
|
-
def clause_parse_title(
|
137
|
-
return unless
|
140
|
+
def clause_parse_title(_node, div, clause, _out, _heading_attrs = {})
|
141
|
+
return unless clause
|
142
|
+
|
138
143
|
div.name do |n|
|
139
|
-
|
144
|
+
clause&.children&.each { |c2| parse(c2, n) }
|
140
145
|
end
|
141
146
|
end
|
142
147
|
|
143
148
|
def clause_parse(node, out)
|
144
149
|
return if node.at(ns(".//references"))
|
145
|
-
|
146
|
-
|
150
|
+
|
151
|
+
out.section **attr_code(
|
152
|
+
anchor: node["id"], numbered: node["numbered"],
|
153
|
+
removeInRFC: node["removeInRFC"], toc: node["toc"]
|
154
|
+
) do |div|
|
147
155
|
clause_parse_title(node, div, node.at(ns("./title")), out)
|
148
156
|
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
149
157
|
parse(c1, div)
|
@@ -152,11 +160,12 @@ module IsoDoc::Ietf
|
|
152
160
|
end
|
153
161
|
|
154
162
|
def clause(isoxml, out)
|
155
|
-
isoxml.xpath("//xmlns:preface/child::*
|
163
|
+
isoxml.xpath("//xmlns:preface/child::*"\
|
164
|
+
"[not(name() = 'abstract' or name() = 'foreword')] "\
|
156
165
|
"| //xmlns:sections/child::*").each do |c|
|
157
|
-
#cdup = c.dup
|
158
|
-
#cdup.xpath(ns(".//references")).each { |r| r.remove }
|
159
|
-
#cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
|
166
|
+
# cdup = c.dup
|
167
|
+
# cdup.xpath(ns(".//references")).each { |r| r.remove }
|
168
|
+
# cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
|
160
169
|
clause_parse(c, out)
|
161
170
|
end
|
162
171
|
end
|
data/lib/isodoc/ietf/terms.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module IsoDoc::Ietf
|
2
2
|
class RfcConvert < ::IsoDoc::Convert
|
3
|
-
|
4
3
|
def definition_parse(node, out)
|
5
4
|
node.children.each { |n| parse(n, out) }
|
6
5
|
end
|
@@ -46,7 +45,19 @@ module IsoDoc::Ietf
|
|
46
45
|
clause_parse(node, out)
|
47
46
|
end
|
48
47
|
|
49
|
-
def termdocsource_parse(_node, _out)
|
48
|
+
def termdocsource_parse(_node, _out); end
|
49
|
+
|
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) }
|
54
|
+
end
|
55
|
+
out << " "
|
56
|
+
end
|
57
|
+
out << "[term defined in "
|
58
|
+
r = node.at(ns("./xref | ./eref | ./termref"))
|
59
|
+
parse(r, out)
|
60
|
+
out << "]"
|
50
61
|
end
|
51
62
|
end
|
52
63
|
end
|
data/metanorma-ietf.gemspec
CHANGED
@@ -33,12 +33,13 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.bindir = "exe"
|
34
34
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
35
|
spec.require_paths = ["lib"]
|
36
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
36
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
37
37
|
|
38
|
-
spec.add_dependency "isodoc", "~> 1.
|
38
|
+
spec.add_dependency "isodoc", "~> 1.7.0"
|
39
39
|
spec.add_dependency "mathml2asciimath"
|
40
|
-
spec.add_dependency "metanorma-standoc", "~> 1.
|
41
|
-
spec.add_dependency "nokogiri", "~> 1.
|
40
|
+
spec.add_dependency "metanorma-standoc", "~> 1.10.0"
|
41
|
+
spec.add_dependency "nokogiri", "~> 1.11.6"
|
42
|
+
spec.add_dependency "open-uri"
|
42
43
|
|
43
44
|
spec.add_development_dependency "byebug"
|
44
45
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
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.6
|
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-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.7.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.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mathml2asciimath
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.10.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.10.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.11.6
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.11.6
|
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'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: byebug
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,6 +275,7 @@ files:
|
|
261
275
|
- lib/asciidoctor/ietf/basicdoc.rng
|
262
276
|
- lib/asciidoctor/ietf/biblio.rng
|
263
277
|
- lib/asciidoctor/ietf/blocks.rb
|
278
|
+
- lib/asciidoctor/ietf/cleanup.rb
|
264
279
|
- lib/asciidoctor/ietf/converter.rb
|
265
280
|
- lib/asciidoctor/ietf/front.rb
|
266
281
|
- lib/asciidoctor/ietf/ietf.rng
|
@@ -306,7 +321,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
321
|
requirements:
|
307
322
|
- - ">="
|
308
323
|
- !ruby/object:Gem::Version
|
309
|
-
version: 2.
|
324
|
+
version: 2.5.0
|
310
325
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
311
326
|
requirements:
|
312
327
|
- - ">="
|