isodoc 0.9.21 → 0.9.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/metadata.rb +13 -2
- data/lib/isodoc/version.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +13 -4
- 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: 95becf2d354c0a7eca13689fadbde7a7f210bbc24d9d62bd8539b1275b937fea
|
4
|
+
data.tar.gz: 83bfc4071f99c990cc78038ff267f2db8b8b8d960ffefa649b8dd46f315faaee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 529ea441de414d60b1d6c5316e57ba2dbc05693a231434929d0279fb8ae1f0a26d714f4c9f6453ee6f2ff3e6cca7549d54df0b893da80e951649d236b179e9fb
|
7
|
+
data.tar.gz: a547b7fad7468b36bab9e2684c9b564813a9c16d17a0a6a8cc690ef56b5657e7a4aca6f273ef7f2f486a22e48330d34c36d36f320ab0e536dee532d9d493e235
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
isodoc (0.9.
|
4
|
+
isodoc (0.9.22)
|
5
5
|
asciimath
|
6
6
|
html2doc (~> 0.8.6)
|
7
7
|
htmlentities (~> 4.3.4)
|
@@ -17,7 +17,7 @@ PATH
|
|
17
17
|
GEM
|
18
18
|
remote: https://rubygems.org/
|
19
19
|
specs:
|
20
|
-
asciidoctor (2.0.
|
20
|
+
asciidoctor (2.0.8)
|
21
21
|
asciimath (1.0.8)
|
22
22
|
ast (2.4.0)
|
23
23
|
byebug (9.1.0)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
mime-types-data (3.2019.0331)
|
69
69
|
mini_portile2 (2.4.0)
|
70
70
|
nenv (0.3.0)
|
71
|
-
nokogiri (1.10.
|
71
|
+
nokogiri (1.10.3)
|
72
72
|
mini_portile2 (~> 2.4.0)
|
73
73
|
notiffany (0.1.1)
|
74
74
|
nenv (~> 0.1)
|
@@ -92,7 +92,7 @@ GEM
|
|
92
92
|
rspec-mocks (~> 3.8.0)
|
93
93
|
rspec-core (3.8.0)
|
94
94
|
rspec-support (~> 3.8.0)
|
95
|
-
rspec-expectations (3.8.
|
95
|
+
rspec-expectations (3.8.3)
|
96
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
97
97
|
rspec-support (~> 3.8.0)
|
98
98
|
rspec-mocks (3.8.0)
|
data/lib/isodoc/convert.rb
CHANGED
data/lib/isodoc/metadata.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
class Metadata
|
3
3
|
DATETYPES = %w{published accessed created implemented obsoleted confirmed
|
4
|
-
updated issued received}.freeze
|
4
|
+
updated issued received transmitted copied unchanged circulated}.freeze
|
5
5
|
|
6
6
|
def ns(xpath)
|
7
7
|
Common::ns(xpath)
|
@@ -49,7 +49,7 @@ module IsoDoc
|
|
49
49
|
def extract_person_affiliations(authors)
|
50
50
|
authors.inject([]) do |m, a|
|
51
51
|
name = a&.at(ns("./affiliation/organization/name"))&.text
|
52
|
-
location = a&.at(ns("./affiliation/organization/
|
52
|
+
location = a&.at(ns("./affiliation/organization/address/"\
|
53
53
|
"formattedAddress"))&.text
|
54
54
|
m << ((!name.nil? && !location.nil?) ? "#{name}, #{location}" :
|
55
55
|
(name || location || ""))
|
@@ -206,6 +206,17 @@ module IsoDoc
|
|
206
206
|
end
|
207
207
|
|
208
208
|
def relations(isoxml, _out)
|
209
|
+
relations_obsoletes(isoxml)
|
210
|
+
relations_partof(isoxml)
|
211
|
+
end
|
212
|
+
|
213
|
+
def relations_partof(isoxml)
|
214
|
+
std = isoxml.at(ns("//bibdata/relation[@type = 'partOf']")) || return
|
215
|
+
id = std.at(ns(".//docidentifier"))
|
216
|
+
set(:partof, id.text) if id
|
217
|
+
end
|
218
|
+
|
219
|
+
def relations_obsoletes(isoxml)
|
209
220
|
std = isoxml.at(ns("//bibdata/relation[@type = 'obsoletes']")) || return
|
210
221
|
locality = std.at(ns(".//locality"))
|
211
222
|
id = std.at(ns(".//docidentifier"))
|
data/lib/isodoc/version.rb
CHANGED
@@ -24,6 +24,12 @@ RSpec.describe IsoDoc do
|
|
24
24
|
<date type="created"><from>2010</from><to>2011</to></date>
|
25
25
|
<date type="activated"><on>2013</on></date>
|
26
26
|
<date type="obsoleted"><on>2014</on></date>
|
27
|
+
<date type="circulated"><on>2015</on></date>
|
28
|
+
<date type="copied"><on>2016</on></date>
|
29
|
+
<date type="confirmed"><on>2017</on></date>
|
30
|
+
<date type="updated"><on>2018</on></date>
|
31
|
+
<date type="unchanged"><on>2019</on></date>
|
32
|
+
<date type="transmitted"><on>2020</on></date>
|
27
33
|
<edition>2</edition>
|
28
34
|
<version>
|
29
35
|
<revision-date>2016-05-01</revision-date>
|
@@ -50,9 +56,9 @@ RSpec.describe IsoDoc do
|
|
50
56
|
</name>
|
51
57
|
<affiliation>
|
52
58
|
<organization><name>Slate Inc.</name>
|
53
|
-
<
|
59
|
+
<address>
|
54
60
|
<formattedAddress>Bedrock</formattedAddress>
|
55
|
-
</address
|
61
|
+
</address>
|
56
62
|
</organization>
|
57
63
|
</affiliation>
|
58
64
|
</person>
|
@@ -85,7 +91,7 @@ RSpec.describe IsoDoc do
|
|
85
91
|
</bibdata>
|
86
92
|
</iso-standard>
|
87
93
|
INPUT
|
88
|
-
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :confirmeddate=>"
|
94
|
+
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>["Barney Rubble", "Fred Flintstone"], :authors_affiliations=>{"Slate Inc., Bedrock"=>["Barney Rubble"], ""=>["Fred Flintstone"]}, :circulateddate=>"2015", :confirmeddate=>"2017", :copieddate=>"2016", :createddate=>"2010–2011", :doc=>"URL E", :docnumber=>"17301-1", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :html=>"URL B", :ics=>"XXX", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :pdf=>"URL D", :publisheddate=>"2011", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :status=>"Committee draft", :tc=>"TC 34", :transmitteddate=>"2020", :unchangeddate=>"2019", :unpublished=>true, :updateddate=>"2018", :url=>"URL A", :wg=>"WG 3", :xml=>"URL C"}
|
89
95
|
OUTPUT
|
90
96
|
end
|
91
97
|
|
@@ -134,6 +140,9 @@ OUTPUT
|
|
134
140
|
<locality type="clause"><referenceFrom>3.1</referenceFrom></locality>
|
135
141
|
<docidentifier>IEC 8121</docidentifier>
|
136
142
|
</relation>
|
143
|
+
<relation type="partOf">
|
144
|
+
<docidentifier>IEC 8122</docidentifier>
|
145
|
+
</relation>
|
137
146
|
<editorialgroup>
|
138
147
|
<technical-committee number="34" type="ABC">Food products</technical-committee>
|
139
148
|
<subcommittee number="4" type="DEF">Cereals and pulses</subcommittee>
|
@@ -147,7 +156,7 @@ OUTPUT
|
|
147
156
|
</version>
|
148
157
|
</iso-standard>
|
149
158
|
INPUT
|
150
|
-
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :status=>"Published", :tc=>"ABC 34", :unpublished=>false, :updateddate=>"XXX", :wg=>"GHI 3"}
|
159
|
+
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :circulateddate=>"XXX", :confirmeddate=>"XXX", :copieddate=>"XXX", :createddate=>"XXX", :docnumber=>"17301-1-3", :doctitle=>"Cereals and pulses", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :partof=>"IEC 8122", :publisheddate=>"XXX", :receiveddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :status=>"Published", :tc=>"ABC 34", :transmitteddate=>"XXX", :unchangeddate=>"XXX", :unpublished=>false, :updateddate=>"XXX", :wg=>"GHI 3"}
|
151
160
|
OUTPUT
|
152
161
|
end
|
153
162
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|