Skip to content

Commit

Permalink
Finish 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 29, 2021
2 parents ee980e1 + 5c5a078 commit 2ada0d9
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 76 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Expand Up @@ -15,18 +15,18 @@ jobs:
runs-on: ubuntu-latest
env:
CI: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }}
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
strategy:
fail-fast: false
matrix:
ruby:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- ruby-head # Until net-http-persistent updated
#- jruby # No Nokogumbo on JRuby
- 3.1
- ruby-head
- jruby
gemfile:
- Gemfile
- Gemfile-pure
Expand All @@ -40,5 +40,9 @@ jobs:
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rspec spec

run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1.1.2
if: ${{ matrix.ruby == '3.0' && matrix.gemfile == 'Gemfile' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

9 changes: 4 additions & 5 deletions Gemfile
Expand Up @@ -5,9 +5,8 @@ gemspec
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.10', platforms: [:mri, :jruby]
gem "nokogumbo", '~> 2.0', platforms: :mri
gem 'equivalent-xml', '~> 0.5'
gem "nokogiri", '~> 1.12', platforms: [:mri, :jruby]
gem 'equivalent-xml', '~> 0.6'

group :development, :test do
gem 'ebnf', github: "dryruby/ebnf", branch: "develop"
Expand All @@ -25,8 +24,8 @@ group :development, :test do
end

group :test do
gem 'simplecov', '~> 0.16', platforms: :mri
gem 'coveralls', '~> 0.8', platforms: :mri
gem 'simplecov', '~> 0.21', platforms: :mri
gem 'simplecov-lcov', '~> 0.8', platforms: :mri
end

group :debug do
Expand Down
22 changes: 10 additions & 12 deletions README.md
Expand Up @@ -16,15 +16,15 @@ 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-replaceable [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 a pure-HTML5 parser with better error detection.
* If available, uses [Nokogiri][] for parsing HTML/SVG, falls back to REXML otherwise.

Install with `gem install rdf-rdfa`

### Pure Ruby
In order to run as pure ruby (not requiring any C modules), this gem does not directly depend on [Nokogiri][] or [Nokogumbo][]
and falls back to using REXML. [Nokogumbo][] uses the [Gumbo pure-C HTML5 parser](https://github.com/google/gumbo-parser#readme).
In order to run as pure ruby (not requiring any C modules), this gem does not directly depend on [Nokogiri][]
and falls back to using REXML.
As REXML is not really an HTML parsing library, the results will only be useful if the HTML is well-formed.
For best performance, install the [Nokogiri][] and [Nokogumbo][] gems as well.
For best performance, install the [Nokogiri][] gem as well.

### Important changes from previous versions
RDFa is an evolving standard, undergoing some substantial recent changes partly due to perceived competition
Expand Down Expand Up @@ -191,7 +191,7 @@ generates the following turtle:
dc:description "A yellow rectangle with sharp corners." .

### Support for embedded N-Triples or Turtle
If the document includes a `<script>` element having an `@type` attribute whose value matches that of a loaded RDF reader (text/ntriples and text/turtle are loaded if they are availble), the data will be extracted and added to the default graph. For example:
If the document includes a `<script>` element having an `@type` attribute whose value matches that of a loaded RDF reader (text/ntriples and text/turtle are loaded if they are available), the data will be extracted and added to the default graph. For example:

<html>
<body>
Expand Down Expand Up @@ -397,12 +397,11 @@ The template hash defines four Haml templates:
}

## Dependencies
* [Ruby](https://ruby-lang.org/) (>= 2.4)
* [RDF.rb](https://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](https://rubygems.org/gems/nokogiri) (>= 1.10)
* Soft dependency on [Nokogumbo](https://github.com/rubys/nokogumbo) (>= 2.0)
* [Ruby](https://ruby-lang.org/) (>= 2.6)
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
* [Haml](https://rubygems.org/gems/haml) (~> 5.2)
* [HTMLEntities](https://rubygems.org/gems/htmlentities) (~> 4.3)
* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (~> 1.12)

## Documentation
Full documentation available on [Rubydoc.info][RDFa doc]
Expand Down Expand Up @@ -478,4 +477,3 @@ see <https://unlicense.org/> or the accompanying [UNLICENSE](UNLICENSE) file.
[Haml]: https://haml-lang.com/
[Turtle]: https://www.w3.org/TR/2011/WD-turtle-20110809/
[Nokogiri]: https://www.nokogiri.org
[Nokogumbo]: https://github.com/rubys/nokogumbo/#readme
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.1.3
3.2.0
14 changes: 1 addition & 13 deletions lib/rdf/rdfa/reader.rb
Expand Up @@ -329,19 +329,7 @@ def initialize(input = $stdin, **options, &block)

detect_host_language_version(input, **options)

parse_lib = if @library == :nokogiri && @host_language == :html5
begin
require 'nokogumbo' unless defined?(::Nokogumbo)
:nokobumbo
rescue LoadError
:nokogiri
end
else
@library
end

parse_lib = @library == :nokogiri && defined?(::Nokogumbo) ? :nokogumbo : @library
add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{parse_lib}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}")
add_info(@doc, "version = #{@version}, host_language = #{@host_language}, library = #{@library}, rdfagraph = #{@options[:rdfagraph].inspect}, expand = #{@options[:vocab_expansion]}")

begin
initialize_xml(input, **options)
Expand Down
5 changes: 1 addition & 4 deletions lib/rdf/rdfa/reader/nokogiri.rb
Expand Up @@ -176,10 +176,9 @@ def initialize_xml(input, **options)
::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding])
when :html5
begin
require 'nokogumbo' unless defined?(::Nokogumbo)
input = input.read if input.respond_to?(:read)
::Nokogiri::HTML5(input.force_encoding(options[:encoding]), max_parse_errors: 1000)
rescue LoadError
rescue LoadError, NoMethodError
::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding])
end
else
Expand Down Expand Up @@ -283,8 +282,6 @@ def root
##
# Document errors
def doc_errors
# FIXME: Nokogiri version 1.5 thinks many HTML5 elements are invalid, so just ignore all Tag errors.
# Nokogumbo might make this simpler
if @host_language == :html5
@doc.errors.reject do |e|
e.to_s =~ %r{(The doctype must be the first token in the document)|(Expected a doctype token)|(Unexpected '\?' where start tag name is expected)}
Expand Down
24 changes: 12 additions & 12 deletions rdf-rdfa.gemspec
Expand Up @@ -18,25 +18,25 @@ Gem::Specification.new do |gem|
gem.files = %w(AUTHORS README.md UNLICENSE VERSION) + Dir.glob('lib/**/*.rb')
gem.require_paths = %w(lib)

gem.required_ruby_version = '>= 2.4'
gem.required_ruby_version = '>= 2.6'
gem.requirements = []

gem.add_runtime_dependency 'rdf', '~> 3.1', '>= 3.1.13'
gem.add_runtime_dependency 'rdf-vocab', '~> 3.1', '>= 3.1.11'
gem.add_runtime_dependency 'rdf', '~> 3.2'
gem.add_runtime_dependency 'rdf-vocab', '~> 3.2'
gem.add_runtime_dependency 'haml', '~> 5.2'
gem.add_runtime_dependency 'rdf-xsd', '~> 3.1'
gem.add_runtime_dependency 'rdf-aggregate-repo', '~> 3.1'
gem.add_runtime_dependency 'rdf-xsd', '~> 3.2'
gem.add_runtime_dependency 'rdf-aggregate-repo', '~> 3.2'
gem.add_runtime_dependency 'htmlentities', '~> 4.3'

gem.add_development_dependency 'json-ld', '~> 3.1'
gem.add_development_dependency 'json-ld', '~> 3.2'
gem.add_development_dependency 'rspec', '~> 3.10'
gem.add_development_dependency 'rspec-its', '~> 1.3'
gem.add_development_dependency 'rdf-spec', '~> 3.1'
gem.add_development_dependency 'rdf-turtle', '~> 3.1'
gem.add_development_dependency 'rdf-isomorphic', '~> 3.1'
gem.add_development_dependency 'rdf-tabular', '~> 3.1'
gem.add_development_dependency 'rdf-rdfxml', '~> 3.1'
gem.add_development_dependency 'sparql', '~> 3.1'
gem.add_development_dependency 'rdf-spec', '~> 3.2'
gem.add_development_dependency 'rdf-turtle', '~> 3.2'
gem.add_development_dependency 'rdf-isomorphic', '~> 3.2'
gem.add_development_dependency 'rdf-tabular', '~> 3.2'
gem.add_development_dependency 'rdf-rdfxml', '~> 3.2'
gem.add_development_dependency 'sparql', '~> 3.2'
gem.add_development_dependency 'yard' , '~> 0.9'

gem.post_install_message = nil
Expand Down
10 changes: 8 additions & 2 deletions spec/spec_helper.rb
Expand Up @@ -17,10 +17,16 @@
end
begin
require 'simplecov'
require 'coveralls'
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |config|
#Coveralls is coverage by default/lcov. Send info results
config.report_with_single_file = true
config.single_report_path = 'coverage/lcov.info'
end

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
SimpleCov::Formatter::LcovFormatter
])
SimpleCov.start do
add_filter "/spec/"
Expand Down

0 comments on commit 2ada0d9

Please sign in to comment.