marc 0.1.6 → 0.1.7
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.
- data/Changes +99 -0
- data/LICENSE +21 -0
- data/README +50 -0
- data/Rakefile +46 -0
- data/lib/marc/datafield.rb +1 -1
- data/lib/marc/record.rb +4 -5
- metadata +20 -16
data/Changes
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
v0.1.7 Mon Nov 12 09:33:57 EST 2007
|
2
|
+
- updated Record.to_marc documentation to be a bit more precise
|
3
|
+
- removed doc references to MARC::Field which is no longer around
|
4
|
+
- changed from Artistic to MIT License
|
5
|
+
|
6
|
+
v0.1.6 Fri May 4 12:37:33 EDT 2007
|
7
|
+
- fixed bad record length test
|
8
|
+
- removed MARC::XMLWriter convert_to_utf8 which wasn't really working and
|
9
|
+
shouldn't be there if it isn't good
|
10
|
+
- added unescaping of entities to MARC::XMLReader
|
11
|
+
|
12
|
+
v0.1.5 Tue May 1 16:50:02 EDT 2007
|
13
|
+
- docfix in MARC::DataField (thanks Jason Ronallo)
|
14
|
+
- multiple docfixes (thanks Jonathan Rochkind)
|
15
|
+
|
16
|
+
v0.1.4 Tue Jan 2 15:45:53 EST 2007
|
17
|
+
- fixed bug in MARC::XMLWriter that was outputting all control field tags as 00z
|
18
|
+
(thanks Ross Singer)
|
19
|
+
- added :include_namespace option to MARC::XMLWriter::encode to include the
|
20
|
+
marcxml namespace, which allows MARC::Record::to_xml to emit the namespace
|
21
|
+
for a single record.
|
22
|
+
|
23
|
+
v0.1.3 Tue Jan 2 12:56:36 EST 2007
|
24
|
+
- added ability to map a MARC record to the Dublin Core fields. Calling
|
25
|
+
to_dublin_core on a MARC::Record returns a hash that has Dublin Core fields
|
26
|
+
as the hash keys.
|
27
|
+
|
28
|
+
v0.1.2 Thu Dec 21 18:46:01 EST 2007
|
29
|
+
- fixed MARC::Record::to_xml so that it actually is tested and works (thanks
|
30
|
+
Ross Singer)
|
31
|
+
|
32
|
+
v0.1.1
|
33
|
+
- added ability to pass File like objects to the constructor for
|
34
|
+
MARC::XMLReader like MARC::Reader (thanks Jake Glenn)
|
35
|
+
|
36
|
+
v0.1.0 Wed Dec 6 15:40:40 EST 2006
|
37
|
+
- fixed pretty xml when stylesheet is used
|
38
|
+
- added value() to MARC::DataField
|
39
|
+
- added Rakefile for testing/building
|
40
|
+
|
41
|
+
v0.0.9 Tue Mar 28 10:02:16 CST 2006
|
42
|
+
- changed XMLWriter.write to output pretty-printed XML
|
43
|
+
- normalized Text in XML output
|
44
|
+
- added XMLWriter checks and replacements for bad subfield codes and indicator
|
45
|
+
values
|
46
|
+
- added XMLWriter check and replacement for invalid control codes in xml data
|
47
|
+
values
|
48
|
+
- added XMLWriter checks for values in the leader that are invalid MARCXML
|
49
|
+
- added bin/marc2xml
|
50
|
+
- collapsed tc_xmlreader.rb tc_xmlwriter.rb into tc_xml.rb for full write/read
|
51
|
+
test.
|
52
|
+
- added :stylesheet argument to XLMWriter.new
|
53
|
+
|
54
|
+
v0.0.8 Mon Jan 16 22:31:00 EST 2006
|
55
|
+
- removed control tests out of tc_field.rb into tc_control.rb
|
56
|
+
- fixed some formatting
|
57
|
+
- changed control/field to controlfield/datafield
|
58
|
+
- added == check for controlfield
|
59
|
+
- removed namespace declarations on record elements in favor of default
|
60
|
+
namespace on collection element
|
61
|
+
- added spaces around subfield code and delimeter in to_s
|
62
|
+
- fixed up relevant tests that were expecting old formatting
|
63
|
+
- fixed xmlreader strip_ns which was rerturning Nil when no namespace
|
64
|
+
was found on an element (exposed by namespace changes).
|
65
|
+
|
66
|
+
v0.0.7 Mon Jan 2 21:39:28 CST 2006
|
67
|
+
- MARC::XMLWriter added
|
68
|
+
- removed encode/decode methods in MARC::MARC21 into MARC::Writer and
|
69
|
+
MARC::Reader respectively. This required pushing MARC21 specific constants
|
70
|
+
out into MARC::Constants which is required as necessary.
|
71
|
+
- moved encode from MARC::MARXML into MARC::XMLWriter and added constants
|
72
|
+
to MARC::Constants
|
73
|
+
- added MARC::XMLReader for reading MARX as XML
|
74
|
+
- added xml reading tests
|
75
|
+
- fixed indentation to be two spaces
|
76
|
+
|
77
|
+
v0.0.6 Tue Oct 18 09:33:12 CDT 2005
|
78
|
+
- MARC::MARC21::decode throws an exception when a directory can't be found.
|
79
|
+
Exception is caught and ignored in MARC::ForgivingReader
|
80
|
+
|
81
|
+
v0.0.5 Tue Oct 18 01:50:40 CDT 2005
|
82
|
+
- when unspecified field indicators are forced to blanks
|
83
|
+
- checking for when a field appears to not have indicators and subfields in
|
84
|
+
which case the field is skipped entirely
|
85
|
+
|
86
|
+
v0.0.4 Tue Oct 18 00:39:50 CDT 2005
|
87
|
+
- fixed off by one error when reading in leader, previous versions were
|
88
|
+
reading an extra character
|
89
|
+
|
90
|
+
v0.0.3 Mon Oct 17 22:51:23 CDT 2005
|
91
|
+
- added ForgivingReader class and support for reading records without using
|
92
|
+
possibly faulty offsets when the user needs them.
|
93
|
+
|
94
|
+
v0.0.2 Mon Oct 17 17:42:57 CDT 2005
|
95
|
+
- updated version string to see if it'll fix some gem oddness
|
96
|
+
|
97
|
+
v0.0.1 Mon Oct 10 10:29:20 CDT 2005
|
98
|
+
- initial release
|
99
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2007 Ed Summers, Kevin Clarke, Will Groppe
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
marc is a ruby library for reading and writing MAchine Readable Cataloging
|
2
|
+
(MARC). More information about MARC can be found at <http://www.loc.gov/marc>.
|
3
|
+
|
4
|
+
USAGE
|
5
|
+
|
6
|
+
require 'marc'
|
7
|
+
|
8
|
+
# reading records from a batch file
|
9
|
+
reader = MARC::Reader.new('marc.dat')
|
10
|
+
for record in reader
|
11
|
+
# print out field 245 subfield a
|
12
|
+
puts record['245']['a']
|
13
|
+
end
|
14
|
+
|
15
|
+
# creating a record
|
16
|
+
record = MARC::Record.new()
|
17
|
+
record.append(MARC::DataField.new('100', '0', ' ', ['a', 'John Doe']))
|
18
|
+
|
19
|
+
# writing a record
|
20
|
+
writer = MARC::Writer.new('marc.dat')
|
21
|
+
writer.write(record)
|
22
|
+
writer.close()
|
23
|
+
|
24
|
+
# writing a record as XML
|
25
|
+
writer = MARC::XMLWriter.new('marc.xml')
|
26
|
+
writer.write(record)
|
27
|
+
writer.close()
|
28
|
+
|
29
|
+
INSTALLATION
|
30
|
+
|
31
|
+
If you are looking at this file you may want to be able to install the code.
|
32
|
+
First you'll need to test:
|
33
|
+
|
34
|
+
rake test
|
35
|
+
|
36
|
+
then build the gem:
|
37
|
+
|
38
|
+
rake package
|
39
|
+
|
40
|
+
and install the versioned gem:
|
41
|
+
|
42
|
+
gem install pkg/marc-x.x.x.gem
|
43
|
+
|
44
|
+
AUTHORS
|
45
|
+
|
46
|
+
Kevin Clarke <ksclarke@gmail.com>
|
47
|
+
William Groppe <will.groppe@gmail.com>
|
48
|
+
Ed Summers <ehs@pobox.com>
|
49
|
+
|
50
|
+
Please send bugs, requests and comments to the authors.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
RUBY_MARC_VERSION = '0.1.7'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'rake/rdoctask'
|
7
|
+
require 'rake/packagetask'
|
8
|
+
require 'rake/gempackagetask'
|
9
|
+
|
10
|
+
task :default => [:test]
|
11
|
+
|
12
|
+
Rake::TestTask.new('test') do |t|
|
13
|
+
t.libs << 'lib'
|
14
|
+
t.pattern = 'test/tc_*.rb'
|
15
|
+
t.verbose = true
|
16
|
+
t.ruby_opts = ['-r marc', '-r test/unit']
|
17
|
+
end
|
18
|
+
|
19
|
+
spec = Gem::Specification.new do |s|
|
20
|
+
s.name = 'marc'
|
21
|
+
s.version = RUBY_MARC_VERSION
|
22
|
+
s.author = 'Ed Summers'
|
23
|
+
s.email = 'ehs@pobox.com'
|
24
|
+
s.homepage = 'http://www.textualize.com/ruby_marc'
|
25
|
+
s.platform = Gem::Platform::RUBY
|
26
|
+
s.summary = 'A ruby library for working with Machine Readable Cataloging'
|
27
|
+
s.files = Dir.glob("{lib,test}/**/*") + ["Rakefile", "README", "Changes",
|
28
|
+
"LICENSE"]
|
29
|
+
s.require_path = 'lib'
|
30
|
+
s.autorequire = 'marc'
|
31
|
+
s.has_rdoc = true
|
32
|
+
|
33
|
+
s.test_file = 'test/ts_marc.rb'
|
34
|
+
s.bindir = 'bin'
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
38
|
+
pkg.need_zip = true
|
39
|
+
pkg.need_tar = true
|
40
|
+
end
|
41
|
+
|
42
|
+
Rake::RDocTask.new('doc') do |rd|
|
43
|
+
rd.rdoc_files.include("lib/**/*.rb")
|
44
|
+
rd.main = 'MARC::Record'
|
45
|
+
rd.rdoc_dir = 'doc'
|
46
|
+
end
|
data/lib/marc/datafield.rb
CHANGED
@@ -60,7 +60,7 @@ module MARC
|
|
60
60
|
# must use MARC::ControlField for tags < 010
|
61
61
|
if @tag.to_i < 10
|
62
62
|
raise MARC::Exception.new(),
|
63
|
-
"MARC::
|
63
|
+
"MARC::DataField objects can't have tags < 010"
|
64
64
|
end
|
65
65
|
|
66
66
|
# allows MARC::Subfield objects to be passed directly
|
data/lib/marc/record.rb
CHANGED
@@ -35,7 +35,7 @@ module MARC
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# add a field to the record
|
38
|
-
# record.append(MARC::
|
38
|
+
# record.append(MARC::DataField.new( '100', '2', '0', ['a', 'Fred']))
|
39
39
|
|
40
40
|
def append(field)
|
41
41
|
@fields.push(field)
|
@@ -89,10 +89,9 @@ module MARC
|
|
89
89
|
end
|
90
90
|
|
91
91
|
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
92
|
+
# Returns a record in MARC21 transmission format (ANSI Z39.2).
|
93
|
+
# Really this is just a wrapper around MARC::MARC21::encode
|
94
|
+
#
|
96
95
|
# marc = record.to_marc()
|
97
96
|
|
98
97
|
def to_marc
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: marc
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.1.7
|
7
|
+
date: 2007-11-12 00:00:00 -05:00
|
8
8
|
summary: A ruby library for working with Machine Readable Cataloging
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,30 +30,34 @@ authors:
|
|
30
30
|
- Ed Summers
|
31
31
|
files:
|
32
32
|
- lib/marc
|
33
|
+
- lib/marc.rb
|
34
|
+
- lib/marc/constants.rb
|
33
35
|
- lib/marc/controlfield.rb
|
34
36
|
- lib/marc/datafield.rb
|
35
|
-
- lib/marc/
|
36
|
-
- lib/marc/xmlwriter.rb
|
37
|
+
- lib/marc/dublincore.rb
|
37
38
|
- lib/marc/exception.rb
|
38
|
-
- lib/marc/record.rb
|
39
39
|
- lib/marc/reader.rb
|
40
|
-
- lib/marc/
|
41
|
-
- lib/marc/
|
42
|
-
- lib/marc/constants.rb
|
40
|
+
- lib/marc/record.rb
|
41
|
+
- lib/marc/subfield.rb
|
43
42
|
- lib/marc/writer.rb
|
44
|
-
- lib/marc.rb
|
45
|
-
-
|
43
|
+
- lib/marc/xmlreader.rb
|
44
|
+
- lib/marc/xmlwriter.rb
|
45
|
+
- test/batch.dat
|
46
46
|
- test/batch.xml
|
47
|
-
- test/
|
47
|
+
- test/one.dat
|
48
48
|
- test/tc_controlfield.rb
|
49
|
-
- test/
|
49
|
+
- test/tc_datafield.rb
|
50
|
+
- test/tc_dublincore.rb
|
51
|
+
- test/tc_reader.rb
|
50
52
|
- test/tc_record.rb
|
51
|
-
- test/
|
52
|
-
- test/
|
53
|
+
- test/tc_subfield.rb
|
54
|
+
- test/tc_writer.rb
|
53
55
|
- test/tc_xml.rb
|
54
|
-
- test/tc_reader.rb
|
55
56
|
- test/ts_marc.rb
|
56
|
-
-
|
57
|
+
- Rakefile
|
58
|
+
- README
|
59
|
+
- Changes
|
60
|
+
- LICENSE
|
57
61
|
test_files:
|
58
62
|
- test/ts_marc.rb
|
59
63
|
rdoc_options: []
|