diff --git a/.gitignore b/.gitignore index 29521b0..762e32b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /spec.html Gemfile.lock /.rbx/ +/.byebug_history diff --git a/.travis.yml b/.travis.yml index 9e1f468..80f381d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,15 @@ language: ruby bundler_args: --without debug script: "bundle exec rspec spec" +before_install: "gem update --system" + env: - CI=true rvm: - 2.2 - 2.3 - 2.4 + - 2.5 - jruby-9 - rbx-3 cache: bundler diff --git a/Gemfile b/Gemfile index dbb1d09..6e29b8e 100644 --- a/Gemfile +++ b/Gemfile @@ -14,8 +14,3 @@ end group :debug do gem "byebug", platform: :mri end - -platforms :rbx do - gem 'rubysl', '~> 2.0' - gem 'rubinius', '~> 2.0' -end diff --git a/README.md b/README.md index 765a8a0..ad96fc4 100755 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ http://www.w3.org/2000/10/swap/grammar/n3.n3 (along with bnf-rules.n3) using cwm * Create equivalent to `--think` to iterate on solutions. ## Dependencies -* [RDF.rb](http://rubygems.org/gems/rdf) (>= 2.0) +* [RDF.rb](http://rubygems.org/gems/rdf) (>= 3.0) ## Documentation Full documentation available on [RubyDoc.info](http://rubydoc.info/github/ruby-rdf/rdf-n3/frames) diff --git a/VERSION b/VERSION index ccbccc3..4a36342 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.0 +3.0.0 diff --git a/example-files/back-slash.nt b/example-files/back-slash.nt new file mode 100644 index 0000000..fb69dc2 --- /dev/null +++ b/example-files/back-slash.nt @@ -0,0 +1,2 @@ + "string with \\ char" . + "string with \\ char\n" . diff --git a/lib/rdf/n3/writer.rb b/lib/rdf/n3/writer.rb index 0225cce..4517841 100644 --- a/lib/rdf/n3/writer.rb +++ b/lib/rdf/n3/writer.rb @@ -400,7 +400,7 @@ def reset # @return [String] def quoted(string) if string.to_s.match(/[\t\n\r]/) - string = string.gsub('\\', '\\\\').gsub('"""', '\\"""') + string = string.gsub('\\', '\\\\\\\\').gsub('"""', '\\"""') %("""#{string}""") else "\"#{escaped(string)}\"" diff --git a/rdf-n3.gemspec b/rdf-n3.gemspec index c6642b4..7f5666b 100755 --- a/rdf-n3.gemspec +++ b/rdf-n3.gemspec @@ -22,18 +22,15 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] - #gem.add_dependency 'rdf', '~> 2.0' - gem.add_runtime_dependency 'rdf', '>= 2.2', '< 4.0' + gem.add_dependency 'rdf', '~> 3.0' gem.add_development_dependency 'open-uri-cached', '~> 0.0', '>= 0.0.5' - #gem.add_development_dependency 'json-ld', '~> 2.0' - gem.add_development_dependency 'json-ld', '>= 2.1', '< 4.0' - gem.add_development_dependency 'rspec', '~> 3.4' + #gem.add_development_dependency 'json-ld', '~> 3.0' + gem.add_development_dependency 'json-ld', '>= 2.2', '< 4.0' + gem.add_development_dependency 'rspec', '~> 3.7' gem.add_development_dependency 'rspec-its', '~> 1.2' - #gem.add_development_dependency 'rdf-spec', '~> 2.0' - #gem.add_development_dependency 'rdf-isomorphic', '~> 2.0' - gem.add_development_dependency 'rdf-spec', '>= 2.2', '< 4.0' - gem.add_development_dependency 'rdf-isomorphic', '>= 2.0', '< 4.0' - gem.add_development_dependency 'yard' , '~> 0.8' + gem.add_development_dependency 'rdf-spec', '~> 3.0' + gem.add_development_dependency 'rdf-isomorphic', '~> 3.0' + gem.add_development_dependency 'yard' , '~> 0.9.12' gem.post_install_message = nil end diff --git a/script/parse b/script/parse index 182a07a..7736049 100755 --- a/script/parse +++ b/script/parse @@ -5,8 +5,6 @@ require "bundler/setup" require 'logger' require 'rdf/n3' require 'rdf/ntriples' -require 'rdf/rdfxml' -require 'rdf/rdfa' require 'getoptlong' require 'open-uri' diff --git a/spec/writer_spec.rb b/spec/writer_spec.rb index 8ccc644..c1135fa 100644 --- a/spec/writer_spec.rb +++ b/spec/writer_spec.rb @@ -279,6 +279,17 @@ n3 = %(:a :b """string with " escaped quote marks""" .) serialize(n3, nil, [/string with \\" escaped quote mark/]) end + + it "encodes embedded \\" do + n3 = %(:a :b """string with \\\\ escaped quote marks""" .) + serialize(n3, nil, [/string with \\\\ escaped quote mark/]) + end + + it "encodes embedded \\ multi-line" do + n3 = %(:a :b """string with \\\\ escaped quote marks + """ .) + serialize(n3, nil, [/string with \\\\ escaped quote mark/]) + end end describe "with language" do