Skip to content

Commit

Permalink
Finish 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 16, 2019
2 parents b90471b + 8b6dab1 commit 70a3b43
Show file tree
Hide file tree
Showing 23 changed files with 265 additions and 194 deletions.
12 changes: 4 additions & 8 deletions .travis.yml
@@ -1,23 +1,19 @@
language: ruby
bundler_args: --without debug
script: "bundle exec rspec spec"
before_install: "gem update --system"
env:
- CI=true
gemfile:
- Gemfile
- Gemfile-pure
rvm:
- 2.2
- 2.3
- 2.4
- 2.5
- jruby-9
- rbx-3
- 2.6
- 2.7
- jruby
cache: bundler
sudo: false
matrix:
allow_failures:
- rvm: jruby-9
- rvm: rbx-3
- rvm: jruby
dist: trusty
14 changes: 3 additions & 11 deletions Gemfile
Expand Up @@ -6,7 +6,7 @@ gem "rdf", github: "ruby-rdf/rdf", branch: "develop"
gem "rdf-spec", github: "ruby-rdf/rdf-spec", branch: "develop"
gem "rdf-xsd", github: "ruby-rdf/rdf-xsd", branch: "develop"
gem "nokogiri", '~> 1.8'
gem "nokogumbo", '~> 1.5'
gem "nokogumbo", '~> 2.0'
gem 'equivalent-xml', '~> 0.5'

group :development, :test do
Expand All @@ -25,26 +25,18 @@ group :development, :test do
end

group :test do
gem 'simplecov', require: false
gem 'coveralls', require: false
gem 'simplecov', platforms: :mri
gem 'coveralls', '~> 0.8', platforms: :mri
gem 'psych', platforms: [:mri, :rbx]
end

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :debug do
gem "syntax"
gem "byebug", platforms: :mri
gem "ruby-debug", platforms: :jruby
gem "rake"
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'rubinius', '~> 2.0'
end

platforms :jruby do
gem 'gson', '~> 0.6'
end
15 changes: 3 additions & 12 deletions Gemfile-pure
Expand Up @@ -20,6 +20,9 @@ group :development, :test do
gem 'sparql', github: "ruby-rdf/sparql", branch: "develop"
gem 'sparql-client', github: "ruby-rdf/sparql-client", branch: "develop"
gem 'sxp', github: "dryruby/sxp.rb", branch: "develop"

# Until version >= 3.4.2 with support for Ruby 2.6
gem "webmock", git: "https://github.com/bblimke/webmock"
end

group :test do
Expand All @@ -28,20 +31,8 @@ group :test do
gem 'psych', platforms: [:mri, :rbx]
end

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :debug do
gem "syntax"
gem "byebug", platforms: :mri
gem "ruby-debug", platforms: :jruby
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'rubinius', '~> 2.0'
end

platforms :jruby do
gem 'gson', '~> 0.6'
end
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -16,7 +16,7 @@ RDF::RDFa parses [RDFa][RDFa 1.1 Core] into statements or triples.
* Fully compliant RDFa 1.1 parser.
* Template-based Writer to generate XHTML+RDFa.
* Writer uses user-replacable [Haml][Haml]-based templates to generate RDFa.
* If available, uses [Nokogiri][] for parsing HTML/SVG, falls back to REXML otherwise. For HTML5, include the [Nokogumbo][] gem for are pure-HTML5 parser with better error detection.
* If available, uses [Nokogiri][] for parsing HTML/SVG, falls back to REXML otherwise. For HTML5, include the [Nokogumbo][] gem for a pure-HTML5 parser with better error detection.

Install with `gem install rdf-rdfa`

Expand Down Expand Up @@ -397,12 +397,12 @@ The template hash defines four Haml templates:
}

