relaton-bib 1.6.2 → 1.7.4
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/.github/workflows/rake.yml +46 -0
- data/README.adoc +1 -5
- data/grammars/isodoc.rng +14 -43
- data/lib/relaton_bib/bibliographic_item.rb +13 -6
- data/lib/relaton_bib/bibtex_parser.rb +2 -2
- data/lib/relaton_bib/copyright_association.rb +1 -1
- data/lib/relaton_bib/document_relation_collection.rb +1 -1
- data/lib/relaton_bib/document_status.rb +2 -1
- data/lib/relaton_bib/hash_converter.rb +17 -17
- data/lib/relaton_bib/organization.rb +1 -1
- data/lib/relaton_bib/typed_title_string.rb +3 -3
- data/lib/relaton_bib/version.rb +1 -1
- data/lib/relaton_bib/xml_parser.rb +13 -7
- data/relaton-bib.gemspec +3 -3
- metadata +6 -36
- data/.github/workflows/macos.yml +0 -40
- data/.github/workflows/ubuntu.yml +0 -39
- data/.github/workflows/windows.yml +0 -41
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b6bd4bd9de5c3300f0e9e765b2e87f6f979be9bb1cc4860a5cb9e0bf26af2d0
|
|
4
|
+
data.tar.gz: c5ffd10e31eef03986e76e0d52e17e3a88bf4b157400be867d19893bcac700ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8dfad60d8cd0f3e092ddd7b09fc0c9f40e770a63fd7b5cd4ed6024e5150500d303ebe5a86c878963761f4da8e2bf65b148148f0dacc0525e284fbadb101acf01
|
|
7
|
+
data.tar.gz: ec92a3eff1a3c24c1e2e2e9c17c94a96188bbd53af56135c155037f2319d0ff747e4345fcb1599ca56cdb8f0760dff25b2122e8ae4e8c8b9812b353ea6ec238d
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: rake
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [ master, main ]
|
|
8
|
+
tags: [ v* ]
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
rake:
|
|
13
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
ruby: [ '2.7', '2.6', '2.5', '2.4' ]
|
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
|
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
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v2
|
|
34
|
+
with:
|
|
35
|
+
submodules: true
|
|
36
|
+
|
|
37
|
+
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
|
38
|
+
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
|
39
|
+
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
|
40
|
+
|
|
41
|
+
- uses: ruby/setup-ruby@v1
|
|
42
|
+
with:
|
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
|
44
|
+
bundler-cache: true
|
|
45
|
+
|
|
46
|
+
- run: bundle exec rake
|
data/README.adoc
CHANGED
|
@@ -363,11 +363,7 @@ hash = YAML.load_file 'spec/examples/bib_item.yml'
|
|
|
363
363
|
=> {"id"=>"ISO/TC211",
|
|
364
364
|
...
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
=> {:id=>"ISO/TC211",
|
|
368
|
-
...
|
|
369
|
-
|
|
370
|
-
RelatonBib::BibliographicItem.new bib_hash
|
|
366
|
+
RelatonBib::BibliographicItem.from_hash hash
|
|
371
367
|
=> #<RelatonBib::BibliographicItem:0x007ff1524f8c88
|
|
372
368
|
...
|
|
373
369
|
----
|
data/grammars/isodoc.rng
CHANGED
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
<start>
|
|
25
25
|
<ref name="standard-document"/>
|
|
26
26
|
</start>
|
|
27
|
+
<define name="doctype">
|
|
28
|
+
<element name="doctype">
|
|
29
|
+
<optional>
|
|
30
|
+
<attribute name="abbreviation"/>
|
|
31
|
+
</optional>
|
|
32
|
+
<ref name="DocumentType"/>
|
|
33
|
+
</element>
|
|
34
|
+
</define>
|
|
27
35
|
<define name="hyperlink">
|
|
28
36
|
<element name="link">
|
|
29
37
|
<attribute name="target">
|
|
@@ -141,6 +149,11 @@
|
|
|
141
149
|
<data type="boolean"/>
|
|
142
150
|
</attribute>
|
|
143
151
|
</optional>
|
|
152
|
+
<optional>
|
|
153
|
+
<attribute name="key">
|
|
154
|
+
<data type="boolean"/>
|
|
155
|
+
</attribute>
|
|
156
|
+
</optional>
|
|
144
157
|
<oneOrMore>
|
|
145
158
|
<ref name="dt"/>
|
|
146
159
|
<ref name="dd"/>
|
|
@@ -1164,49 +1177,7 @@
|
|
|
1164
1177
|
</define>
|
|
1165
1178
|
<define name="annex">
|
|
1166
1179
|
<element name="annex">
|
|
1167
|
-
<
|
|
1168
|
-
<attribute name="id">
|
|
1169
|
-
<data type="ID"/>
|
|
1170
|
-
</attribute>
|
|
1171
|
-
</optional>
|
|
1172
|
-
<optional>
|
|
1173
|
-
<attribute name="language"/>
|
|
1174
|
-
</optional>
|
|
1175
|
-
<optional>
|
|
1176
|
-
<attribute name="script"/>
|
|
1177
|
-
</optional>
|
|
1178
|
-
<optional>
|
|
1179
|
-
<attribute name="inline-header">
|
|
1180
|
-
<data type="boolean"/>
|
|
1181
|
-
</attribute>
|
|
1182
|
-
</optional>
|
|
1183
|
-
<attribute name="obligation">
|
|
1184
|
-
<choice>
|
|
1185
|
-
<value>normative</value>
|
|
1186
|
-
<value>informative</value>
|
|
1187
|
-
</choice>
|
|
1188
|
-
</attribute>
|
|
1189
|
-
<optional>
|
|
1190
|
-
<ref name="section-title"/>
|
|
1191
|
-
</optional>
|
|
1192
|
-
<group>
|
|
1193
|
-
<group>
|
|
1194
|
-
<zeroOrMore>
|
|
1195
|
-
<ref name="BasicBlock"/>
|
|
1196
|
-
</zeroOrMore>
|
|
1197
|
-
<zeroOrMore>
|
|
1198
|
-
<ref name="note"/>
|
|
1199
|
-
</zeroOrMore>
|
|
1200
|
-
</group>
|
|
1201
|
-
<zeroOrMore>
|
|
1202
|
-
<choice>
|
|
1203
|
-
<ref name="annex-subsection"/>
|
|
1204
|
-
<ref name="terms"/>
|
|
1205
|
-
<ref name="definitions"/>
|
|
1206
|
-
<ref name="references"/>
|
|
1207
|
-
</choice>
|
|
1208
|
-
</zeroOrMore>
|
|
1209
|
-
</group>
|
|
1180
|
+
<ref name="Annex-Section"/>
|
|
1210
1181
|
</element>
|
|
1211
1182
|
</define>
|
|
1212
1183
|
<define name="terms">
|
|
@@ -197,23 +197,23 @@ module RelatonBib
|
|
|
197
197
|
@title = TypedTitleStringCollection.new(args[:title])
|
|
198
198
|
|
|
199
199
|
@date = (args[:date] || []).map do |d|
|
|
200
|
-
d.is_a?(Hash) ? BibliographicDate.new(d) : d
|
|
200
|
+
d.is_a?(Hash) ? BibliographicDate.new(**d) : d
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
@contributor = (args[:contributor] || []).map do |c|
|
|
204
204
|
if c.is_a? Hash
|
|
205
|
-
e = c[:entity].is_a?(Hash) ? Organization.new(c[:entity]) : c[:entity]
|
|
205
|
+
e = c[:entity].is_a?(Hash) ? Organization.new(**c[:entity]) : c[:entity]
|
|
206
206
|
ContributionInfo.new(entity: e, role: c[:role])
|
|
207
207
|
else c
|
|
208
208
|
end
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
@abstract = (args[:abstract] || []).map do |a|
|
|
212
|
-
a.is_a?(Hash) ? FormattedString.new(a) : a
|
|
212
|
+
a.is_a?(Hash) ? FormattedString.new(**a) : a
|
|
213
213
|
end
|
|
214
214
|
|
|
215
215
|
@copyright = args.fetch(:copyright, []).map do |c|
|
|
216
|
-
c.is_a?(Hash) ? CopyrightAssociation.new(c) : c
|
|
216
|
+
c.is_a?(Hash) ? CopyrightAssociation.new(**c) : c
|
|
217
217
|
end
|
|
218
218
|
|
|
219
219
|
@docidentifier = args[:docid] || []
|
|
@@ -229,7 +229,7 @@ module RelatonBib
|
|
|
229
229
|
@status = args[:docstatus]
|
|
230
230
|
@relation = DocRelationCollection.new(args[:relation] || [])
|
|
231
231
|
@link = args.fetch(:link, []).map do |s|
|
|
232
|
-
if s.is_a?(Hash) then TypedUri.new(s)
|
|
232
|
+
if s.is_a?(Hash) then TypedUri.new(**s)
|
|
233
233
|
elsif s.is_a?(String) then TypedUri.new(content: s)
|
|
234
234
|
else s
|
|
235
235
|
end
|
|
@@ -257,6 +257,13 @@ module RelatonBib
|
|
|
257
257
|
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
|
258
258
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
259
259
|
|
|
260
|
+
# @param hash [Hash]
|
|
261
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
|
262
|
+
def self.from_hash(hash)
|
|
263
|
+
item_hash = ::RelatonBib::HashConverter.hash_to_bib(hash)
|
|
264
|
+
new **item_hash
|
|
265
|
+
end
|
|
266
|
+
|
|
260
267
|
# @param lang [String] language code Iso639
|
|
261
268
|
# @return [RelatonBib::FormattedString, Array<RelatonBib::FormattedString>]
|
|
262
269
|
def abstract(lang: nil)
|
|
@@ -399,7 +406,7 @@ module RelatonBib
|
|
|
399
406
|
# @param type [Symbol] type of url, can be :src/:obp/:rss
|
|
400
407
|
# @return [String]
|
|
401
408
|
def url(type = :src)
|
|
402
|
-
@link.detect { |s| s.type == type.to_s }
|
|
409
|
+
@link.detect { |s| s.type == type.to_s }&.content&.to_s
|
|
403
410
|
end
|
|
404
411
|
|
|
405
412
|
def abstract=(value)
|
|
@@ -101,14 +101,14 @@ module RelatonBib
|
|
|
101
101
|
if bibtex["organization"]
|
|
102
102
|
contributor << {
|
|
103
103
|
entity: { name: bibtex.organization.to_s },
|
|
104
|
-
role: [{ type: "distributor", description: ["sponsor"] }]
|
|
104
|
+
role: [{ type: "distributor", description: ["sponsor"] }],
|
|
105
105
|
}
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
if bibtex["school"]
|
|
109
109
|
contributor << {
|
|
110
110
|
entity: { name: bibtex.school.to_s },
|
|
111
|
-
role: [{ type: "distributor", description: ["sponsor"] }]
|
|
111
|
+
role: [{ type: "distributor", description: ["sponsor"] }],
|
|
112
112
|
}
|
|
113
113
|
end
|
|
114
114
|
contributor
|
|
@@ -30,7 +30,7 @@ module RelatonBib
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
@owner = owner.map do |o|
|
|
33
|
-
o.is_a?(Hash) ? ContributionInfo.new(entity: Organization.new(o)) : o
|
|
33
|
+
o.is_a?(Hash) ? ContributionInfo.new(entity: Organization.new(**o)) : o
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
@from = Date.strptime(from.to_s, "%Y") if from.to_s.match? /\d{4}/
|
|
@@ -18,7 +18,7 @@ module RelatonBib
|
|
|
18
18
|
# RelatonBib::SourceLocalityStack>] :source_locality
|
|
19
19
|
# @option relation [RelatonBib::BibliographicItem, NillClass] :bibitem (nil)
|
|
20
20
|
def initialize(relation)
|
|
21
|
-
@array = relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(r) : r }
|
|
21
|
+
@array = relation.map { |r| r.is_a?(Hash) ? DocumentRelation.new(**r) : r }
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# @todo We don't have replace type anymore. Suppose we should update this
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module RelatonBib
|
|
3
4
|
# Document status.
|
|
4
5
|
class DocumentStatus
|
|
@@ -54,7 +55,7 @@ module RelatonBib
|
|
|
54
55
|
# @return [RelatonBib::DocumentStatus::Stage]
|
|
55
56
|
def stage_new(stg)
|
|
56
57
|
if stg.is_a?(Stage) then stg
|
|
57
|
-
elsif stg.is_a?(Hash) then Stage.new(stg)
|
|
58
|
+
elsif stg.is_a?(Hash) then Stage.new(**stg)
|
|
58
59
|
elsif stg.is_a?(String) then Stage.new(value: stg)
|
|
59
60
|
end
|
|
60
61
|
end
|
|
@@ -97,7 +97,7 @@ module RelatonBib
|
|
|
97
97
|
return unless ret[:place]
|
|
98
98
|
|
|
99
99
|
ret[:place] = array(ret[:place]).map do |pl|
|
|
100
|
-
pl.is_a?(String) ? Place.new(name: pl) : Place.new(pl)
|
|
100
|
+
pl.is_a?(String) ? Place.new(name: pl) : Place.new(**pl)
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
@@ -120,12 +120,12 @@ module RelatonBib
|
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
-
def docid_hash_to_bib(ret)
|
|
123
|
+
def docid_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize
|
|
124
124
|
return unless ret[:docid]
|
|
125
125
|
|
|
126
126
|
ret[:docid] = array(ret[:docid])
|
|
127
127
|
ret[:docid]&.each_with_index do |id, i|
|
|
128
|
-
type = id[:type] || id[:id].match(/^\w
|
|
128
|
+
type = id[:type] || id[:id].match(/^\w+(?=\s)/)&.to_s
|
|
129
129
|
ret[:docid][i] = DocumentIdentifier.new(id: id[:id], type: type,
|
|
130
130
|
scope: id[:scope])
|
|
131
131
|
end
|
|
@@ -146,7 +146,7 @@ module RelatonBib
|
|
|
146
146
|
ret[:biblionote] = array(ret[:biblionote])
|
|
147
147
|
.reduce(BiblioNoteCollection.new([])) do |mem, n|
|
|
148
148
|
mem << if n.is_a?(String) then BiblioNote.new content: n
|
|
149
|
-
else BiblioNote.new(n)
|
|
149
|
+
else BiblioNote.new(**n)
|
|
150
150
|
end
|
|
151
151
|
end
|
|
152
152
|
end
|
|
@@ -219,7 +219,7 @@ module RelatonBib
|
|
|
219
219
|
)
|
|
220
220
|
end
|
|
221
221
|
|
|
222
|
-
def fullname_hash_to_bib(person) # rubocop:disable Metrics/AbcSize,
|
|
222
|
+
def fullname_hash_to_bib(person) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
223
223
|
n = person[:name]
|
|
224
224
|
FullName.new(
|
|
225
225
|
forename: array(n[:forename])&.map { |f| localname(f, person) },
|
|
@@ -247,10 +247,10 @@ module RelatonBib
|
|
|
247
247
|
script: d[:script], format: d[:format] }
|
|
248
248
|
else { content: d }
|
|
249
249
|
end
|
|
250
|
-
FormattedString.new cnt
|
|
250
|
+
FormattedString.new **cnt
|
|
251
251
|
end
|
|
252
252
|
Affiliation.new(
|
|
253
|
-
organization: Organization.new(org_hash_to_bib(a[:organization])),
|
|
253
|
+
organization: Organization.new(**org_hash_to_bib(a[:organization])),
|
|
254
254
|
description: a[:description]
|
|
255
255
|
)
|
|
256
256
|
end
|
|
@@ -288,7 +288,7 @@ module RelatonBib
|
|
|
288
288
|
ret[:relation] = array(ret[:relation])
|
|
289
289
|
ret[:relation]&.each do |r|
|
|
290
290
|
if r[:description]
|
|
291
|
-
r[:description] = FormattedString.new r[:description]
|
|
291
|
+
r[:description] = FormattedString.new **r[:description]
|
|
292
292
|
end
|
|
293
293
|
relation_bibitem_hash_to_bib(r)
|
|
294
294
|
relation_locality_hash_to_bib(r)
|
|
@@ -309,7 +309,7 @@ module RelatonBib
|
|
|
309
309
|
# @param item_hash [Hash]
|
|
310
310
|
# @return [RelatonBib::BibliographicItem]
|
|
311
311
|
def bib_item(item_hash)
|
|
312
|
-
BibliographicItem.new item_hash
|
|
312
|
+
BibliographicItem.new **item_hash
|
|
313
313
|
end
|
|
314
314
|
|
|
315
315
|
# @param rel [Hash] relation
|
|
@@ -356,26 +356,26 @@ module RelatonBib
|
|
|
356
356
|
end
|
|
357
357
|
s[:abbreviation] &&
|
|
358
358
|
s[:abbreviation] = localizedstring(s[:abbreviation])
|
|
359
|
-
Series.new(s)
|
|
359
|
+
Series.new(**s)
|
|
360
360
|
end
|
|
361
361
|
end
|
|
362
362
|
|
|
363
363
|
# @param title [Hash]
|
|
364
364
|
# @return [RelatonBib::TypedTitleString]
|
|
365
365
|
def typed_title_strig(title)
|
|
366
|
-
TypedTitleString.new title
|
|
366
|
+
TypedTitleString.new **title
|
|
367
367
|
end
|
|
368
368
|
|
|
369
369
|
# @param ret [Hash]
|
|
370
370
|
def medium_hash_to_bib(ret)
|
|
371
|
-
ret[:medium] = Medium.new(ret[:medium]) if ret[:medium]
|
|
371
|
+
ret[:medium] = Medium.new(**ret[:medium]) if ret[:medium]
|
|
372
372
|
end
|
|
373
373
|
|
|
374
374
|
# @param ret [Hash]
|
|
375
375
|
def classification_hash_to_bib(ret)
|
|
376
376
|
if ret[:classification]
|
|
377
377
|
ret[:classification] = array(ret[:classification]).map do |cls|
|
|
378
|
-
Classification.new cls
|
|
378
|
+
Classification.new **cls
|
|
379
379
|
end
|
|
380
380
|
end
|
|
381
381
|
end
|
|
@@ -409,7 +409,7 @@ module RelatonBib
|
|
|
409
409
|
return unless ret[:editorialgroup]
|
|
410
410
|
|
|
411
411
|
technical_committee = array(ret[:editorialgroup]).map do |wg|
|
|
412
|
-
TechnicalCommittee.new WorkGroup.new(wg)
|
|
412
|
+
TechnicalCommittee.new WorkGroup.new(**wg)
|
|
413
413
|
end
|
|
414
414
|
ret[:editorialgroup] = EditorialGroup.new technical_committee
|
|
415
415
|
end
|
|
@@ -418,7 +418,7 @@ module RelatonBib
|
|
|
418
418
|
def ics_hash_to_bib(ret)
|
|
419
419
|
return unless ret[:ics]
|
|
420
420
|
|
|
421
|
-
ret[:ics] = array(ret[:ics]).map { |ics| ICS.new ics }
|
|
421
|
+
ret[:ics] = array(ret[:ics]).map { |ics| ICS.new **ics }
|
|
422
422
|
end
|
|
423
423
|
|
|
424
424
|
# @param ret [Hash]
|
|
@@ -427,7 +427,7 @@ module RelatonBib
|
|
|
427
427
|
|
|
428
428
|
sids = array(ret[:structuredidentifier]).map do |si|
|
|
429
429
|
si[:agency] = array si[:agency]
|
|
430
|
-
StructuredIdentifier.new si
|
|
430
|
+
StructuredIdentifier.new **si
|
|
431
431
|
end
|
|
432
432
|
ret[:structuredidentifier] = StructuredIdentifierCollection.new sids
|
|
433
433
|
end
|
|
@@ -485,7 +485,7 @@ module RelatonBib
|
|
|
485
485
|
# @return [RelatonBib::FormattedRef]
|
|
486
486
|
def formattedref(frf)
|
|
487
487
|
if frf.is_a?(Hash)
|
|
488
|
-
RelatonBib::FormattedRef.new(frf)
|
|
488
|
+
RelatonBib::FormattedRef.new(**frf)
|
|
489
489
|
else
|
|
490
490
|
RelatonBib::FormattedRef.new(content: frf)
|
|
491
491
|
end
|
|
@@ -8,7 +8,7 @@ module RelatonBib
|
|
|
8
8
|
# @param title [Array<RelatonBib::TypedTitleString, Hash>]
|
|
9
9
|
def initialize(title = [])
|
|
10
10
|
@array = (title || []).map do |t|
|
|
11
|
-
t.is_a?(Hash) ? TypedTitleString.new(t) : t
|
|
11
|
+
t.is_a?(Hash) ? TypedTitleString.new(**t) : t
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -96,12 +96,12 @@ module RelatonBib
|
|
|
96
96
|
fsargs = args.select do |k, _v|
|
|
97
97
|
%i[content language script format].include? k
|
|
98
98
|
end
|
|
99
|
-
@title = FormattedString.new(fsargs)
|
|
99
|
+
@title = FormattedString.new(**fsargs)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
# @param title [String]
|
|
104
|
-
# @return [
|
|
104
|
+
# @return [TypedTitleStringCollection]
|
|
105
105
|
def self.from_string(title, lang = nil, script = nil)
|
|
106
106
|
types = %w[title-intro title-main title-part]
|
|
107
107
|
ttls = split_title(title)
|
data/lib/relaton_bib/version.rb
CHANGED
|
@@ -177,16 +177,22 @@ module RelatonBib
|
|
|
177
177
|
def ttitle(title)
|
|
178
178
|
return unless title
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
end
|
|
183
|
-
content = variants.any? ? variants : title.text
|
|
180
|
+
content = variants(title)
|
|
181
|
+
content = title.text unless content.any?
|
|
184
182
|
TypedTitleString.new(
|
|
185
183
|
type: title[:type], content: content, language: title[:language],
|
|
186
184
|
script: title[:script], format: title[:format]
|
|
187
185
|
)
|
|
188
186
|
end
|
|
189
187
|
|
|
188
|
+
# @param title [Nokogiri::XML::Element]
|
|
189
|
+
# @return [Array<RelatonBib::LocalizedString>]
|
|
190
|
+
def variants(elm)
|
|
191
|
+
elm.xpath("variant").map do |v|
|
|
192
|
+
LocalizedString.new v.text, v[:language], v[:script]
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
190
196
|
def fetch_status(item)
|
|
191
197
|
status = item.at("./status")
|
|
192
198
|
return unless status
|
|
@@ -320,7 +326,7 @@ module RelatonBib
|
|
|
320
326
|
|
|
321
327
|
# @param item [Nokogiri::XML::Element]
|
|
322
328
|
# @return [Array<RelatonBib::CopyrightAssociation>]
|
|
323
|
-
def fetch_copyright(item)
|
|
329
|
+
def fetch_copyright(item) # rubocop:disable Metrics/AbcSize
|
|
324
330
|
item.xpath("./copyright").map do |cp|
|
|
325
331
|
owner = cp.xpath("owner").map do |o|
|
|
326
332
|
ContributionInfo.new entity: get_org(o.at("organization"))
|
|
@@ -370,7 +376,7 @@ module RelatonBib
|
|
|
370
376
|
# @param item_hash [Hash]
|
|
371
377
|
# @return [RelatonBib::BibliographicItem]
|
|
372
378
|
def bib_item(item_hash)
|
|
373
|
-
BibliographicItem.new item_hash
|
|
379
|
+
BibliographicItem.new **item_hash
|
|
374
380
|
end
|
|
375
381
|
|
|
376
382
|
# @param rel [Nokogiri::XML::Element]
|
|
@@ -447,7 +453,7 @@ module RelatonBib
|
|
|
447
453
|
|
|
448
454
|
# @param ext [Nokogiri::XML::Element]
|
|
449
455
|
# @return [RelatonBib::StructuredIdentifierCollection]
|
|
450
|
-
def fetch_structuredidentifier(ext) # rubocop:disable Metrics/AbcSize,
|
|
456
|
+
def fetch_structuredidentifier(ext) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
451
457
|
return unless ext
|
|
452
458
|
|
|
453
459
|
sids = ext.xpath("structuredidentifier").map do |si|
|
data/relaton-bib.gemspec
CHANGED
|
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
|
25
25
|
|
|
26
26
|
spec.add_development_dependency "byebug"
|
|
27
|
-
|
|
27
|
+
# ec.add_development_dependency "debase"
|
|
28
28
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
|
29
|
-
spec.add_development_dependency "rake", "~>
|
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
30
30
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
31
|
-
spec.add_development_dependency "ruby-debug-ide"
|
|
31
|
+
# spec.add_development_dependency "ruby-debug-ide"
|
|
32
32
|
spec.add_development_dependency "ruby-jing"
|
|
33
33
|
spec.add_development_dependency "simplecov"
|
|
34
34
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-03-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: debase
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: equivalent-xml
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,14 +44,14 @@ dependencies:
|
|
|
58
44
|
requirements:
|
|
59
45
|
- - "~>"
|
|
60
46
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
47
|
+
version: '13.0'
|
|
62
48
|
type: :development
|
|
63
49
|
prerelease: false
|
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
51
|
requirements:
|
|
66
52
|
- - "~>"
|
|
67
53
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
54
|
+
version: '13.0'
|
|
69
55
|
- !ruby/object:Gem::Dependency
|
|
70
56
|
name: rspec
|
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,20 +66,6 @@ dependencies:
|
|
|
80
66
|
- - "~>"
|
|
81
67
|
- !ruby/object:Gem::Version
|
|
82
68
|
version: '3.0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: ruby-debug-ide
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
69
|
- !ruby/object:Gem::Dependency
|
|
98
70
|
name: ruby-jing
|
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -185,9 +157,7 @@ executables: []
|
|
|
185
157
|
extensions: []
|
|
186
158
|
extra_rdoc_files: []
|
|
187
159
|
files:
|
|
188
|
-
- ".github/workflows/
|
|
189
|
-
- ".github/workflows/ubuntu.yml"
|
|
190
|
-
- ".github/workflows/windows.yml"
|
|
160
|
+
- ".github/workflows/rake.yml"
|
|
191
161
|
- ".gitignore"
|
|
192
162
|
- ".gitmodules"
|
|
193
163
|
- ".hound.yml"
|
|
@@ -263,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
263
233
|
- !ruby/object:Gem::Version
|
|
264
234
|
version: '0'
|
|
265
235
|
requirements: []
|
|
266
|
-
rubygems_version: 3.
|
|
236
|
+
rubygems_version: 3.2.3
|
|
267
237
|
signing_key:
|
|
268
238
|
specification_version: 4
|
|
269
239
|
summary: 'RelatonBib: Ruby XMLDOC impementation.'
|
data/.github/workflows/macos.yml
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: macos
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ '**' ]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test-macos:
|
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
|
14
|
-
runs-on: macos-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@master
|
|
21
|
-
- name: Checkout submodules
|
|
22
|
-
shell: bash
|
|
23
|
-
run: |
|
|
24
|
-
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
|
|
25
|
-
git submodule sync --recursive
|
|
26
|
-
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
|
|
27
|
-
- name: Use Ruby
|
|
28
|
-
uses: actions/setup-ruby@v1
|
|
29
|
-
with:
|
|
30
|
-
ruby-version: ${{ matrix.ruby }}
|
|
31
|
-
architecture: 'x64'
|
|
32
|
-
- name: Update gems
|
|
33
|
-
run: |
|
|
34
|
-
sudo gem install bundler --force
|
|
35
|
-
ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
|
|
36
|
-
ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
|
|
37
|
-
bundle install --jobs 4 --retry 3
|
|
38
|
-
- name: Run specs
|
|
39
|
-
run: |
|
|
40
|
-
bundle exec rake
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: ubuntu
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ '**' ]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test-linux:
|
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@master
|
|
21
|
-
- name: Checkout submodules
|
|
22
|
-
shell: bash
|
|
23
|
-
run: |
|
|
24
|
-
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
|
|
25
|
-
git submodule sync --recursive
|
|
26
|
-
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
|
|
27
|
-
- name: Use Ruby
|
|
28
|
-
uses: actions/setup-ruby@v1
|
|
29
|
-
with:
|
|
30
|
-
ruby-version: ${{ matrix.ruby }}
|
|
31
|
-
architecture: 'x64'
|
|
32
|
-
- name: Update gems
|
|
33
|
-
run: |
|
|
34
|
-
gem install bundler
|
|
35
|
-
bundle install --jobs 4 --retry 3
|
|
36
|
-
- name: Run specs
|
|
37
|
-
run: |
|
|
38
|
-
unset JAVA_TOOL_OPTIONS
|
|
39
|
-
bundle exec rake
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
-
# See https://github.com/metanorma/cimas
|
|
3
|
-
name: windows
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches: [ master ]
|
|
8
|
-
pull_request:
|
|
9
|
-
branches: [ '**' ]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
test-windows:
|
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
|
14
|
-
runs-on: windows-latest
|
|
15
|
-
strategy:
|
|
16
|
-
fail-fast: false
|
|
17
|
-
matrix:
|
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@master
|
|
21
|
-
- name: Checkout submodules
|
|
22
|
-
shell: bash
|
|
23
|
-
run: |
|
|
24
|
-
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
|
|
25
|
-
git submodule sync --recursive
|
|
26
|
-
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
|
|
27
|
-
- name: Use Ruby
|
|
28
|
-
uses: actions/setup-ruby@v1
|
|
29
|
-
with:
|
|
30
|
-
ruby-version: ${{ matrix.ruby }}
|
|
31
|
-
architecture: 'x64'
|
|
32
|
-
- name: Update gems
|
|
33
|
-
shell: pwsh
|
|
34
|
-
run: |
|
|
35
|
-
gem install bundler
|
|
36
|
-
bundle config --local path vendor/bundle
|
|
37
|
-
bundle update
|
|
38
|
-
bundle install --jobs 4 --retry 3
|
|
39
|
-
- name: Run specs
|
|
40
|
-
run: |
|
|
41
|
-
bundle exec rake
|