iso-bib-item 0.2.0 → 0.2.1
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/Gemfile.lock +1 -1
- data/lib/iso_bib_item/from_xml.rb +13 -12
- data/lib/iso_bib_item/iso_bibliographic_item.rb +1 -1
- data/lib/iso_bib_item/iso_project_group.rb +2 -1
- data/lib/iso_bib_item/localized_string.rb +1 -0
- data/lib/iso_bib_item/organization.rb +1 -3
- data/lib/iso_bib_item/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '005497c6ee099cac8fce79fcbf9af9c67860ba38ac5873f1b580cc71cb3c4ef5'
|
4
|
+
data.tar.gz: 1041b3b192fb759e031ea28bccca0f035733c4b4074f6098d21d2834ce652b24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66a54aa8817aab27644a0f153ead6c69cfd84a422804aaa6ed5355ef5e41b0ff46b1664f43dd62302a5ce236174d966cab6a7f43030bbb5df5a373c64fe1e885
|
7
|
+
data.tar.gz: 9223a95713fc750f966de70aa33689f1e9721311c863bd4a9e4590cc5e16acedf48621d702fd851145ebff13d8556edea69b8e6572cc3867c5c73650c8031217
|
data/Gemfile.lock
CHANGED
@@ -42,8 +42,8 @@ module IsoBibItem
|
|
42
42
|
when 1
|
43
43
|
intro, main, part = nil, titl[0], nil
|
44
44
|
when 2
|
45
|
-
if /^(Part|Partie) \d+:/.match?
|
46
|
-
intro, main, part = nil, titl[0],
|
45
|
+
if /^(Part|Partie) \d+:/.match? titl[1]
|
46
|
+
intro, main, part = nil, titl[0], titl[1]
|
47
47
|
else
|
48
48
|
intro, main, part = titl[0], titl[1], nil
|
49
49
|
end
|
@@ -92,16 +92,17 @@ module IsoBibItem
|
|
92
92
|
# @TODO Organization doesn't recreated
|
93
93
|
def fetch_workgroup(doc)
|
94
94
|
eg = doc.at('/bibitem/editorialgroup')
|
95
|
-
tc = eg
|
96
|
-
sc = eg
|
97
|
-
scom =
|
98
|
-
wg = eg
|
99
|
-
wgrp =
|
95
|
+
tc = eg&.at('technical_committee')
|
96
|
+
sc = eg&.at('subcommittee')
|
97
|
+
scom = iso_subgroup(sc)
|
98
|
+
wg = eg&.at('workgroup')
|
99
|
+
wgrp = iso_subgroup(wg)
|
100
100
|
IsoProjectGroup.new(technical_committee: iso_subgroup(tc),
|
101
101
|
subcommittee: scom, workgroup: wgrp)
|
102
102
|
end
|
103
103
|
|
104
104
|
def iso_subgroup(com)
|
105
|
+
return nil if com.nil?
|
105
106
|
IsoSubgroup.new(name: com.text, type: com[:type],
|
106
107
|
number: com[:number].to_i)
|
107
108
|
end
|
@@ -114,11 +115,11 @@ module IsoBibItem
|
|
114
115
|
end
|
115
116
|
|
116
117
|
def fetch_copyright(doc)
|
117
|
-
cp = doc.at('/bibitem/copyright')
|
118
|
-
org = cp
|
119
|
-
name = org
|
120
|
-
abbr = org
|
121
|
-
url = org
|
118
|
+
cp = doc.at('/bibitem/copyright') || return
|
119
|
+
org = cp&.at('owner/organization')
|
120
|
+
name = org&.at('name').text
|
121
|
+
abbr = org&.at('abbreviation')&.text
|
122
|
+
url = org&.at('uri')&.text
|
122
123
|
entity = Organization.new(name: name, abbreviation: abbr, url: url)
|
123
124
|
from = cp.at('from').text
|
124
125
|
to = cp.at('to')&.text
|
@@ -270,7 +270,7 @@ module IsoBibItem
|
|
270
270
|
status.to_xml builder
|
271
271
|
copyright&.to_xml builder
|
272
272
|
relations.each { |r| r.to_xml builder }
|
273
|
-
workgroup
|
273
|
+
workgroup&.to_xml builder
|
274
274
|
if opts[:note]
|
275
275
|
builder.note("ISO DATE: #{opts[:note]}", format: 'text/plain')
|
276
276
|
end
|
@@ -37,8 +37,9 @@ module IsoBibItem
|
|
37
37
|
|
38
38
|
# @param builder [Nokogiri::XML::Builder]
|
39
39
|
def to_xml(builder)
|
40
|
+
return unless technical_committee || subcommittee || workgroup || secretariat
|
40
41
|
builder.editorialgroup do
|
41
|
-
builder.technical_committee { technical_committee.to_xml builder }
|
42
|
+
builder.technical_committee { technical_committee.to_xml builder } if technical_committee
|
42
43
|
builder.subcommittee { subcommittee.to_xml builder } if subcommittee
|
43
44
|
builder.workgroup { workgroup.to_xml builder } if workgroup
|
44
45
|
builder.secretariat secretariat if secretariat
|
@@ -30,6 +30,7 @@ module IsoBibItem
|
|
30
30
|
|
31
31
|
# @param builder [Nokogiri::XML::Builder]
|
32
32
|
def to_xml(builder)
|
33
|
+
return unless content
|
33
34
|
builder.parent['language'] = language.join(',') if language.any?
|
34
35
|
builder.parent['script'] = script.join(',') if script.any?
|
35
36
|
builder.text content
|
@@ -54,9 +54,7 @@ module IsoBibItem
|
|
54
54
|
def to_xml(builder)
|
55
55
|
builder.organization do
|
56
56
|
builder.name { |b| name.to_xml b }
|
57
|
-
|
58
|
-
builder.abbreviation { |a| abbreviation.to_xml a }
|
59
|
-
# end
|
57
|
+
builder.abbreviation { |a| abbreviation.to_xml a } if abbreviation&.to_s
|
60
58
|
builder.uri uri.to_s if uri
|
61
59
|
identifiers.each { |identifier| identifier.to_xml builder }
|
62
60
|
super
|
data/lib/iso_bib_item/version.rb
CHANGED