## Dependencies
* [Ruby](http://ruby-lang.org/) (>= 2.2)
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0)
* [Haml](https://rubygems.org/gems/haml) (~> 5.0)
* [HTMLEntities](https://rubygems.org/gems/htmlentities) (>= 4.3.1)
* Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.7.1)
* Soft dependency on [Nokogumbo](https://github.com/rubys/nokogumbo) (>= 1.4.10)
* [Ruby](http://ruby-lang.org/) (>= 2.4)
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1)
* [Haml](https://rubygems.org/gems/haml) (~> 5.1)
* [HTMLEntities](https://rubygems.org/gems/htmlentities) (>= 4.3)
* Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.10)
* Soft dependency on [Nokogumbo](https://github.com/rubys/nokogumbo) (>= 2.0)

## Documentation
Full documentation available on [Rubydoc.info][RDFa doc]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.0.1
3.1.0
4 changes: 2 additions & 2 deletions lib/rdf/rdfa/context.rb
Expand Up @@ -40,7 +40,7 @@ class Context
# @yieldparam [RDF::RDFa::Context] context
# @yieldreturn [void] ignored
# @return [RDF::RDFa::Context]
def initialize(uri, options = {}, &block)
def initialize(uri, **options, &block)
@uri = RDF::URI.intern(uri)
@prefixes = options.fetch(:prefixes, {})
@terms = options.fetch(:terms, {})
Expand Down Expand Up @@ -97,7 +97,7 @@ def self.find(uri)
cache[uri] = new(uri) do |context|
log_debug("process_context: retrieve context <#{uri}>") if respond_to?(:log_debug)
Context.load(uri)
context.parse(repository.query(graph_name: uri))
context.parse(repository.query({graph_name: uri}))
end
rescue Exception => e
if respond_to?(:log_fatal)
Expand Down
4 changes: 2 additions & 2 deletions lib/rdf/rdfa/context/html.rb
Expand Up @@ -4,8 +4,8 @@
class RDF::RDFa::Context
def self.find_with_html_rdfa_1_1(uri)
if uri.to_s == "http://www.w3.org/2011/rdfa-context/html-rdfa-1.1"
@_html_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/html-rdfa-1.1"), {
})
@_html_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/html-rdfa-1.1"),
)
else
find_without_html_rdfa_1_1(uri)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/rdf/rdfa/context/xhtml.rb
Expand Up @@ -4,7 +4,7 @@
class RDF::RDFa::Context
def self.find_with_xhtml_rdfa_1_1(uri)
if uri.to_s == "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"
@_xhtml_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"), {
@_xhtml_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"),
terms: {
alternate: "http://www.w3.org/1999/xhtml/vocab#alternate",
appendix: "http://www.w3.org/1999/xhtml/vocab#appendix",
Expand Down Expand Up @@ -32,7 +32,7 @@ def self.find_with_xhtml_rdfa_1_1(uri)
top: "http://www.w3.org/1999/xhtml/vocab#top",
up: "http://www.w3.org/1999/xhtml/vocab#up",
},
})
)
else
find_without_xhtml_rdfa_1_1(uri)
end
Expand Down
13 changes: 11 additions & 2 deletions lib/rdf/rdfa/context/xml.rb
Expand Up @@ -4,20 +4,26 @@
class RDF::RDFa::Context
def self.find_with_rdfa_1_1(uri)
if uri.to_s == "http://www.w3.org/2011/rdfa-context/rdfa-1.1"
@_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/rdfa-1.1"), {
@_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/rdfa-1.1"),
prefixes: {
as: "https://www.w3.org/ns/activitystreams#",
cc: "http://creativecommons.org/ns#",
csvw: "http://www.w3.org/ns/csvw#",
ctag: "http://commontag.org/ns#",
dc: "http://purl.org/dc/terms/",
dc11: "http://purl.org/dc/elements/1.1/",
dcat: "http://www.w3.org/ns/dcat#",
dcterms: "http://purl.org/dc/terms/",
dqv: "http://www.w3.org/ns/dqv#",
duv: "https://www.w3.org/ns/duv#",
foaf: "http://xmlns.com/foaf/0.1/",
gr: "http://purl.org/goodrelations/v1#",
grddl: "http://www.w3.org/2003/g/data-view#",
ical: "http://www.w3.org/2002/12/cal/icaltzd#",
ldp: "http://www.w3.org/ns/ldp#",
ma: "http://www.w3.org/ns/ma-ont#",
oa: "http://www.w3.org/ns/oa#",
odrl: "http://www.w3.org/ns/odrl/2/",
og: "http://ogp.me/ns#",
org: "http://www.w3.org/ns/org#",
owl: "http://www.w3.org/2002/07/owl#",
Expand All @@ -34,6 +40,9 @@ def self.find_with_rdfa_1_1(uri)
sioc: "http://rdfs.org/sioc/ns#",
skos: "http://www.w3.org/2004/02/skos/core#",
skosxl: "http://www.w3.org/2008/05/skos-xl#",
sosa: "http://www.w3.org/ns/sosa/",
ssn: "http://www.w3.org/ns/ssn/",
time: "http://www.w3.org/2006/time#",
v: "http://rdf.data-vocabulary.org/#",
vcard: "http://www.w3.org/2006/vcard/ns#",
void: "http://rdfs.org/ns/void#",
Expand All @@ -48,7 +57,7 @@ def self.find_with_rdfa_1_1(uri)
license: "http://www.w3.org/1999/xhtml/vocab#license",
role: "http://www.w3.org/1999/xhtml/vocab#role",
},
})
)
else
find_without_rdfa_1_1(uri)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rdf/rdfa/expansion.rb
Expand Up @@ -17,7 +17,7 @@ def expand(repository)
add_debug("expand") {"Repository has #{repository.count} statements"}

# Load missing vocabularies
vocabs = repository.query(predicate: RDF::RDFA.usesVocabulary).to_a.map(&:object)
vocabs = repository.query({predicate: RDF::RDFA.usesVocabulary}).to_a.map(&:object)
vocabs.map! do |vocab|
begin
# Create the name with a predictable name so that it is enumerated and can be found
Expand Down

0 comments on commit 70a3b43

Please sign in to comment.