Skip to content

Commit

Permalink
Finish 3.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Oct 26, 2021
2 parents a06cc04 + ece9b78 commit 8f7207c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 39 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -15,17 +15,17 @@ jobs:
runs-on: ubuntu-latest
env:
CI: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }}
strategy:
fail-fast: false
matrix:
ruby:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- ruby-head
#- jruby # No Nokogumbo on JRuby
- jruby
steps:
- name: Clone repository
uses: actions/checkout@v2
Expand All @@ -34,7 +34,11 @@ jobs:
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
run: ruby --version; 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'"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

7 changes: 3 additions & 4 deletions Gemfile
Expand Up @@ -5,10 +5,9 @@ gemspec
gem "rdf", git: "https://github.com/ruby-rdf/rdf", branch: "develop"
gem "rdf-rdfa", git: "https://github.com/ruby-rdf/rdf-rdfa", branch: "develop"
gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
gem "nokogumbo", '~> 2.0'

group :development do
gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop"
gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop"
gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"
gem 'rdf-aggregate-repo', git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop"
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
Expand All @@ -23,6 +22,6 @@ group :debug 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
3 changes: 0 additions & 3 deletions README.md
Expand Up @@ -15,7 +15,6 @@ RDF::Microdata parses [Microdata][] into statements or triples using the rules d

* Microdata parser.
* Uses Nokogiri for parsing HTML
* If available, uses [Nokogumbo][] gem for are pure-HTML5 parser with better error detection.

Install with 'gem install rdf-microdata'

Expand Down Expand Up @@ -52,7 +51,6 @@ If the `RDFa` parser is available, {RDF::Microdata::Format} will not assert cont
* [RDF::XSD](https://rubygems.org/gems/rdf-xsd) (~> 3.1)
* [HTMLEntities](https://rubygems.org/gems/htmlentities) ('~> 4.3')
* [Nokogiri](https://rubygems.org/gems/nokogiri) (~> 1.10)
* Soft dependency on [Nokogumbo](https://github.com/rubys/nokogumbo) (~> 2.0)

## Documentation
Full documentation available on [Rubydoc.info][Microdata doc]
Expand Down Expand Up @@ -116,4 +114,3 @@ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
[Microdata]: https://dev.w3.org/html5/md/Overview.html "HTML Microdata"
[Microdata RDF]: https://dvcs.w3.org/hg/htmldata/raw-file/default/microdata-rdf/index.html "Microdata to RDF"
[Microdata doc]: https://rubydoc.info/github/ruby-rdf/rdf-microdata/frames
[Nokogumbo]: https://github.com/rubys/nokogumbo/#readme
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.1.3
3.1.4
9 changes: 6 additions & 3 deletions lib/rdf/microdata/rdfa_reader.rb
@@ -1,5 +1,4 @@
require 'rdf/rdfa'
require 'nokogumbo'

module RDF::Microdata
##
Expand Down Expand Up @@ -42,8 +41,12 @@ def initialize(input = $stdin, **options, &block)
# Otherwise, default is utf-8
options[:encoding] ||= 'utf-8'
options[:encoding] = options[:encoding].to_s if options[:encoding]
input = input.read if input.respond_to?(:read)
::Nokogiri::HTML5(input.force_encoding(options[:encoding]))
begin
input = input.read if input.respond_to?(:read)
::Nokogiri::HTML5(input.force_encoding(options[:encoding]), max_parse_errors: 1000)
rescue LoadError, NoMethodError
::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding])
end
end

# For all members having @itemscope
Expand Down
3 changes: 1 addition & 2 deletions lib/rdf/microdata/reader/nokogiri.rb
Expand Up @@ -192,10 +192,9 @@ def initialize_html(input, **options)
options[:encoding] = options[:encoding].to_s if options[:encoding]

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
end
Expand Down
2 changes: 1 addition & 1 deletion rdf-microdata.gemspec
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'rdf-rdfa', '~> 3.1', '>= 3.1.3'
gem.add_runtime_dependency 'rdf-xsd', '~> 3.1'
gem.add_runtime_dependency 'htmlentities', '~> 4.3'
gem.add_runtime_dependency 'nokogiri' , '~> 1.10' # 1.11 Ruby 2.5
gem.add_runtime_dependency 'nokogiri' , '~> 1.12'

gem.add_development_dependency 'equivalent-xml' , '~> 0.6'
gem.add_development_dependency 'yard' , '~> 0.9'
Expand Down
14 changes: 10 additions & 4 deletions spec/spec_helper.rb
Expand Up @@ -4,7 +4,6 @@
require "bundler/setup"
require 'rspec'
require 'rdf/isomorphic'
require 'rdf/microdata'
require 'rdf/turtle'
require 'rdf/spec'
require 'rdf/spec/matchers'
Expand All @@ -19,18 +18,25 @@

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/"
end
Coveralls.wear!
rescue LoadError => e
STDERR.puts "Coverage Skipped: #{e.message}"
end
require 'rdf/microdata'

# Heuristically detect the input stream
def detect_format(stream)
Expand Down

0 comments on commit 8f7207c

Please sign in to comment.