relaton-ietf 1.0.3 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/rspec +29 -0
- data/grammars/biblio.rng +35 -5
- data/grammars/isodoc.rng +17 -1
- data/grammars/isostandard.rng +9 -1
- data/lib/relaton_ietf/scrapper.rb +26 -9
- data/lib/relaton_ietf/version.rb +1 -1
- data/relaton_ietf.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3006ceb252c3088fecd5336bf823174607e924b833e16a6d2fe4576ea2c7bd96
|
4
|
+
data.tar.gz: 168f027b083c485350ceb59337702f99559da99408b4ea62f19306ac29400368
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64fc796033522eb10b764b741fba523ba11fcb5fd4c9806df0cb2156bbe76bff150dec088c6e031d2ff318c87bb16560ebb09479998bc92d8d4205ae5f6ba12d
|
7
|
+
data.tar.gz: 14d06c4354e3b2a61ae946ca819bbbe56aa7f5cfabba7ffe4d57dbf68e9112ef3828dc0d755969bba0460a38cd7e0c90356a74c1dfa289b8cfed0621580b3fa5
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/grammars/biblio.rng
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
<text/>
|
89
89
|
</element>
|
90
90
|
</define>
|
91
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
92
92
|
<optional>
|
93
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
94
94
|
<attribute name="language"/>
|
@@ -98,6 +98,16 @@
|
|
98
98
|
</optional>
|
99
99
|
<text/>
|
100
100
|
</define>
|
101
|
+
<define name="LocalizedString">
|
102
|
+
<choice>
|
103
|
+
<ref name="LocalizedString1"/>
|
104
|
+
<oneOrMore>
|
105
|
+
<element name="variant">
|
106
|
+
<ref name="LocalizedString1"/>
|
107
|
+
</element>
|
108
|
+
</oneOrMore>
|
109
|
+
</choice>
|
110
|
+
</define>
|
101
111
|
<!--
|
102
112
|
Unlike UML, change type to format: type is overloaded
|
103
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -121,7 +131,7 @@
|
|
121
131
|
</optional>
|
122
132
|
<ref name="LocalizedStringOrXsAny"/>
|
123
133
|
</define>
|
124
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
125
135
|
<optional>
|
126
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
127
137
|
<attribute name="language"/>
|
@@ -136,6 +146,16 @@
|
|
136
146
|
</choice>
|
137
147
|
</oneOrMore>
|
138
148
|
</define>
|
149
|
+
<define name="LocalizedStringOrXsAny">
|
150
|
+
<choice>
|
151
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
152
|
+
<oneOrMore>
|
153
|
+
<element name="variant">
|
154
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
155
|
+
</element>
|
156
|
+
</oneOrMore>
|
157
|
+
</choice>
|
158
|
+
</define>
|
139
159
|
<define name="contributor">
|
140
160
|
<element name="contributor">
|
141
161
|
<zeroOrMore>
|
@@ -641,9 +661,9 @@
|
|
641
661
|
<optional>
|
642
662
|
<ref name="status"/>
|
643
663
|
</optional>
|
644
|
-
<
|
664
|
+
<zeroOrMore>
|
645
665
|
<ref name="copyright"/>
|
646
|
-
</
|
666
|
+
</zeroOrMore>
|
647
667
|
<zeroOrMore>
|
648
668
|
<ref name="docrelation"/>
|
649
669
|
</zeroOrMore>
|
@@ -1001,7 +1021,17 @@
|
|
1001
1021
|
<optional>
|
1002
1022
|
<ref name="to"/>
|
1003
1023
|
</optional>
|
1004
|
-
<
|
1024
|
+
<oneOrMore>
|
1025
|
+
<ref name="owner"/>
|
1026
|
+
</oneOrMore>
|
1027
|
+
<optional>
|
1028
|
+
<ref name="copyright_scope"/>
|
1029
|
+
</optional>
|
1030
|
+
</element>
|
1031
|
+
</define>
|
1032
|
+
<define name="copyright_scope">
|
1033
|
+
<element name="scope">
|
1034
|
+
<text/>
|
1005
1035
|
</element>
|
1006
1036
|
</define>
|
1007
1037
|
<define name="from">
|
data/grammars/isodoc.rng
CHANGED
@@ -53,6 +53,14 @@
|
|
53
53
|
<optional>
|
54
54
|
<attribute name="alt"/>
|
55
55
|
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="case">
|
58
|
+
<choice>
|
59
|
+
<value>capital</value>
|
60
|
+
<value>lowercase</value>
|
61
|
+
</choice>
|
62
|
+
</attribute>
|
63
|
+
</optional>
|
56
64
|
<text/>
|
57
65
|
</element>
|
58
66
|
</define>
|
@@ -902,7 +910,15 @@
|
|
902
910
|
<attribute name="id">
|
903
911
|
<data type="ID"/>
|
904
912
|
</attribute>
|
905
|
-
<
|
913
|
+
<oneOrMore>
|
914
|
+
<choice>
|
915
|
+
<ref name="paragraph"/>
|
916
|
+
<ref name="ul"/>
|
917
|
+
<ref name="ol"/>
|
918
|
+
<ref name="dl"/>
|
919
|
+
<ref name="formula"/>
|
920
|
+
</choice>
|
921
|
+
</oneOrMore>
|
906
922
|
</element>
|
907
923
|
</define>
|
908
924
|
<define name="termexample">
|
data/grammars/isostandard.rng
CHANGED
@@ -91,6 +91,12 @@
|
|
91
91
|
</define>
|
92
92
|
<define name="sections">
|
93
93
|
<element name="sections">
|
94
|
+
<zeroOrMore>
|
95
|
+
<choice>
|
96
|
+
<ref name="note"/>
|
97
|
+
<ref name="admonition"/>
|
98
|
+
</choice>
|
99
|
+
</zeroOrMore>
|
94
100
|
<ref name="clause"/>
|
95
101
|
<optional>
|
96
102
|
<choice>
|
@@ -263,6 +269,8 @@
|
|
263
269
|
<value>publicly-available-specification</value>
|
264
270
|
<value>international-workshop-agreement</value>
|
265
271
|
<value>guide</value>
|
272
|
+
<value>amendment</value>
|
273
|
+
<value>technical-corrigendum</value>
|
266
274
|
</choice>
|
267
275
|
</define>
|
268
276
|
<define name="structuredidentifier">
|
@@ -510,7 +518,7 @@
|
|
510
518
|
</attribute>
|
511
519
|
</optional>
|
512
520
|
<oneOrMore>
|
513
|
-
<ref name="
|
521
|
+
<ref name="BasicBlock"/>
|
514
522
|
</oneOrMore>
|
515
523
|
</element>
|
516
524
|
</define>
|
@@ -192,7 +192,8 @@ module RelatonIetf
|
|
192
192
|
|
193
193
|
# @return [Array<Hash{Symbol=>RelatonBib::Person,Symbol=>Array<String>}>]
|
194
194
|
def persons(reference)
|
195
|
-
reference.xpath("./front/author").
|
195
|
+
reference.xpath("./front/author[@surname]|./front/author[@fullname]").
|
196
|
+
map do |author|
|
196
197
|
entity = RelatonBib::Person.new(
|
197
198
|
name: full_name(author, reference),
|
198
199
|
affiliation: [affiliation(author)],
|
@@ -205,10 +206,15 @@ module RelatonIetf
|
|
205
206
|
# @return [Array<Hash{Symbol=>RelatonBib::Organization,Symbol=>Array<String>}>]
|
206
207
|
def organizations(reference)
|
207
208
|
publisher = { entity: new_org, role: [type: "publisher"] }
|
208
|
-
reference.xpath("./seriesinfo").reduce([publisher]) do |mem, si|
|
209
|
+
orgs = reference.xpath("./seriesinfo").reduce([publisher]) do |mem, si|
|
209
210
|
next mem unless si[:stream]
|
210
211
|
|
211
|
-
mem << { entity: new_org(si[:stream]), role: [type: "author"] }
|
212
|
+
mem << { entity: new_org(si[:stream], nil), role: [type: "author"] }
|
213
|
+
end
|
214
|
+
orgs + reference.xpath(
|
215
|
+
"front/author[not(@surname)][not(@fullname)]/organization",
|
216
|
+
).map do |org|
|
217
|
+
{ entity: new_org(org.text, nil), role: [type: "author"] }
|
212
218
|
end
|
213
219
|
end
|
214
220
|
|
@@ -216,17 +222,21 @@ module RelatonIetf
|
|
216
222
|
# @param ref [Nokogiri::XML::Document]
|
217
223
|
# @return [RelatonBib::FullName]
|
218
224
|
def full_name(author, ref)
|
225
|
+
lang = language ref
|
219
226
|
RelatonBib::FullName.new(
|
220
|
-
completename: localized_string(author[:fullname],
|
221
|
-
initial: [localized_string(author[:initials],
|
222
|
-
surname:
|
227
|
+
completename: localized_string(author[:fullname], lang),
|
228
|
+
initial: [localized_string(author[:initials], lang)].compact,
|
229
|
+
surname: localized_string(author[:surname], lang),
|
223
230
|
)
|
224
231
|
end
|
225
232
|
|
226
233
|
# @param content [String]
|
234
|
+
# @param lang [String]
|
227
235
|
# @return [RelatonBib::LocalizedString]
|
228
|
-
def localized_string(content,
|
229
|
-
|
236
|
+
def localized_string(content, lang)
|
237
|
+
return unless content
|
238
|
+
|
239
|
+
RelatonBib::LocalizedString.new(content, lang)
|
230
240
|
end
|
231
241
|
|
232
242
|
# @param postal [Nokogiri::XML::Document]
|
@@ -275,6 +285,9 @@ module RelatonIetf
|
|
275
285
|
RelatonBib::Affiliation.new organization: org
|
276
286
|
end
|
277
287
|
|
288
|
+
# @param name [String]
|
289
|
+
# @param abbr [String]
|
290
|
+
# @return [RelatonBib::Organization]
|
278
291
|
def new_org(name = "Internet Engineering Task Force", abbr = "IETF")
|
279
292
|
RelatonBib::Organization.new name: name, abbreviation: abbr
|
280
293
|
end
|
@@ -306,6 +319,8 @@ module RelatonIetf
|
|
306
319
|
[RelatonBib::BibliographicDate.new(type: "published", on: date)]
|
307
320
|
end
|
308
321
|
|
322
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
323
|
+
|
309
324
|
#
|
310
325
|
# Extract document identifiers from reference
|
311
326
|
#
|
@@ -315,7 +330,8 @@ module RelatonIetf
|
|
315
330
|
# @return [Array<RelatonBib::DocumentIdentifier>]
|
316
331
|
#
|
317
332
|
def docids(reference, ver)
|
318
|
-
id = (reference[:anchor] || reference[:docName]
|
333
|
+
id = (reference[:anchor] || reference[:docName] || reference[:number]).
|
334
|
+
sub(/^(RFC)/, "\\1 ")
|
319
335
|
ret = []
|
320
336
|
ret << RelatonBib::DocumentIdentifier.new(type: "IETF", id: id)
|
321
337
|
if (id = reference[:anchor])
|
@@ -329,6 +345,7 @@ module RelatonIetf
|
|
329
345
|
RelatonBib::DocumentIdentifier.new(id: id, type: si[:name])
|
330
346
|
end.compact
|
331
347
|
end
|
348
|
+
# enable Metrics/MethodLength, Metrics/AbcSize
|
332
349
|
|
333
350
|
#
|
334
351
|
# Extract series form reference
|
data/lib/relaton_ietf/version.rb
CHANGED
data/relaton_ietf.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.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: 2020-
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|
@@ -154,16 +154,16 @@ dependencies:
|
|
154
154
|
name: relaton-bib
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.0
|
159
|
+
version: 1.1.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.0
|
166
|
+
version: 1.1.0
|
167
167
|
description: "RelatonIetf: retrieve IETF Standards for bibliographic use \nusing the
|
168
168
|
BibliographicItem model.\n\nFormerly known as rfcbib.\n"
|
169
169
|
email:
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- README.adoc
|
185
185
|
- Rakefile
|
186
186
|
- bin/console
|
187
|
+
- bin/rspec
|
187
188
|
- bin/setup
|
188
189
|
- grammars/basicdoc.rng
|
189
190
|
- grammars/biblio.rng
|