rdf-rdfa 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module RDF::RDFa::VERSION
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- TINY = 1
4
+ TINY = 2
5
5
  EXTRA = nil
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
data/lib/rdf/rdfa.rb CHANGED
@@ -26,8 +26,12 @@ module RDF
26
26
  require 'rdf/rdfa/format'
27
27
  require 'rdf/rdfa/vocab'
28
28
  require 'rdf/rdfa/patches/literal_hacks'
29
+ require 'rdf/rdfa/patches/nokogiri_hacks'
29
30
  require 'rdf/rdfa/patches/uri_hacks'
30
31
  autoload :Reader, 'rdf/rdfa/reader'
31
32
  autoload :VERSION, 'rdf/rdfa/version'
33
+
34
+ def self.debug?; @debug; end
35
+ def self.debug=(value); @debug = value; end
32
36
  end
33
37
  end
data/rdf-rdfa.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rdf-rdfa}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gregg Kellogg"]
12
- s.date = %q{2010-06-28}
12
+ s.date = %q{2010-09-01}
13
13
  s.description = %q{ RDF::RDFa is an RDFa reader for Ruby using the RDF.rb library suite.
14
14
  }
15
15
  s.email = %q{gregg@kellogg-assoc.com}
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/rdf/rdfa.rb",
36
36
  "lib/rdf/rdfa/format.rb",
37
37
  "lib/rdf/rdfa/patches/literal_hacks.rb",
38
+ "lib/rdf/rdfa/patches/nokogiri_hacks.rb",
38
39
  "lib/rdf/rdfa/patches/uri_hacks.rb",
39
40
  "lib/rdf/rdfa/reader.rb",
40
41
  "lib/rdf/rdfa/version.rb",
@@ -42,9 +43,11 @@ Gem::Specification.new do |s|
42
43
  "pkg/.gitignore",
43
44
  "rdf-rdfa.gemspec",
44
45
  "script/console",
46
+ "script/parse",
45
47
  "script/tc",
46
48
  "spec/html4-manifest.yml",
47
49
  "spec/html5-manifest.yml",
50
+ "spec/literal_spec.rb",
48
51
  "spec/matchers.rb",
49
52
  "spec/rdfa-triples/0001.nt",
50
53
  "spec/rdfa-triples/0006.nt",
@@ -162,15 +165,17 @@ Gem::Specification.new do |s|
162
165
  "spec/rdfa_reader_spec.rb",
163
166
  "spec/spec.opts",
164
167
  "spec/spec_helper.rb",
165
- "spec/xhtml-manifest.yml"
168
+ "spec/xhtml-manifest.yml",
169
+ "spec/xhtml11-manifest.yml"
166
170
  ]
167
171
  s.homepage = %q{http://github.com/gkellogg/rdf-rdfa}
168
172
  s.rdoc_options = ["--charset=UTF-8"]
169
173
  s.require_paths = ["lib"]
170
- s.rubygems_version = %q{1.3.6}
174
+ s.rubygems_version = %q{1.3.7}
171
175
  s.summary = %q{RDFa reader for RDF.rb.}
172
176
  s.test_files = [
173
- "spec/matchers.rb",
177
+ "spec/literal_spec.rb",
178
+ "spec/matchers.rb",
174
179
  "spec/rdfa_helper.rb",
175
180
  "spec/rdfa_reader_spec.rb",
176
181
  "spec/spec_helper.rb"
@@ -180,7 +185,7 @@ Gem::Specification.new do |s|
180
185
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
181
186
  s.specification_version = 3
182
187
 
183
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
188
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
184
189
  s.add_runtime_dependency(%q<rdf>, [">= 0.2.1"])
185
190
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.3"])
186
191
  s.add_development_dependency(%q<rspec>, [">= 0"])
data/script/console CHANGED
@@ -3,8 +3,8 @@
3
3
  irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
4
 
5
5
  libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/rdf/rdfa.rb'}"
6
+ RDF = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "rdf", "lib"))
7
+ libs << " -I #{RDF}" if File.directory?(RDF)
8
+ libs << " -r #{File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "rdf", "rdfa.rb")}"
9
9
  puts "Loading rdf-rdfa gem"
