relaton-bipm 1.16.6 → 1.17.0
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/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_bipm/bipm_bibliographic_item.rb +1 -5
- data/lib/relaton_bipm/data_outcomes_parser.rb +2 -2
- data/lib/relaton_bipm/document_type.rb +29 -0
- data/lib/relaton_bipm/hash_converter.rb +87 -82
- data/lib/relaton_bipm/rawdata_bipm_metrologia/article_parser.rb +3 -1
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm.rb +1 -0
- data/relaton_bipm.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4d6ca7c2babd9a223b0ed3493818df34cee58241d4589edb19c640d28d2d473d
|
|
4
|
+
data.tar.gz: 42a2f2b7c16a9e06be43c0ddcfea027220a9bbcd4d9fe7aeed67b1fc579135c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4375e47c892a72b1f9c7a246d303fc2deb3334b42ca505121133246bdd59584338e12d4c8a6afcd791787267cd1c4574a145f72ede538cffcf87dab20b1d8d1b
|
|
7
|
+
data.tar.gz: b384da3f7d91958f0c1c8c8f4ef41e1f74cd2faa2a4e631684c93fdf2d9af8dd180cde2213d4a7e7a37bd99fce66c6f5e4a06e7e2fb30b2b4d6e33af8bcaf1c2
|
data/grammars/basicdoc.rng
CHANGED
|
@@ -346,6 +346,8 @@
|
|
|
346
346
|
<ref name="keyword"/>
|
|
347
347
|
<ref name="xref"/>
|
|
348
348
|
<ref name="hyperlink"/>
|
|
349
|
+
<ref name="index"/>
|
|
350
|
+
<ref name="index-xref"/>
|
|
349
351
|
</choice>
|
|
350
352
|
</oneOrMore>
|
|
351
353
|
</element>
|
|
@@ -623,6 +625,8 @@
|
|
|
623
625
|
<ref name="eref"/>
|
|
624
626
|
<ref name="xref"/>
|
|
625
627
|
<ref name="hyperlink"/>
|
|
628
|
+
<ref name="index"/>
|
|
629
|
+
<ref name="index-xref"/>
|
|
626
630
|
</choice>
|
|
627
631
|
</zeroOrMore>
|
|
628
632
|
</element>
|
|
@@ -636,6 +640,8 @@
|
|
|
636
640
|
<ref name="eref"/>
|
|
637
641
|
<ref name="xref"/>
|
|
638
642
|
<ref name="hyperlink"/>
|
|
643
|
+
<ref name="index"/>
|
|
644
|
+
<ref name="index-xref"/>
|
|
639
645
|
</choice>
|
|
640
646
|
</zeroOrMore>
|
|
641
647
|
</element>
|
|
@@ -648,6 +654,8 @@
|
|
|
648
654
|
<ref name="eref"/>
|
|
649
655
|
<ref name="xref"/>
|
|
650
656
|
<ref name="hyperlink"/>
|
|
657
|
+
<ref name="index"/>
|
|
658
|
+
<ref name="index-xref"/>
|
|
651
659
|
</choice>
|
|
652
660
|
</zeroOrMore>
|
|
653
661
|
</element>
|
|
@@ -655,7 +663,11 @@
|
|
|
655
663
|
<define name="keyword">
|
|
656
664
|
<element name="keyword">
|
|
657
665
|
<zeroOrMore>
|
|
658
|
-
<
|
|
666
|
+
<choice>
|
|
667
|
+
<ref name="PureTextElement"/>
|
|
668
|
+
<ref name="index"/>
|
|
669
|
+
<ref name="index-xref"/>
|
|
670
|
+
</choice>
|
|
659
671
|
</zeroOrMore>
|
|
660
672
|
</element>
|
|
661
673
|
</define>
|
|
@@ -676,7 +688,11 @@
|
|
|
676
688
|
<define name="strike">
|
|
677
689
|
<element name="strike">
|
|
678
690
|
<zeroOrMore>
|
|
679
|
-
<
|
|
691
|
+
<choice>
|
|
692
|
+
<ref name="PureTextElement"/>
|
|
693
|
+
<ref name="index"/>
|
|
694
|
+
<ref name="index-xref"/>
|
|
695
|
+
</choice>
|
|
680
696
|
</zeroOrMore>
|
|
681
697
|
</element>
|
|
682
698
|
</define>
|
data/grammars/biblio.rng
CHANGED
|
@@ -2,10 +2,6 @@ module RelatonBipm
|
|
|
2
2
|
class BipmBibliographicItem < RelatonBib::BibliographicItem
|
|
3
3
|
include RelatonBib
|
|
4
4
|
|
|
5
|
-
DOCTYPES = %w[brochure mise-en-pratique rapport monographie guide
|
|
6
|
-
meeting-report technical-report working-party-note strategy
|
|
7
|
-
cipm-mra resolutions].freeze
|
|
8
|
-
|
|
9
5
|
STATUSES = %w[draft-proposal draft-development in-force retired].freeze
|
|
10
6
|
|
|
11
7
|
SI_ASPECTS = %w[
|
|
@@ -69,7 +65,7 @@ module RelatonBipm
|
|
|
69
65
|
si_aspect || comment_period ||
|
|
70
66
|
structuredidentifier)
|
|
71
67
|
ext = b.ext do
|
|
72
|
-
|
|
68
|
+
doctype&.to_xml b
|
|
73
69
|
editorialgroup&.to_xml b
|
|
74
70
|
comment_period&.to_xml b
|
|
75
71
|
b.send :"si-aspect", si_aspect if si_aspect
|
|
@@ -159,7 +159,7 @@ module RelatonBipm
|
|
|
159
159
|
args[:en]["resolutions"].each.with_index do |r, i| # rubocop:disable Metrics/BlockLength
|
|
160
160
|
hash = {
|
|
161
161
|
type: "proceedings", title: [],
|
|
162
|
-
doctype: r["type"], place: [RelatonBib::Place.new(city: "Paris")]
|
|
162
|
+
doctype: DocumentType.new(type: r["type"]), place: [RelatonBib::Place.new(city: "Paris")]
|
|
163
163
|
}
|
|
164
164
|
fr_r = args[:fr]["resolutions"].fetch(i, nil)
|
|
165
165
|
hash[:title] = resolution_title r, fr_r
|
|
@@ -385,7 +385,7 @@ module RelatonBipm
|
|
|
385
385
|
#
|
|
386
386
|
def meeting_bibitem(**args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
|
|
387
387
|
docnum = create_meeting_docnum args[:body], args[:type], args[:num], args[:en]["date"]
|
|
388
|
-
hash = { title: [], type: "proceedings", doctype: args[:type],
|
|
388
|
+
hash = { title: [], type: "proceedings", doctype: DocumentType.new(type: args[:type]),
|
|
389
389
|
place: [RelatonBib::Place.new(city: "Paris")] }
|
|
390
390
|
hash[:title] = create_titles args.slice(:en, :fr)
|
|
391
391
|
hash[:date] = [{ type: "published", on: args[:en]["date"] }]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module RelatonBipm
|
|
2
|
+
class DocumentType < RelatonBib::DocumentType
|
|
3
|
+
DOCTYPES = %w[brochure mise-en-pratique rapport monographie guide
|
|
4
|
+
meeting-report technical-report working-party-note strategy
|
|
5
|
+
cipm-mra resolutions].freeze
|
|
6
|
+
|
|
7
|
+
#
|
|
8
|
+
# Initialize a document type object.
|
|
9
|
+
#
|
|
10
|
+
# @param [String] type document type
|
|
11
|
+
# @param [String, nil] abbreviation abbreviation
|
|
12
|
+
#
|
|
13
|
+
def initialize(type:, abbreviation: nil)
|
|
14
|
+
check_type type
|
|
15
|
+
super
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#
|
|
19
|
+
# Check if document type is valid.
|
|
20
|
+
#
|
|
21
|
+
# @param [String] type document type
|
|
22
|
+
#
|
|
23
|
+
def check_type(type)
|
|
24
|
+
# unless DOCTYPES.include? type
|
|
25
|
+
# Util.warn "WARNING: invalid doctype: `#{type}`"
|
|
26
|
+
# end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -1,105 +1,110 @@
|
|
|
1
1
|
require "yaml"
|
|
2
2
|
|
|
3
3
|
module RelatonBipm
|
|
4
|
-
|
|
4
|
+
module HashConverter
|
|
5
|
+
include RelatonBib::HashConverter
|
|
6
|
+
extend self
|
|
7
|
+
|
|
5
8
|
@@acronyms = nil
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return if ret.nil?
|
|
15
|
-
|
|
16
|
-
# project_group_hash_to_bib ret
|
|
17
|
-
commentperiod_hash_to_bib ret
|
|
18
|
-
ret
|
|
19
|
-
end
|
|
10
|
+
# @override RelatonIsoBib::HashConverter.hash_to_bib
|
|
11
|
+
# @param args [Hash]
|
|
12
|
+
# @param nested [TrueClass, FalseClass]
|
|
13
|
+
# @return [Hash]
|
|
14
|
+
def hash_to_bib(args)
|
|
15
|
+
ret = super
|
|
16
|
+
return if ret.nil?
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
# project_group_hash_to_bib ret
|
|
19
|
+
commentperiod_hash_to_bib ret
|
|
20
|
+
ret
|
|
21
|
+
end
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
# @return [RelatonBib::BibliographicItem]
|
|
25
|
-
def bib_item(item_hash)
|
|
26
|
-
BipmBibliographicItem.new(**item_hash)
|
|
27
|
-
end
|
|
23
|
+
private
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
RelatonBib::TypedTitleString.new(**t)
|
|
35
|
-
else
|
|
36
|
-
RelatonBib::TypedTitleString.new(content: t)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
25
|
+
# @param item_hash [Hash]
|
|
26
|
+
# @return [RelatonBib::BibliographicItem]
|
|
27
|
+
def bib_item(item_hash)
|
|
28
|
+
BipmBibliographicItem.new(**item_hash)
|
|
29
|
+
end
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
# @param ret [Hash]
|
|
32
|
+
def title_hash_to_bib(ret)
|
|
33
|
+
ret[:title] &&= RelatonBib.array(ret[:title])
|
|
34
|
+
.reduce(RelatonBib::TypedTitleStringCollection.new) do |m, t|
|
|
35
|
+
m << if t.is_a? Hash
|
|
36
|
+
RelatonBib::TypedTitleString.new(**t)
|
|
37
|
+
else
|
|
38
|
+
RelatonBib::TypedTitleString.new(content: t)
|
|
39
|
+
end
|
|
44
40
|
end
|
|
41
|
+
end
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# ProjectTeam.new(committee: pg[:committee], workgroup: wg)
|
|
51
|
-
# end
|
|
52
|
-
# end
|
|
53
|
-
|
|
54
|
-
# @param ret [Hash]
|
|
55
|
-
def dates_hash_to_bib(ret)
|
|
56
|
-
super
|
|
57
|
-
ret[:date] &&= ret[:date].map { |d| BibliographicDate.new(**d) }
|
|
58
|
-
end
|
|
43
|
+
# @param ret [Hash]
|
|
44
|
+
def commentperiod_hash_to_bib(ret)
|
|
45
|
+
ret[:comment_period] &&= CommentPeriond.new(**ret[:comment_period])
|
|
46
|
+
end
|
|
59
47
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
# @param ret [Hash]
|
|
49
|
+
# def project_group_hash_to_bib(ret)
|
|
50
|
+
# ret[:project_group] &&= RelatonBib.array(ret[:project_group]).map do |pg|
|
|
51
|
+
# wg = RelatonBib::FormattedString.new pg[:workgroup]
|
|
52
|
+
# ProjectTeam.new(committee: pg[:committee], workgroup: wg)
|
|
53
|
+
# end
|
|
54
|
+
# end
|
|
67
55
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
end
|
|
80
|
-
wg = RelatonBib.array(ret[:editorialgroup][:workgroup]).map do |w|
|
|
81
|
-
w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
|
|
82
|
-
end
|
|
83
|
-
ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
|
|
56
|
+
# @param ret [Hash]
|
|
57
|
+
def dates_hash_to_bib(ret)
|
|
58
|
+
super
|
|
59
|
+
ret[:date] &&= ret[:date].map { |d| BibliographicDate.new(**d) }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# @param ret [Hash]
|
|
63
|
+
def relations_hash_to_bib(ret)
|
|
64
|
+
super
|
|
65
|
+
ret[:relation] &&= ret[:relation].map do |r|
|
|
66
|
+
RelatonBipm::DocumentRelation.new(**r)
|
|
84
67
|
end
|
|
68
|
+
end
|
|
85
69
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
# @param ret [Hash]
|
|
71
|
+
def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
72
|
+
return unless ret[:editorialgroup]
|
|
73
|
+
|
|
74
|
+
cmt = ret[:editorialgroup][:committee].map do |c|
|
|
75
|
+
if (vars = committee_variants c).any?
|
|
76
|
+
content = RelatonBib::LocalizedString.new vars
|
|
77
|
+
Committee.new acronym: c[:acronym], content: content
|
|
78
|
+
else
|
|
79
|
+
Committee.new(**c)
|
|
90
80
|
end
|
|
91
81
|
end
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@@acronyms ||= YAML.load_file File.join __dir__, "acronyms.yaml"
|
|
82
|
+
wg = RelatonBib.array(ret[:editorialgroup][:workgroup]).map do |w|
|
|
83
|
+
w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
|
|
95
84
|
end
|
|
85
|
+
ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
|
|
86
|
+
end
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
)
|
|
88
|
+
def committee_variants(cmt)
|
|
89
|
+
RelatonBib.array(cmt[:variants]).each_with_object([]) do |v, a|
|
|
90
|
+
c = v[:content] || (ac = acronyms[cmt[:acronym]]) && ac[v[:language]]
|
|
91
|
+
a << RelatonBib::LocalizedString.new(c, v[:language], v[:script]) if c
|
|
102
92
|
end
|
|
103
93
|
end
|
|
94
|
+
|
|
95
|
+
def acronyms
|
|
96
|
+
@@acronyms ||= YAML.load_file File.join __dir__, "acronyms.yaml"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @param ret [Hash]
|
|
100
|
+
def structuredidentifier_hash_to_bib(ret)
|
|
101
|
+
ret[:structuredidentifier] &&= StructuredIdentifier.new(
|
|
102
|
+
**ret[:structuredidentifier],
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def create_doctype(**args)
|
|
107
|
+
DocumentType.new(**args)
|
|
108
|
+
end
|
|
104
109
|
end
|
|
105
110
|
end
|
data/lib/relaton_bipm/version.rb
CHANGED
data/lib/relaton_bipm.rb
CHANGED
|
@@ -7,6 +7,7 @@ require "relaton_bipm/config"
|
|
|
7
7
|
require "relaton_bipm/util"
|
|
8
8
|
require "relaton_bipm/id_parser"
|
|
9
9
|
require "relaton_bipm/version"
|
|
10
|
+
require "relaton_bipm/document_type"
|
|
10
11
|
require "relaton_bipm/editorial_group"
|
|
11
12
|
require "relaton_bipm/committee"
|
|
12
13
|
require "relaton_bipm/workgroup"
|
data/relaton_bipm.gemspec
CHANGED
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
|
35
35
|
spec.add_dependency "faraday", "~> 2.7.0"
|
|
36
36
|
spec.add_dependency "mechanize", "~> 2.8.0"
|
|
37
37
|
spec.add_dependency "parslet", "~> 2.0.0"
|
|
38
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
|
38
|
+
spec.add_dependency "relaton-bib", "~> 1.17.0"
|
|
39
39
|
spec.add_dependency "relaton-index", "~> 0.2.2"
|
|
40
40
|
spec.add_dependency "rubyzip", "~> 2.3.0"
|
|
41
41
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bipm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.17.0
|
|
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-
|
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -58,14 +58,14 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 1.
|
|
61
|
+
version: 1.17.0
|
|
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.17.0
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: relaton-index
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -131,6 +131,7 @@ files:
|
|
|
131
131
|
- lib/relaton_bipm/data_fetcher.rb
|
|
132
132
|
- lib/relaton_bipm/data_outcomes_parser.rb
|
|
133
133
|
- lib/relaton_bipm/document_relation.rb
|
|
134
|
+
- lib/relaton_bipm/document_type.rb
|
|
134
135
|
- lib/relaton_bipm/editorial_group.rb
|
|
135
136
|
- lib/relaton_bipm/hash_converter.rb
|
|
136
137
|
- lib/relaton_bipm/id_parser.rb
|