metanorma-ietf 3.0.1 → 3.0.3
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/inline.rb +8 -31
- data/lib/isodoc/ietf/rfc_convert.rb +71 -67
- data/lib/isodoc/ietf/terms.rb +1 -1
- data/lib/isodoc/ietf/xref.rb +1 -0
- data/lib/metanorma/ietf/ietf.rng +1 -1
- data/lib/metanorma/ietf/isodoc.rng +73 -3
- 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: 51d0713bcfae4cec3a50c1c840c445df4b12d0b7c8b31ae75eae87ef5dde0a67
|
4
|
+
data.tar.gz: 62ca2ad04f15976d681a621d399bb463cf339d496b98a8111cf4ec8ef9792c8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfb117a7bae17c2ad66302424b97672dc35bbc4b710af759c4e191c9a01dfa4d30326324786760cc5437b845e7941472fd524dc8b6ee9b85cb94f8ef29424dd4
|
7
|
+
data.tar.gz: a4ecb6cc11f97bde100cb8c9a8870379ddd732fcf638abf6b928502b056c95e80ed82c044a65998f5b1e871bf2a9b6dc21d3ac58a4c388168ea97e09191ffac5
|
data/lib/isodoc/ietf/inline.rb
CHANGED
@@ -107,10 +107,10 @@ module IsoDoc
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def get_linkend(node)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
no_loc_contents = node.children.reject do |c|
|
111
|
+
%w{locality localityStack location}.include? c.name
|
112
|
+
end
|
113
|
+
contents = no_loc_contents.select { |c| !c.text? || /\S/.match(c) }
|
114
114
|
!contents.empty? and
|
115
115
|
return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
|
116
116
|
""
|
@@ -122,9 +122,10 @@ module IsoDoc
|
|
122
122
|
end
|
123
123
|
relative = node["relative"] ||
|
124
124
|
node.at(ns(".//locality[@type = 'anchor']/referenceFrom"))&.text || ""
|
125
|
-
section =
|
126
|
-
|
127
|
-
|
125
|
+
section = @isodoc.eref_localities(
|
126
|
+
node.xpath(ns("./locality | ./localityStack")), nil, node
|
127
|
+
)&.sub(/^,/, "")&.sub(/^\s*(Section|Clause)/, "")&.strip&.sub(/,$/, "") || ""
|
128
|
+
# section = "" unless relative.empty?
|
128
129
|
out.relref **attr_code(target: node["bibitemid"], section: section,
|
129
130
|
relative: relative,
|
130
131
|
displayFormat: node["displayFormat"]) do |l|
|
@@ -132,30 +133,6 @@ module IsoDoc
|
|
132
133
|
end
|
133
134
|
end
|
134
135
|
|
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
|
145
|
-
end
|
146
|
-
ret << ret1
|
147
|
-
ret.reject { |c| c.nil? || c.empty? }.join("; ")
|
148
|
-
end
|
149
|
-
|
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
|
-
""
|
157
|
-
end
|
158
|
-
|
159
136
|
def index_parse(node, out)
|
160
137
|
out.iref nil, **attr_code(item: node.at(ns("./primary")).text,
|
161
138
|
primary: node["primary"],
|
@@ -13,85 +13,89 @@ require_relative "./validation"
|
|
13
13
|
require_relative "./xref"
|
14
14
|
require_relative "./init"
|
15
15
|
|
16
|
-
module IsoDoc
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
module IsoDoc
|
17
|
+
module Ietf
|
18
|
+
class RfcConvert < ::IsoDoc::Convert
|
19
|
+
def convert1(docxml, _filename, _dir)
|
20
|
+
@xrefs.parse docxml
|
21
|
+
info docxml, nil
|
22
|
+
ret = noko do |xml|
|
23
|
+
xml.rfc **attr_code(rfc_attributes(docxml)) do |html|
|
24
|
+
make_link(html, docxml)
|
25
|
+
make_front(html, docxml)
|
26
|
+
make_middle(html, docxml)
|
27
|
+
make_back(html, docxml)
|
28
|
+
end
|
29
|
+
end.join("\n").sub(/<!DOCTYPE[^>]+>\n/, "")
|
30
|
+
set_pis(docxml, Nokogiri::XML(ret))
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
def metadata_init(lang, script, i18n)
|
34
|
+
@meta = Metadata.new(lang, script, i18n)
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
def xref_init(lang, script, klass, i18n, options)
|
38
|
+
@xrefs = Xref.new(lang, script, klass, i18n, options)
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
def extract_delims(text)
|
42
|
+
@openmathdelim = "$$"
|
43
|
+
@closemathdelim = "$$"
|
44
|
+
while %r{#{Regexp.escape(@openmathdelim)}}m.match(text) ||
|
45
|
+
%r{#{Regexp.escape(@closemathdelim)}}m.match(text)
|
46
|
+
@openmathdelim += "$"
|
47
|
+
@closemathdelim += "$"
|
48
|
+
end
|
49
|
+
[@openmathdelim, @closemathdelim]
|
47
50
|
end
|
48
|
-
[@openmathdelim, @closemathdelim]
|
49
|
-
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
def error_parse(node, out)
|
53
|
+
case node.name
|
54
|
+
when "bcp14" then bcp14_parse(node, out)
|
55
|
+
when "concept" then concept_parse(node, out)
|
56
|
+
when "verbal-definition", "non-verbal-representation"
|
57
|
+
node.elements.each { |n| parse(n, out) }
|
58
|
+
else
|
59
|
+
text = node.to_xml.gsub(/</, "<").gsub(/>/, ">")
|
60
|
+
out.t { |p| p << text }
|
61
|
+
end
|
60
62
|
end
|
61
|
-
end
|
62
63
|
|
63
|
-
|
64
|
-
|
64
|
+
def omit_docid_prefix(prefix)
|
65
|
+
return true if %w(IETF RFC).include?(prefix)
|
65
66
|
|
66
|
-
|
67
|
-
|
67
|
+
super
|
68
|
+
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
def textcleanup(docxml)
|
71
|
+
passthrough_cleanup(docxml)
|
72
|
+
end
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
74
|
+
def postprocess(result, filename, _dir)
|
75
|
+
result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
|
76
|
+
.sub(/<!DOCTYPE[^>]+>\n/, "")
|
77
|
+
.sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
|
78
|
+
File.open(filename, "w:UTF-8") { |f| f.write(result) }
|
79
|
+
schema_validate(filename)
|
80
|
+
@files_to_delete.each { |f| FileUtils.rm_rf f }
|
81
|
+
content_validate(to_xhtml(result), filename)
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
def init_file(filename, debug)
|
85
|
+
filename = filename.sub(/\.rfc\.xml$/, ".rfc")
|
86
|
+
super
|
87
|
+
end
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
def initialize(options)
|
90
|
+
super
|
91
|
+
@xinclude = options[:use_xinclude] == "true"
|
92
|
+
@format = :rfc
|
93
|
+
@suffix = "rfc.xml"
|
94
|
+
@isodoc = IsoDoc::PresentationXMLConvert.new({})
|
95
|
+
@isodoc.i18n_init("en", "Latn")
|
96
|
+
end
|
94
97
|
|
95
|
-
|
98
|
+
include ::IsoDoc::Ietf::Init
|
99
|
+
end
|
96
100
|
end
|
97
101
|
end
|
data/lib/isodoc/ietf/terms.rb
CHANGED
data/lib/isodoc/ietf/xref.rb
CHANGED
data/lib/metanorma/ietf/ietf.rng
CHANGED
@@ -152,9 +152,7 @@
|
|
152
152
|
<data type="boolean"/>
|
153
153
|
</attribute>
|
154
154
|
</optional>
|
155
|
-
<
|
156
|
-
<ref name="PureTextElement"/>
|
157
|
-
</oneOrMore>
|
155
|
+
<ref name="XrefBody"/>
|
158
156
|
</element>
|
159
157
|
</define>
|
160
158
|
<define name="erefType">
|
@@ -188,6 +186,42 @@
|
|
188
186
|
<ref name="PureTextElement"/>
|
189
187
|
</oneOrMore>
|
190
188
|
</define>
|
189
|
+
<define name="localityStack">
|
190
|
+
<element name="localityStack">
|
191
|
+
<optional>
|
192
|
+
<attribute name="connective">
|
193
|
+
<choice>
|
194
|
+
<value>and</value>
|
195
|
+
<value>or</value>
|
196
|
+
<value>from</value>
|
197
|
+
<value>to</value>
|
198
|
+
<value/>
|
199
|
+
</choice>
|
200
|
+
</attribute>
|
201
|
+
</optional>
|
202
|
+
<zeroOrMore>
|
203
|
+
<ref name="locality"/>
|
204
|
+
</zeroOrMore>
|
205
|
+
</element>
|
206
|
+
</define>
|
207
|
+
<define name="sourceLocalityStack">
|
208
|
+
<element name="sourceLocalityStack">
|
209
|
+
<optional>
|
210
|
+
<attribute name="connective">
|
211
|
+
<choice>
|
212
|
+
<value>and</value>
|
213
|
+
<value>or</value>
|
214
|
+
<value>from</value>
|
215
|
+
<value>to</value>
|
216
|
+
<value/>
|
217
|
+
</choice>
|
218
|
+
</attribute>
|
219
|
+
</optional>
|
220
|
+
<zeroOrMore>
|
221
|
+
<ref name="sourceLocality"/>
|
222
|
+
</zeroOrMore>
|
223
|
+
</element>
|
224
|
+
</define>
|
191
225
|
<define name="ul">
|
192
226
|
<element name="ul">
|
193
227
|
<attribute name="id">
|
@@ -1098,6 +1132,16 @@
|
|
1098
1132
|
</define>
|
1099
1133
|
</include>
|
1100
1134
|
<!-- end overrides -->
|
1135
|
+
<define name="image" combine="choice">
|
1136
|
+
<element name="svg">
|
1137
|
+
<oneOrMore>
|
1138
|
+
<choice>
|
1139
|
+
<text/>
|
1140
|
+
<ref name="AnyElement"/>
|
1141
|
+
</choice>
|
1142
|
+
</oneOrMore>
|
1143
|
+
</element>
|
1144
|
+
</define>
|
1101
1145
|
<define name="MultilingualRenderingType">
|
1102
1146
|
<choice>
|
1103
1147
|
<value>common</value>
|
@@ -2631,4 +2675,30 @@
|
|
2631
2675
|
</zeroOrMore>
|
2632
2676
|
</element>
|
2633
2677
|
</define>
|
2678
|
+
<define name="XrefBody">
|
2679
|
+
<zeroOrMore>
|
2680
|
+
<ref name="XrefTarget"/>
|
2681
|
+
</zeroOrMore>
|
2682
|
+
<oneOrMore>
|
2683
|
+
<ref name="PureTextElement"/>
|
2684
|
+
</oneOrMore>
|
2685
|
+
</define>
|
2686
|
+
<define name="XrefTarget">
|
2687
|
+
<element name="location">
|
2688
|
+
<attribute name="target">
|
2689
|
+
<data type="string">
|
2690
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
2691
|
+
</data>
|
2692
|
+
</attribute>
|
2693
|
+
<attribute name="connective">
|
2694
|
+
<choice>
|
2695
|
+
<value>and</value>
|
2696
|
+
<value>or</value>
|
2697
|
+
<value>from</value>
|
2698
|
+
<value>to</value>
|
2699
|
+
<value/>
|
2700
|
+
</choice>
|
2701
|
+
</attribute>
|
2702
|
+
</element>
|
2703
|
+
</define>
|
2634
2704
|
</grammar>
|
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.0.
|
4
|
+
version: 3.0.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-
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mathml2asciimath
|