metanorma-ietf 3.1.4 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/ietf/blocks.rb +27 -12
- data/lib/isodoc/ietf/inline.rb +9 -1
- data/lib/isodoc/ietf/table.rb +7 -2
- data/lib/isodoc/ietf/terms.rb +32 -7
- data/lib/metanorma/ietf/ietf.rng +3 -8
- data/lib/metanorma/ietf/isodoc.rng +45 -14
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 964f8ef59757342a374a94bb7aafa59e6486f54333a72e22d9b4d6de87c13277
|
4
|
+
data.tar.gz: a146d584aed9903007f40ab0d899bb517ec247c49adb40e1e5abcc1bb4cfabac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02cb6e4655562acc988f616a222d415369677abcdf759fd2883e05401b535f8f6d30ec31b6be095f5ef9e0f638c643f541f73e3687c956141a06c6121e0d43b0
|
7
|
+
data.tar.gz: 5cb6eb0d2e991ff34419b62f07b9fd7d386fe52bb6af1bae8f51b599ed5ec61eea698c86d6225f1e8130a2979754b90e9263b6ca3a3283db59c9810aab7946b3
|
data/lib/isodoc/ietf/blocks.rb
CHANGED
@@ -87,8 +87,8 @@ module IsoDoc
|
|
87
87
|
p << note_label(node)
|
88
88
|
first.name == "p" and first.children.each { |n| parse(n, p) }
|
89
89
|
end
|
90
|
-
first.name == "p" and
|
91
|
-
node.elements.drop(1).each { |n| parse(n, out) } or
|
90
|
+
(first.name == "p" and
|
91
|
+
node.elements.drop(1).each { |n| parse(n, out) }) or
|
92
92
|
node.children.each { |n| parse(n, out) }
|
93
93
|
end
|
94
94
|
end
|
@@ -112,13 +112,21 @@ module IsoDoc
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def source_parse(node, out)
|
116
|
+
termref_parse(node, out)
|
117
|
+
end
|
118
|
+
|
115
119
|
def sourcecode_parse(node, out)
|
116
120
|
out.sourcecode **attr_code(
|
117
121
|
anchor: node["id"], type: node["lang"], name: node["filename"],
|
118
122
|
markers: node["markers"], src: node["src"]
|
119
123
|
) do |s|
|
120
|
-
node.children.each
|
124
|
+
node.children.each do |x|
|
125
|
+
%w(name dl).include?(x.name) and next
|
126
|
+
parse(x, s)
|
127
|
+
end
|
121
128
|
end
|
129
|
+
annotation_parse(node, out)
|
122
130
|
end
|
123
131
|
|
124
132
|
def pre_parse(node, out)
|
@@ -130,13 +138,20 @@ module IsoDoc
|
|
130
138
|
|
131
139
|
def annotation_parse(node, out)
|
132
140
|
@sourcecode = false
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
141
|
+
node.at(ns("./annotation")) or return
|
142
|
+
out.t { |p| p << @i18n.key }
|
143
|
+
out.dl do |dl|
|
144
|
+
node.xpath(ns("./annotation")).each do |a|
|
145
|
+
annotation_parse1(a, dl)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def annotation_parse1(ann, dlist)
|
151
|
+
dlist.dt ann.at(ns("//callout[@target='#{ann['id']}']")).text
|
152
|
+
dlist.dd do |dd|
|
153
|
+
ann.children.each { |n| parse(n, dd) }
|
154
|
+
end
|
140
155
|
end
|
141
156
|
|
142
157
|
def formula_where(dlist, out)
|
@@ -189,7 +204,7 @@ module IsoDoc
|
|
189
204
|
end
|
190
205
|
|
191
206
|
def admonition_name_parse(_node, div, name)
|
192
|
-
div.t
|
207
|
+
div.t keepWithNext: "true" do |p|
|
193
208
|
name.children.each { |n| parse(n, p) }
|
194
209
|
end
|
195
210
|
end
|
@@ -197,7 +212,7 @@ module IsoDoc
|
|
197
212
|
def admonition_parse(node, out)
|
198
213
|
type = node["type"]
|
199
214
|
name = admonition_name(node, type)
|
200
|
-
out.aside
|
215
|
+
out.aside anchor: node["id"] do |t|
|
201
216
|
admonition_name_parse(node, t, name) if name
|
202
217
|
node.children.each { |n| parse(n, t) unless n.name == "name" }
|
203
218
|
end
|
data/lib/isodoc/ietf/inline.rb
CHANGED
@@ -93,7 +93,7 @@ module IsoDoc
|
|
93
93
|
|
94
94
|
def image_title_parse(out, caption)
|
95
95
|
unless caption.nil?
|
96
|
-
out.t
|
96
|
+
out.t align: "center", keepWithPrevious: "true" do |p|
|
97
97
|
p << caption.to_s
|
98
98
|
end
|
99
99
|
end
|
@@ -141,6 +141,14 @@ module IsoDoc
|
|
141
141
|
&.sub(/,$/, "") || ""
|
142
142
|
end
|
143
143
|
|
144
|
+
def origin_parse(node, out)
|
145
|
+
if t = node.at(ns("./termref"))
|
146
|
+
termrefelem_parse(t, out)
|
147
|
+
else
|
148
|
+
eref_parse(node, out)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
144
152
|
def index_parse(node, out)
|
145
153
|
out.iref nil, **attr_code(item: node.at(ns("./primary")).text,
|
146
154
|
primary: node["primary"],
|
data/lib/isodoc/ietf/table.rb
CHANGED
@@ -8,14 +8,19 @@ module IsoDoc
|
|
8
8
|
def table_parse(node, out)
|
9
9
|
@in_table = true
|
10
10
|
out.table **table_attrs(node) do |t|
|
11
|
-
table_title_parse(node,
|
11
|
+
table_title_parse(node, t)
|
12
12
|
thead_parse(node, t)
|
13
13
|
tbody_parse(node, t)
|
14
14
|
tfoot_parse(node, t)
|
15
15
|
end
|
16
|
+
table_parse_tail(node, out)
|
17
|
+
@in_table = false
|
18
|
+
end
|
19
|
+
|
20
|
+
def table_parse_tail(node, out)
|
16
21
|
(dl = node.at(ns("./dl"))) && parse(dl, out)
|
22
|
+
node.xpath(ns("./source")).each { |n| parse(n, out) }
|
17
23
|
node.xpath(ns("./note")).each { |n| parse(n, out) }
|
18
|
-
@in_table = false
|
19
24
|
end
|
20
25
|
|
21
26
|
def table_title_parse(node, out)
|
data/lib/isodoc/ietf/terms.rb
CHANGED
@@ -37,13 +37,6 @@ module IsoDoc
|
|
37
37
|
note_parse(node, out)
|
38
38
|
end
|
39
39
|
|
40
|
-
def termref_parse(node, out)
|
41
|
-
out.t do |p|
|
42
|
-
p << "SOURCE: "
|
43
|
-
node.children.each { |n| parse(n, p) }
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
40
|
def termdef_parse(node, out)
|
48
41
|
set_termdomain("")
|
49
42
|
node.xpath(ns("./definition")).size > 1 and
|
@@ -65,6 +58,38 @@ module IsoDoc
|
|
65
58
|
parse(r, out)
|
66
59
|
out << "]"
|
67
60
|
end
|
61
|
+
|
62
|
+
def termsource_status(status)
|
63
|
+
case status
|
64
|
+
when "modified" then @i18n.modified
|
65
|
+
when "adapted" then @i18n.adapted
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def termsource_add_modification_text(mod)
|
70
|
+
mod or return
|
71
|
+
mod.text.strip.empty? or mod.previous = " – "
|
72
|
+
mod.elements.size == 1 and
|
73
|
+
mod.elements[0].replace(mod.elements[0].children)
|
74
|
+
mod.replace(mod.children)
|
75
|
+
end
|
76
|
+
|
77
|
+
def preprocess_termref(elem)
|
78
|
+
origin = elem.at(ns("./origin"))
|
79
|
+
s = termsource_status(elem["status"]) and origin.next = l10n(", #{s}")
|
80
|
+
termsource_add_modification_text(elem.at(ns("./modification")))
|
81
|
+
while elem&.next_element&.name == "termsource"
|
82
|
+
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def termref_parse(elem, out)
|
87
|
+
preprocess_termref(elem)
|
88
|
+
elem.children = l10n("[#{@i18n.source}: #{to_xml(elem.children).strip}]")
|
89
|
+
out.t do |p|
|
90
|
+
elem.children.each { |n| parse(n, p) }
|
91
|
+
end
|
92
|
+
end
|
68
93
|
end
|
69
94
|
end
|
70
95
|
end
|
data/lib/metanorma/ietf/ietf.rng
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<grammar ns=
|
2
|
+
<grammar ns='https://www.metanorma.org/ns/ietf' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
3
|
<!--
|
4
|
+
VERSION v1.2.1
|
4
5
|
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
|
5
6
|
we cannot have a new default namespace: we will end up with a grammar with two different
|
6
7
|
namespaces, one for isostandard and one for ietf additions. And we do not want that.
|
@@ -584,13 +585,7 @@
|
|
584
585
|
</define>
|
585
586
|
<define name="ietf-standard">
|
586
587
|
<element name="ietf-standard">
|
587
|
-
<
|
588
|
-
<attribute name="type">
|
589
|
-
<choice>
|
590
|
-
<value>semantic</value>
|
591
|
-
<value>presentation</value>
|
592
|
-
</choice>
|
593
|
-
</attribute>
|
588
|
+
<ref name="Root-Attributes"/>
|
594
589
|
<ref name="bibdata"/>
|
595
590
|
<zeroOrMore>
|
596
591
|
<ref name="termdocsource"/>
|
@@ -17,6 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
+
<!-- VERSION v1.2.2 -->
|
20
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
21
22
|
<include href="reqt.rng"/>
|
22
23
|
<include href="basicdoc.rng">
|
@@ -210,6 +211,9 @@
|
|
210
211
|
<data type="boolean"/>
|
211
212
|
</attribute>
|
212
213
|
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="style"/>
|
216
|
+
</optional>
|
213
217
|
<ref name="CitationType"/>
|
214
218
|
<oneOrMore>
|
215
219
|
<ref name="PureTextElement"/>
|
@@ -382,6 +386,9 @@
|
|
382
386
|
<optional>
|
383
387
|
<ref name="dl"/>
|
384
388
|
</optional>
|
389
|
+
<optional>
|
390
|
+
<ref name="source"/>
|
391
|
+
</optional>
|
385
392
|
</element>
|
386
393
|
</define>
|
387
394
|
<define name="figure">
|
@@ -404,9 +411,6 @@
|
|
404
411
|
<attribute name="class"/>
|
405
412
|
</optional>
|
406
413
|
<ref name="BlockAttributes"/>
|
407
|
-
<optional>
|
408
|
-
<ref name="source"/>
|
409
|
-
</optional>
|
410
414
|
<optional>
|
411
415
|
<ref name="tname"/>
|
412
416
|
</optional>
|
@@ -431,6 +435,20 @@
|
|
431
435
|
<zeroOrMore>
|
432
436
|
<ref name="note"/>
|
433
437
|
</zeroOrMore>
|
438
|
+
<optional>
|
439
|
+
<ref name="source"/>
|
440
|
+
</optional>
|
441
|
+
</element>
|
442
|
+
</define>
|
443
|
+
<define name="source">
|
444
|
+
<element name="source">
|
445
|
+
<attribute name="status">
|
446
|
+
<ref name="SourceStatusType"/>
|
447
|
+
</attribute>
|
448
|
+
<ref name="origin"/>
|
449
|
+
<optional>
|
450
|
+
<ref name="modification"/>
|
451
|
+
</optional>
|
434
452
|
</element>
|
435
453
|
</define>
|
436
454
|
<define name="sourcecode">
|
@@ -1335,15 +1353,19 @@
|
|
1335
1353
|
</choice>
|
1336
1354
|
</element>
|
1337
1355
|
</define>
|
1356
|
+
<define name="Root-Attributes">
|
1357
|
+
<attribute name="version"/>
|
1358
|
+
<attribute name="schema-version"/>
|
1359
|
+
<attribute name="type">
|
1360
|
+
<choice>
|
1361
|
+
<value>semantic</value>
|
1362
|
+
<value>presentation</value>
|
1363
|
+
</choice>
|
1364
|
+
</attribute>
|
1365
|
+
</define>
|
1338
1366
|
<define name="standard-document">
|
1339
1367
|
<element name="standard-document">
|
1340
|
-
<
|
1341
|
-
<attribute name="type">
|
1342
|
-
<choice>
|
1343
|
-
<value>semantic</value>
|
1344
|
-
<value>presentation</value>
|
1345
|
-
</choice>
|
1346
|
-
</attribute>
|
1368
|
+
<ref name="Root-Attributes"/>
|
1347
1369
|
<ref name="bibdata"/>
|
1348
1370
|
<optional>
|
1349
1371
|
<ref name="misccontainer"/>
|
@@ -2099,10 +2121,7 @@
|
|
2099
2121
|
<define name="termsource">
|
2100
2122
|
<element name="termsource">
|
2101
2123
|
<attribute name="status">
|
2102
|
-
<
|
2103
|
-
<value>identical</value>
|
2104
|
-
<value>modified</value>
|
2105
|
-
</choice>
|
2124
|
+
<ref name="SourceStatusType"/>
|
2106
2125
|
</attribute>
|
2107
2126
|
<attribute name="type">
|
2108
2127
|
<choice>
|
@@ -2116,6 +2135,18 @@
|
|
2116
2135
|
</optional>
|
2117
2136
|
</element>
|
2118
2137
|
</define>
|
2138
|
+
<define name="SourceStatusType">
|
2139
|
+
<choice>
|
2140
|
+
<value>identical</value>
|
2141
|
+
<value>modified</value>
|
2142
|
+
<value>adapted</value>
|
2143
|
+
<value>restyled</value>
|
2144
|
+
<value>context-added</value>
|
2145
|
+
<value>generalisation</value>
|
2146
|
+
<value>specialisation</value>
|
2147
|
+
<value>unspecified</value>
|
2148
|
+
</choice>
|
2149
|
+
</define>
|
2119
2150
|
<define name="origin">
|
2120
2151
|
<element name="origin">
|
2121
2152
|
<choice>
|
data/metanorma-ietf.gemspec
CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
|
39
39
|
spec.add_dependency "mathml2asciimath"
|
40
40
|
spec.add_dependency "metanorma-ietf-data"
|
41
|
-
spec.add_dependency "metanorma-standoc", "~> 2.4.
|
41
|
+
spec.add_dependency "metanorma-standoc", "~> 2.4.2"
|
42
42
|
|
43
43
|
spec.add_development_dependency "debug"
|
44
44
|
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: 3.1.
|
4
|
+
version: 3.1.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: 2023-
|
11
|
+
date: 2023-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mathml2asciimath
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.4.
|
47
|
+
version: 2.4.2
|
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: 2.4.
|
54
|
+
version: 2.4.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: debug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|