relaton-bipm 1.5.pre → 1.5.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/bipm.rng +188 -0
- data/grammars/isodoc.rng +7 -1
- data/lib/relaton_bipm.rb +2 -1
- data/lib/relaton_bipm/bipm_bibliographic_item.rb +34 -23
- data/lib/relaton_bipm/comment_periond.rb +1 -1
- data/lib/relaton_bipm/editorial_group.rb +56 -0
- data/lib/relaton_bipm/hash_converter.rb +20 -13
- data/lib/relaton_bipm/structured_identifier.rb +51 -0
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm/xml_parser.rb +25 -25
- data/relaton_bipm.gemspec +2 -1
- metadata +23 -7
- data/lib/relaton_bipm/project_team.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68cfd5dced834d94c0bdaf55fc7593e4b5174dbe8b08404489cb2060d73cd9ce
|
4
|
+
data.tar.gz: 2402fa8b93b5234bb9b25804803791c498233b6cdffc0ab9bce00462e901ef5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a18546b6f0e83bcd2b17806564d9652ddc629800f78c048dbf2e4c39926be30954833cfdb849bf2f4eda277f9eddc796c06e3614e29c32fa03914afc54f6122
|
7
|
+
data.tar.gz: 7b5f50e5a49fb041a74d3581fa22362bc3851515afb2c28e5a83a25d238f3a5ec33e0241313c4f143bcbea968b6146af143a9b2e14ba88c853c692ed7f5f0efc
|
data/grammars/bipm.rng
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<!--
|
4
|
+
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
|
5
|
+
we cannot have a new default namespace: we will end up with a grammar with two different
|
6
|
+
namespaces, one for isostandard and one for csand additions. And we do not want that.
|
7
|
+
-->
|
8
|
+
<include href="isodoc.rng">
|
9
|
+
<start>
|
10
|
+
<ref name="bipm-standard"/>
|
11
|
+
</start>
|
12
|
+
<define name="xref">
|
13
|
+
<element name="xref">
|
14
|
+
<attribute name="target">
|
15
|
+
<data type="string">
|
16
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
17
|
+
</data>
|
18
|
+
</attribute>
|
19
|
+
<optional>
|
20
|
+
<attribute name="type">
|
21
|
+
<ref name="ReferenceFormat"/>
|
22
|
+
</attribute>
|
23
|
+
</optional>
|
24
|
+
<optional>
|
25
|
+
<attribute name="alt"/>
|
26
|
+
</optional>
|
27
|
+
<optional>
|
28
|
+
<attribute name="case">
|
29
|
+
<choice>
|
30
|
+
<value>capital</value>
|
31
|
+
<value>lowercase</value>
|
32
|
+
</choice>
|
33
|
+
</attribute>
|
34
|
+
</optional>
|
35
|
+
<optional>
|
36
|
+
<attribute name="droploc">
|
37
|
+
<data type="boolean"/>
|
38
|
+
</attribute>
|
39
|
+
</optional>
|
40
|
+
<optional>
|
41
|
+
<attribute name="pagenumber">
|
42
|
+
<data type="boolean"/>
|
43
|
+
</attribute>
|
44
|
+
</optional>
|
45
|
+
<text/>
|
46
|
+
</element>
|
47
|
+
</define>
|
48
|
+
<define name="DocumentType">
|
49
|
+
<choice>
|
50
|
+
<value>brochure</value>
|
51
|
+
<value>mise-en-pratique</value>
|
52
|
+
<value>rapport</value>
|
53
|
+
<value>monographie</value>
|
54
|
+
<value>guide</value>
|
55
|
+
<value>meeting-report</value>
|
56
|
+
<value>technical-report</value>
|
57
|
+
<value>working-party-note</value>
|
58
|
+
<value>strategy</value>
|
59
|
+
<value>cipm-mra</value>
|
60
|
+
<value>resolution</value>
|
61
|
+
</choice>
|
62
|
+
</define>
|
63
|
+
<define name="editorialgroup">
|
64
|
+
<element name="editorialgroup">
|
65
|
+
<oneOrMore>
|
66
|
+
<ref name="committee"/>
|
67
|
+
</oneOrMore>
|
68
|
+
<oneOrMore>
|
69
|
+
<ref name="workgroup"/>
|
70
|
+
</oneOrMore>
|
71
|
+
</element>
|
72
|
+
</define>
|
73
|
+
<define name="structuredidentifier">
|
74
|
+
<element name="structuredidentifier">
|
75
|
+
<element name="docnumber">
|
76
|
+
<text/>
|
77
|
+
</element>
|
78
|
+
<optional>
|
79
|
+
<element name="part">
|
80
|
+
<text/>
|
81
|
+
</element>
|
82
|
+
</optional>
|
83
|
+
<optional>
|
84
|
+
<element name="appendix">
|
85
|
+
<text/>
|
86
|
+
</element>
|
87
|
+
</optional>
|
88
|
+
</element>
|
89
|
+
</define>
|
90
|
+
<define name="BibDataExtensionType">
|
91
|
+
<optional>
|
92
|
+
<ref name="doctype"/>
|
93
|
+
</optional>
|
94
|
+
<ref name="editorialgroup"/>
|
95
|
+
<optional>
|
96
|
+
<ref name="comment-period"/>
|
97
|
+
</optional>
|
98
|
+
<optional>
|
99
|
+
<ref name="si-aspect"/>
|
100
|
+
</optional>
|
101
|
+
<ref name="structuredidentifier"/>
|
102
|
+
</define>
|
103
|
+
</include>
|
104
|
+
<define name="comment-period">
|
105
|
+
<element name="comment-period">
|
106
|
+
<element name="from">
|
107
|
+
<ref name="ISO8601Date"/>
|
108
|
+
</element>
|
109
|
+
<element name="to">
|
110
|
+
<ref name="ISO8601Date"/>
|
111
|
+
</element>
|
112
|
+
</element>
|
113
|
+
</define>
|
114
|
+
<define name="si-aspect">
|
115
|
+
<element name="si-aspect">
|
116
|
+
<choice>
|
117
|
+
<value>A_e_deltanu</value>
|
118
|
+
<value>A_e</value>
|
119
|
+
<value>cd_Kcd_h_deltanu</value>
|
120
|
+
<value>cd_Kcd</value>
|
121
|
+
<value>full</value>
|
122
|
+
<value>K_k_deltanu</value>
|
123
|
+
<value>K_k</value>
|
124
|
+
<value>kg_h_c_deltanu</value>
|
125
|
+
<value>kg_h</value>
|
126
|
+
<value>m_c_deltanu</value>
|
127
|
+
<value>m_c</value>
|
128
|
+
<value>mol_NA</value>
|
129
|
+
<value>s_deltanu</value>
|
130
|
+
</choice>
|
131
|
+
</element>
|
132
|
+
</define>
|
133
|
+
<define name="committee">
|
134
|
+
<element name="committee">
|
135
|
+
<choice>
|
136
|
+
<value>CGPM</value>
|
137
|
+
<value>CIPM</value>
|
138
|
+
<value>BIPM</value>
|
139
|
+
<value>CCAUV</value>
|
140
|
+
<value>CCEM</value>
|
141
|
+
<value>CCL</value>
|
142
|
+
<value>CCM</value>
|
143
|
+
<value>CCPR</value>
|
144
|
+
<value>CCQM</value>
|
145
|
+
<value>CCRI</value>
|
146
|
+
<value>CCT</value>
|
147
|
+
<value>CCTF</value>
|
148
|
+
<value>CCU</value>
|
149
|
+
<value>CCL-CCTF</value>
|
150
|
+
<value>JCGM</value>
|
151
|
+
<value>JCRB</value>
|
152
|
+
<value>JCTLM</value>
|
153
|
+
<value>INetQI</value>
|
154
|
+
</choice>
|
155
|
+
</element>
|
156
|
+
</define>
|
157
|
+
<define name="workgroup">
|
158
|
+
<element name="workgroup">
|
159
|
+
<text/>
|
160
|
+
</element>
|
161
|
+
</define>
|
162
|
+
<define name="bipm-standard">
|
163
|
+
<element name="bipm-standard">
|
164
|
+
<attribute name="version"/>
|
165
|
+
<attribute name="type">
|
166
|
+
<choice>
|
167
|
+
<value>semantic</value>
|
168
|
+
<value>presentation</value>
|
169
|
+
</choice>
|
170
|
+
</attribute>
|
171
|
+
<ref name="bibdata"/>
|
172
|
+
<zeroOrMore>
|
173
|
+
<ref name="termdocsource"/>
|
174
|
+
</zeroOrMore>
|
175
|
+
<optional>
|
176
|
+
<ref name="boilerplate"/>
|
177
|
+
</optional>
|
178
|
+
<ref name="preface"/>
|
179
|
+
<oneOrMore>
|
180
|
+
<ref name="sections"/>
|
181
|
+
</oneOrMore>
|
182
|
+
<zeroOrMore>
|
183
|
+
<ref name="annex"/>
|
184
|
+
</zeroOrMore>
|
185
|
+
<ref name="bibliography"/>
|
186
|
+
</element>
|
187
|
+
</define>
|
188
|
+
</grammar>
|
data/grammars/isodoc.rng
CHANGED
@@ -42,7 +42,6 @@
|
|
42
42
|
</define>
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
|
-
<!-- attribute target { xsd:IDREF }, -->
|
46
45
|
<attribute name="target">
|
47
46
|
<data type="string">
|
48
47
|
<param name="pattern">\i\c*|\c+#\c+</param>
|
@@ -864,6 +863,13 @@
|
|
864
863
|
</define>
|
865
864
|
<define name="standard-document">
|
866
865
|
<element name="standard-document">
|
866
|
+
<attribute name="version"/>
|
867
|
+
<attribute name="type">
|
868
|
+
<choice>
|
869
|
+
<value>semantic</value>
|
870
|
+
<value>presentation</value>
|
871
|
+
</choice>
|
872
|
+
</attribute>
|
867
873
|
<ref name="bibdata"/>
|
868
874
|
<optional>
|
869
875
|
<ref name="boilerplate"/>
|
data/lib/relaton_bipm.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "relaton_bib"
|
2
2
|
require "relaton_bipm/version"
|
3
|
-
require "relaton_bipm/
|
3
|
+
require "relaton_bipm/editorial_group"
|
4
|
+
require "relaton_bipm/structured_identifier"
|
4
5
|
require "relaton_bipm/bibliographic_date"
|
5
6
|
require "relaton_bipm/document_relation"
|
6
7
|
require "relaton_bipm/comment_periond"
|
@@ -8,26 +8,35 @@ module RelatonBipm
|
|
8
8
|
|
9
9
|
STATUSES = %w[draft-proposal draft-development in-force retired].freeze
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
SI_ASPECTS = %w[
|
12
|
+
A_e_deltanu A_e cd_Kcd_h_deltanu cd_Kcd full K_k_deltanu K_k
|
13
|
+
kg_h_c_deltanu kg_h m_c_deltanu m_c mol_NA s_deltanu
|
14
|
+
].freeze
|
13
15
|
|
14
|
-
# @return [
|
15
|
-
attr_reader :
|
16
|
+
# @return [RelatonBipm::CommentPeriod, NilClass]
|
17
|
+
attr_reader :comment_period
|
18
|
+
|
19
|
+
# @return [String]
|
20
|
+
attr_reader :si_aspect
|
16
21
|
|
17
|
-
# @param project_group [Array<RelatonBipm::ProjectTeam>]
|
18
|
-
# @param title [Array<RelatonBib::FormattedString>]
|
19
|
-
# @param date [Array<RelatonBipm::BibliographicDate>]
|
20
22
|
# @param relation [Array<RelatonBipm::DocumentRelation>]
|
21
|
-
# @param
|
22
|
-
# @param
|
23
|
-
|
24
|
-
|
23
|
+
# @param editorialgroup [RelatonBipm::EditorialGroup]
|
24
|
+
# @param comment_period [RelatonBipm::CommentPeriod, NilClass]
|
25
|
+
# @param si_aspect [String]
|
26
|
+
# @param structuredidentifier [RelatonBipm::StructuredIdentifier]
|
27
|
+
def initialize(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
28
|
+
if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage)
|
25
29
|
warn "[relaton-bipm] Warning: invalid docstatus #{args[:docstatus]}. "\
|
26
30
|
"It should be one of: #{STATUSES}"
|
27
31
|
end
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
|
33
|
+
if args[:si_aspect] && !SI_ASPECTS.include?(args[:si_aspect])
|
34
|
+
warn "[relaton-bipm] Warning: invalid si_aspect #{args[:si_aspect]}. "\
|
35
|
+
"It should be one of: #{SI_ASPECTS}"
|
36
|
+
end
|
37
|
+
|
38
|
+
@comment_period = args.delete :comment_period
|
39
|
+
@si_aspect = args.delete :si_aspect
|
31
40
|
super
|
32
41
|
end
|
33
42
|
|
@@ -37,15 +46,16 @@ module RelatonBipm
|
|
37
46
|
# @option opts [String] :lang language
|
38
47
|
# @return [String] XML
|
39
48
|
def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
40
|
-
super ext: !
|
49
|
+
super ext: !comment_period.nil?, **opts do |b|
|
41
50
|
if opts[:bibdata] && (doctype || editorialgroup&.presence? ||
|
42
|
-
|
51
|
+
si_aspect || comment_period ||
|
52
|
+
structuredidentifier)
|
43
53
|
b.ext do
|
44
54
|
b.doctype doctype if doctype
|
45
55
|
editorialgroup&.to_xml b
|
46
|
-
|
47
|
-
|
48
|
-
|
56
|
+
comment_period&.to_xml b
|
57
|
+
b.send "si-aspect", si_aspect if si_aspect
|
58
|
+
structuredidentifier&.to_xml b
|
49
59
|
end
|
50
60
|
end
|
51
61
|
end
|
@@ -54,17 +64,18 @@ module RelatonBipm
|
|
54
64
|
# @return [Hash]
|
55
65
|
def to_hash
|
56
66
|
hash = super
|
57
|
-
hash["
|
58
|
-
hash["
|
67
|
+
hash["comment_period"] = comment_period.to_hash if comment_period
|
68
|
+
hash["si_aspect"] = si_aspect if si_aspect
|
59
69
|
hash
|
60
70
|
end
|
61
71
|
|
62
72
|
# @param prefix [String]
|
63
73
|
# @return [String]
|
64
74
|
def to_asciibib(prefix = "")
|
75
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
65
76
|
out = super
|
66
|
-
|
67
|
-
out +=
|
77
|
+
out += comment_period.to_asciibib prefix if comment_period
|
78
|
+
out += "#{pref}.si_aspect:: #{si_aspect}\n" if si_aspect
|
68
79
|
out
|
69
80
|
end
|
70
81
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module RelatonBipm
|
2
|
+
class EditorialGroup
|
3
|
+
include RelatonBib
|
4
|
+
|
5
|
+
COMMITTEES = %w[CGPM CIPM BIPM CCAUV CCEM CCL CCM CCPR CCQM CCRI CCT CCTF
|
6
|
+
CCU CCL-CCT JCGM JCRB JCTLM INetQI].freeze
|
7
|
+
|
8
|
+
# @return [Array<String>]
|
9
|
+
attr_reader :committee, :workgroup
|
10
|
+
|
11
|
+
# @param committee [Array<String>]
|
12
|
+
# @param workgroup [Array<String>]
|
13
|
+
def initialize(committee:, workgroup:)
|
14
|
+
committee.each do |c|
|
15
|
+
unless COMMITTEES.include? c
|
16
|
+
warn "[relaton-bipm] invalid committee: #{c}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
@committee = committee
|
21
|
+
@workgroup = workgroup
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param builder [Nokogiri::XML::Builder]
|
25
|
+
def to_xml(builder)
|
26
|
+
builder.editorialgroup do |b|
|
27
|
+
committee.each { |c| b.committee c }
|
28
|
+
workgroup.each { |c| b.workgroup c }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param prefix [String]
|
33
|
+
# @return [String]
|
34
|
+
def to_asciibib(prefix = "")
|
35
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
36
|
+
pref += "editorialgroup"
|
37
|
+
out = ""
|
38
|
+
committee.each { |c| out += "#{pref}.committee:: #{c}\n" }
|
39
|
+
workgroup.each { |w| out += "#{pref}.workgroup:: #{w}\n" }
|
40
|
+
out
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Hash]
|
44
|
+
def to_hash
|
45
|
+
{
|
46
|
+
"committee" => single_element_array(committee),
|
47
|
+
"workgroup" => single_element_array(workgroup),
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [true]
|
52
|
+
def presence?
|
53
|
+
true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -11,7 +11,7 @@ module RelatonBipm
|
|
11
11
|
ret = super
|
12
12
|
return if ret.nil?
|
13
13
|
|
14
|
-
project_group_hash_to_bib ret
|
14
|
+
# project_group_hash_to_bib ret
|
15
15
|
commentperiod_hash_to_bib ret
|
16
16
|
ret
|
17
17
|
end
|
@@ -37,23 +37,18 @@ module RelatonBipm
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
# @param ret [Hash]
|
41
|
-
def docstatus_hash_to_bib(ret)
|
42
|
-
ret[:docstatus] &&= DocumentStatus.new ret[:docstatus]
|
43
|
-
end
|
44
|
-
|
45
40
|
# @param ret [Hash]
|
46
41
|
def commentperiod_hash_to_bib(ret)
|
47
|
-
ret[:
|
42
|
+
ret[:comment_period] &&= CommentPeriond.new(ret[:comment_period])
|
48
43
|
end
|
49
44
|
|
50
45
|
# @param ret [Hash]
|
51
|
-
def project_group_hash_to_bib(ret)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
46
|
+
# def project_group_hash_to_bib(ret)
|
47
|
+
# ret[:project_group] &&= array(ret[:project_group]).map do |pg|
|
48
|
+
# wg = RelatonBib::FormattedString.new pg[:workgroup]
|
49
|
+
# ProjectTeam.new(committee: pg[:committee], workgroup: wg)
|
50
|
+
# end
|
51
|
+
# end
|
57
52
|
|
58
53
|
# @param ret [Hash]
|
59
54
|
def dates_hash_to_bib(ret)
|
@@ -70,6 +65,18 @@ module RelatonBipm
|
|
70
65
|
RelatonBipm::DocumentRelation.new r
|
71
66
|
end
|
72
67
|
end
|
68
|
+
|
69
|
+
# @param ret [Hash]
|
70
|
+
def editorialgroup_hash_to_bib(ret)
|
71
|
+
ret[:editorialgroup] &&= EditorialGroup.new ret[:editorialgroup]
|
72
|
+
end
|
73
|
+
|
74
|
+
# @param ret [Hash]
|
75
|
+
def structuredidentifier_hash_to_bib(ret)
|
76
|
+
ret[:structuredidentifier] &&= StructuredIdentifier.new(
|
77
|
+
**ret[:structuredidentifier]
|
78
|
+
)
|
79
|
+
end
|
73
80
|
end
|
74
81
|
end
|
75
82
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module RelatonBipm
|
2
|
+
class StructuredIdentifier
|
3
|
+
# @return [String]
|
4
|
+
attr_reader :docnumber
|
5
|
+
|
6
|
+
# @return [String, nil]
|
7
|
+
attr_reader :part, :appendix
|
8
|
+
|
9
|
+
# @param docnumber [String]
|
10
|
+
# @param part [String]
|
11
|
+
# @param appendix [String]
|
12
|
+
def initialize(docnumber:, part: nil, appendix: nil)
|
13
|
+
@docnumber = docnumber
|
14
|
+
@part = part
|
15
|
+
@appendix = appendix
|
16
|
+
end
|
17
|
+
|
18
|
+
# @param builder [Nokogiri::XML::Builder]
|
19
|
+
def to_xml(builder)
|
20
|
+
builder.structuredidentifier do |b|
|
21
|
+
b.docnumber docnumber
|
22
|
+
b.part part if part
|
23
|
+
b.appendix appendix if appendix
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# @return [Hash]
|
28
|
+
def to_hash
|
29
|
+
hash = { "docnumber" => docnumber }
|
30
|
+
hash["part"] = part if part
|
31
|
+
hash["appendix"] = appendix if appendix
|
32
|
+
hash
|
33
|
+
end
|
34
|
+
|
35
|
+
# @param prefix [String]
|
36
|
+
# @return [String]
|
37
|
+
def to_asciibib(prefix = "")
|
38
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
39
|
+
pref += "structuredidentifier"
|
40
|
+
out = "#{pref}.docnumber:: #{docnumber}\n"
|
41
|
+
out += "#{pref}.part:: #{part}\n" if part
|
42
|
+
out += "#{pref}.appendix:: #{appendix}\n" if appendix
|
43
|
+
out
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [true]
|
47
|
+
def presence?
|
48
|
+
true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/lib/relaton_bipm/version.rb
CHANGED
@@ -11,8 +11,8 @@ module RelatonBipm
|
|
11
11
|
ext = item.at "./ext"
|
12
12
|
return data unless ext
|
13
13
|
|
14
|
-
data[:
|
15
|
-
data[:
|
14
|
+
data[:comment_period] = fetch_commentperiond ext
|
15
|
+
data[:si_aspect] = ext.at("si-aspect")&.text
|
16
16
|
data
|
17
17
|
end
|
18
18
|
|
@@ -22,18 +22,6 @@ module RelatonBipm
|
|
22
22
|
BipmBibliographicItem.new item_hash
|
23
23
|
end
|
24
24
|
|
25
|
-
def fetch_project_group(ext)
|
26
|
-
ext.xpath("./project-group").map do |pg|
|
27
|
-
wg = pg.at "workgroup"
|
28
|
-
workgroup = RelatonBib::FormattedString.new(
|
29
|
-
content: wg.text, language: wg[:language], script: wg[:script],
|
30
|
-
format: wg[:format]
|
31
|
-
)
|
32
|
-
ProjectTeam.new(committee: pg.at("committee").text,
|
33
|
-
workgroup: workgroup)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
25
|
# @param item [Nokogiri::XML::Element]
|
38
26
|
# @return [Array<RelatonBib::FormattedString>]
|
39
27
|
def fetch_titles(item)
|
@@ -60,26 +48,38 @@ module RelatonBipm
|
|
60
48
|
|
61
49
|
# @param item [Nokogiri::XML::Element]
|
62
50
|
# @param klass [RelatonBipm::DocumentRelation.class]
|
63
|
-
# @return [Array<
|
51
|
+
# @return [Array<RelatonBipm::DocumentRelation>]
|
64
52
|
def fetch_relations(item, klass = DocumentRelation)
|
65
53
|
super
|
66
54
|
end
|
67
55
|
|
68
|
-
# @param
|
69
|
-
# @return [RelatonBipm::
|
70
|
-
def
|
71
|
-
|
72
|
-
return unless status
|
56
|
+
# @param ext [Nokogiri::XML::Element]
|
57
|
+
# @return [RelatonBipm::CommentPeriod, nil]
|
58
|
+
def fetch_commentperiond(ext)
|
59
|
+
return unless ext && (cp = ext.at "comment-period")
|
73
60
|
|
74
|
-
|
61
|
+
CommentPeriond.new from: cp.at("from")&.text, to: cp.at("to")&.text
|
75
62
|
end
|
76
63
|
|
77
64
|
# @param ext [Nokogiri::XML::Element]
|
78
|
-
# @return [
|
79
|
-
def
|
80
|
-
return unless ext && (
|
65
|
+
# @return [RelatonBipm::EditorialGroup, nil]
|
66
|
+
def fetch_editorialgroup(ext)
|
67
|
+
return unless ext && (eg = ext.at "editorialgroup")
|
81
68
|
|
82
|
-
|
69
|
+
cm = eg.xpath("committee").map &:text
|
70
|
+
wg = eg.xpath("workgroup").map &:text
|
71
|
+
EditorialGroup.new committee: cm, workgroup: wg
|
72
|
+
end
|
73
|
+
|
74
|
+
# @param ext [Nokogiri::XML::Element]
|
75
|
+
# @return [RelatonBipm::StructuredIdentifier]
|
76
|
+
def fetch_structuredidentifier(ext)
|
77
|
+
return unless ext && (sid = ext.at("structuredidentifier"))
|
78
|
+
|
79
|
+
StructuredIdentifier.new(
|
80
|
+
docnumber: sid.at("docnumber").text, part: sid.at("part")&.text,
|
81
|
+
appendix: sid.at("appendix")&.text
|
82
|
+
)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/relaton_bipm.gemspec
CHANGED
@@ -38,9 +38,10 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
38
38
|
spec.add_development_dependency "pry-byebug"
|
39
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
40
40
|
spec.add_development_dependency "ruby-debug-ide"
|
41
|
+
spec.add_development_dependency "ruby-jing"
|
41
42
|
spec.add_development_dependency "simplecov"
|
42
43
|
spec.add_development_dependency "vcr"
|
43
44
|
spec.add_development_dependency "webmock"
|
44
45
|
|
45
|
-
spec.add_dependency "relaton-bib", "~> 1.5.
|
46
|
+
spec.add_dependency "relaton-bib", "~> 1.5.0"
|
46
47
|
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.5.
|
4
|
+
version: 1.5.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: 2020-10-
|
11
|
+
date: 2020-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: ruby-jing
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +156,14 @@ dependencies:
|
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.5.
|
159
|
+
version: 1.5.0
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.5.
|
166
|
+
version: 1.5.0
|
153
167
|
description: 'RelatonBipm: retrieve BIPM Standards for bibliographic use using the
|
154
168
|
BibliographicItem model'
|
155
169
|
email:
|
@@ -173,6 +187,7 @@ files:
|
|
173
187
|
- bin/setup
|
174
188
|
- grammars/basicdoc.rng
|
175
189
|
- grammars/biblio.rng
|
190
|
+
- grammars/bipm.rng
|
176
191
|
- grammars/isodoc.rng
|
177
192
|
- grammars/reqt.rng
|
178
193
|
- lib/relaton_bipm.rb
|
@@ -182,9 +197,10 @@ files:
|
|
182
197
|
- lib/relaton_bipm/comment_periond.rb
|
183
198
|
- lib/relaton_bipm/document_relation.rb
|
184
199
|
- lib/relaton_bipm/document_status.rb
|
200
|
+
- lib/relaton_bipm/editorial_group.rb
|
185
201
|
- lib/relaton_bipm/hash_converter.rb
|
186
202
|
- lib/relaton_bipm/processor.rb
|
187
|
-
- lib/relaton_bipm/
|
203
|
+
- lib/relaton_bipm/structured_identifier.rb
|
188
204
|
- lib/relaton_bipm/version.rb
|
189
205
|
- lib/relaton_bipm/xml_parser.rb
|
190
206
|
- relaton_bipm.gemspec
|
@@ -205,9 +221,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
221
|
version: 2.4.0
|
206
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
223
|
requirements:
|
208
|
-
- - "
|
224
|
+
- - ">="
|
209
225
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
226
|
+
version: '0'
|
211
227
|
requirements: []
|
212
228
|
rubygems_version: 3.0.6
|
213
229
|
signing_key:
|
@@ -1,48 +0,0 @@
|
|
1
|
-
module RelatonBipm
|
2
|
-
class ProjectTeam
|
3
|
-
COMMITTEES = %w[cgpm cipm bipm ccauv ccem ccl ccm ccpr ccqm ccri cct cctf
|
4
|
-
ccu ccl-cctfwg jcgm jcrb jctlm inetqi].freeze
|
5
|
-
|
6
|
-
# @return [String]
|
7
|
-
attr_reader :committee
|
8
|
-
|
9
|
-
# @return [RelatonBib::FormattedString]
|
10
|
-
attr_reader :workgroup
|
11
|
-
|
12
|
-
# @param committee [String]
|
13
|
-
# @param workgroup [RelatonBib::FormattedString]
|
14
|
-
def initialize(committee:, workgroup:)
|
15
|
-
unless COMMITTEES.include? committee
|
16
|
-
warn "[relaton-bipm] Warning: invalid committee: #{committee}. "\
|
17
|
-
"It should be one of: #{COMMITTEES}"
|
18
|
-
end
|
19
|
-
@committee = committee
|
20
|
-
@workgroup = workgroup
|
21
|
-
end
|
22
|
-
|
23
|
-
# @param builder [Nokogiri::XML::Builder]
|
24
|
-
def to_xml(builder)
|
25
|
-
builder.send "project-group" do |b|
|
26
|
-
b.committee committee
|
27
|
-
b.workgroup { workgroup.to_xml b }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# @return [Hash]
|
32
|
-
def to_hash
|
33
|
-
{ "committee" => committee, "workgroup" => workgroup.to_hash }
|
34
|
-
end
|
35
|
-
|
36
|
-
# @param prefix [String]
|
37
|
-
# 2param count [Integer]
|
38
|
-
# @return [String]
|
39
|
-
def to_asciibib(prefix = "", count = 1)
|
40
|
-
pref = prefix.empty? ? prefix : prefix + "."
|
41
|
-
pref += "project_group"
|
42
|
-
out = count > 1 ? "#{pref}::\n" : ""
|
43
|
-
out += "#{pref}.committee:: #{committee}\n"
|
44
|
-
out += workgroup.to_asciibib prefix
|
45
|
-
out
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|