libis-tools 0.9.52 → 0.9.53

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d26ba26b0236fcafb2b5ab2b10421792f205b47d
4
- data.tar.gz: 333d870d81440b647f102e3694d93809d42e1ff6
3
+ metadata.gz: 667255e887aea8734fdf80072ee77be74e273d71
4
+ data.tar.gz: ca652b57931ae459cb239ad9f4f453f0615d588e
5
5
  SHA512:
6
- metadata.gz: eaf7b60225b008e68814c5422e4f042d0566f24bf0429967120d5910320b252a45d23c7209736fbe91a41f4d5b08eeff7b450f60cdd4837d6bf3818157a7c0b3
7
- data.tar.gz: c96520df9442e1d9e4aac52c466bdcaa49f55c6e0acc19024bba44d4995c45f84fd88bbdf3fb4a7fe0f7e4763b2a6c8fd701ab354c452ebfd2675957787a2ef4
6
+ metadata.gz: 43623c49d7afe2e8db4ee7a0413555053253141d01c62230df19d67901663116711eac7dc0870d2614b55ee9695f04887cb9b493aeaed746381fd90bc584452d
7
+ data.tar.gz: aeb56f8c2f27da55b40e5c288f2bcffdcf8a8d5699fa7c71ef031d4457fe8cce95f0de6ec0c4d17cf89c67451ecfc700157cb699a438671b5912beb1466b60fe
@@ -24,7 +24,7 @@ module Libis
24
24
  @node.xpath('.//controlfield').each { |f|
25
25
  tag = f['tag']
26
26
  tag = '%03d' % tag.to_i if tag.size < 3
27
- @all_records[tag] << FixField.new(tag, CGI::escapeHTML(f.content))
27
+ @all_records[tag] << FixField.new(tag, f.content)
28
28
  }
29
29
 
30
30
  @node.xpath('.//datafield').each { |v|
@@ -34,7 +34,7 @@ module Libis
34
34
 
35
35
  varfield = VarField.new(tag, v['ind1'].to_s, v['ind2'].to_s)
36
36
 
37
- v.xpath('.//subfield').each { |s| varfield.add_subfield(s['code'], CGI::escapeHTML(s.content)) }
37
+ v.xpath('.//subfield').each { |s| varfield.add_subfield(s['code'], s.content) }
38
38
 
39
39
  @all_records[tag] << varfield
40
40
 
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Tools
3
- VERSION = '0.9.52'
3
+ VERSION = '0.9.53'
4
4
  end
5
5
  end
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <record xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
3
+ xmlns="http://www.loc.gov/MARC21/slim" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
+ <leader>01068nam 2200241u 4500</leader>
5
+ <controlfield tag="005">20150701153710.0</controlfield>
6
+ <controlfield tag="008">000608m17221724xx |||| | 000|0 lat c</controlfield>
7
+ <controlfield tag="001">9901234567890471</controlfield>
8
+ <datafield tag="035" ind1=" " ind2=" ">
9
+ <subfield code="a">(BeLVLBS)123456789LBS01-Aleph</subfield>
10
+ </datafield>
11
+ <datafield tag="035" ind1=" " ind2=" ">
12
+ <subfield code="a">123456789</subfield>
13
+ </datafield>
14
+ <datafield tag="245" ind1="0" ind2="0">
15
+ <subfield code="a">Title with special chars: 'éÄçñåúðäíö&apos; / "ߥ²¤€®©œøæ’×½¼þ«»¶ǽµ¢ŒÆØŒ§Ð&quot; &lt; &amp; % $ # &gt;</subfield>
16
+ <subfield code="c">subtitle with special chars: "ߥ²¤€®©œøæ’×½¼þ«»¶ǽµ¢ŒÆØŒ§Ð&quot; &lt; &amp; % $ # &gt;</subfield>
17
+ </datafield>
18
+ </record>
@@ -134,5 +134,45 @@ STR
134
134
  end
135
135
  end
136
136
 
137
+ context '123456789' do
138
+ let(:xml) { Libis::Tools::XmlDocument.open(File.join(File.dirname(__FILE__), '123456789.marc')) }
139
+
140
+ it 'load from xml' do
141
+ puts record.marc_dump
142
+ expect(record.marc_dump).to eq <<-STR.align_left
143
+ LDR:'01068nam 2200241u 4500'
144
+ 005:'20150701153710.0'
145
+ 008:'000608m17221724xx |||| | 000|0 lat c'
146
+ 001:'9901234567890471'
147
+ 035: : :
148
+ \ta:["(BeLVLBS)123456789LBS01-Aleph"]
149
+ 035: : :
150
+ \ta:["123456789"]
151
+ 245:0:0:
152
+ \ta:["Title with special chars: 'éÄçñåúðäíö' / \\\"ߥ²¤€®©œøæ’×½¼þ«»¶ǽµ¢ŒÆØŒ§Ð\\\" < & % $ # >"]
153
+ \tc:["subtitle with special chars: \\\"ߥ²¤€®©œøæ’×½¼þ«»¶ǽµ¢ŒÆØŒ§Ð\\\" < & % $ # >"]
154
+ STR
155
+ end
156
+
157
+ it 'convert to dublin core' do
158
+ record.extend Libis::Tools::Metadata::Mappers::Kuleuven
159
+ xml_doc = Libis::Tools::XmlDocument.parse <<STR
160
+ <?xml version="1.0" encoding="utf-8"?>
161
+ <dc:record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/">
162
+ <dc:identifier>urn:ControlNumber:9901234567890471</dc:identifier>
163
+ <dc:identifier>(BeLVLBS)123456789LBS01-Aleph</dc:identifier>
164
+ <dc:identifier>123456789</dc:identifier>
165
+ <dc:title>Title with special chars: &apos;éÄçñåúðäíö&apos; / &quot;ߥ²¤€®©œøæ’×½¼þ«»¶ǽµ¢ŒÆØŒ§Ð&quot; &lt; &amp; % $ # &gt;</dc:title>
166
+ <dc:date>1722 - 1724</dc:date>
167
+ <dc:language>la</dc:language>
168
+ </dc:record>
169
+ STR
170
+ puts puts record.to_dc.to_xml
171
+ record.to_dc.root.elements.each_with_index do |element, i|
172
+ expect(element).to be_equivalent_to(xml_doc.root.elements[i])
173
+ end
174
+ end
175
+ end
176
+
137
177
  end
138
178
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.52
4
+ version: 0.9.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-16 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -340,6 +340,7 @@ files:
340
340
  - spec/data/test_config.yml
341
341
  - spec/deep_struct_spec.rb
342
342
  - spec/logger_spec.rb
343
+ - spec/metadata/123456789.marc
343
344
  - spec/metadata/8389207.marc
344
345
  - spec/metadata/BE_942855_1927_4898_corrected.XML
345
346
  - spec/metadata/BE_942855_1927_4898_md.XML
@@ -381,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
382
  version: '0'
382
383
  requirements: []
383
384
  rubyforge_project:
384
- rubygems_version: 2.6.12
385
+ rubygems_version: 2.5.1
385
386
  signing_key:
386
387
  specification_version: 4
387
388
  summary: LIBIS toolbox.
@@ -402,6 +403,7 @@ test_files:
402
403
  - spec/data/test_config.yml
403
404
  - spec/deep_struct_spec.rb
404
405
  - spec/logger_spec.rb
406
+ - spec/metadata/123456789.marc
405
407
  - spec/metadata/8389207.marc
406
408
  - spec/metadata/BE_942855_1927_4898_corrected.XML
407
409
  - spec/metadata/BE_942855_1927_4898_md.XML