10
10
  exec "#{irb} #{libs} --simple-prompt"
data/script/parse ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby -s
2
+ require 'rubygems'
3
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
4
+ require 'rdf/rdfa'
5
+ require 'getoptlong'
6
+
7
+ def parse(input, base)
8
+ puts RDF::Writer.for($format.to_sym).buffer { |writer|
9
+ RDF::RDFa::Reader.new(input, :base_uri => base, :strict => true).each do |statement|
10
+ writer << statement
11
+ end
12
+ }
13
+ end
14
+
15
+ mode = ARGV.shift
16
+ raise "Mode must be one of 'parse'" unless mode == "parse"
17
+
18
+ $verbose = false
19
+ $format = :ntriples
20
+ base_uri = "http://example.com"
21
+ input = nil
22
+
23
+ opts = GetoptLong.new(
24
+ ["--debug", GetoptLong::NO_ARGUMENT],
25
+ ["--verbose", GetoptLong::NO_ARGUMENT],
26
+ ["--quiet", GetoptLong::NO_ARGUMENT],
27
+ ["--format", GetoptLong::REQUIRED_ARGUMENT],
28
+ ["--execute", "-e", GetoptLong::REQUIRED_ARGUMENT],
29
+ ["--uri", GetoptLong::REQUIRED_ARGUMENT]
30
+ )
31
+ opts.each do |opt, arg|
32
+ case opt
33
+ when '--verbose' then $verbose = true
34
+ when '--quiet' then $quiet = true
35
+ when '--debug' then ::RDF::RDFa::debug = true
36
+ when '--execute' then input = arg
37
+ when '--format' then $format = arg
38
+ when '--uri' then base_uri = arg
39
+ end
40
+ end
41
+
42
+ if ARGV.empty?
43
+ s = input ? input : $stdin.read
44
+ parse(StringIO.new(s), base_uri)
45
+ else
46
+ ARGV.each do |test_file|
47
+ parse(File.open(test_file), base_uri)
48
+ end
49
+ end
data/script/tc CHANGED
@@ -1,16 +1,18 @@
1
1
  #!/usr/bin/env ruby -s
2
2
  require 'rubygems'
3
- $:.unshift(File.join(File.dirname(__FILE__), "..", 'lib'))
3
+ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
4
4
  require 'rdf/rdfa'
5
5
  require 'spec/rdfa_helper'
6
6
  require 'getoptlong'
7
7
 
8
-
9
-
10
8
  def run_tc(tc)
11
9
  puts "run #{tc.name}"
10
+ puts tc.inspect if $verbose
12
11
  puts RDF::Writer.for($format.to_sym).buffer { |writer|
13
- RDF::RDFa::Reader.new(tc.input, :base_uri => tc.informationResourceInput, :strict => true).each do |statement|
12
+ RDF::RDFa::Reader.new(tc.input,
13
+ :base_uri => tc.informationResourceInput,
14
+ :strict => $strict,
15
+ :version => tc.version).each do |statement|
14
16
  writer << statement
15
17
  end
16
18
  }
@@ -18,21 +20,24 @@ end
18
20
 
19
21
  $verbose = false
20
22
  $format = :ntriples
23
+ $strict = false
21
24
  suite = "xhtml"
22
25
  opts = GetoptLong.new(
23
26
  ["--debug", GetoptLong::NO_ARGUMENT],
24
27
  ["--verbose", GetoptLong::NO_ARGUMENT],
25
28
  ["--quiet", GetoptLong::NO_ARGUMENT],
26
29
  ["--suite", GetoptLong::OPTIONAL_ARGUMENT],
30
+ ["--strict", GetoptLong::NO_ARGUMENT],
27
31
  ["--format", GetoptLong::REQUIRED_ARGUMENT]
28
32
  )
29
33
  opts.each do |opt, arg|
30
34
  case opt
31
35
  when '--verbose' then $verbose = true
32
36
  when '--quiet' then $quiet = true
33
- when '--debug' then $DEBUG = true
37
+ when '--debug' then ::RDF::RDFa::debug = true
34
38
  when '--format' then $format = arg
35
39
  when '--suite' then suite = arg
40
+ when '--strict' then $strict = true
36
41
  end
37
42
  end
38
43