From 9f4bc885c7fd63a7963a477defee034c65b826c9 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Thu, 21 Dec 2017 13:59:42 -0800 Subject: [PATCH 1/5] Update yard ~> 0.9.12 due to vulnerability. --- rdf-n3.gemspec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rdf-n3.gemspec b/rdf-n3.gemspec index c6642b4..9d92bd8 100755 --- a/rdf-n3.gemspec +++ b/rdf-n3.gemspec @@ -22,18 +22,18 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] - #gem.add_dependency 'rdf', '~> 2.0' + #gem.add_dependency 'rdf', '~> 3.0' gem.add_runtime_dependency 'rdf', '>= 2.2', '< 4.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', '~> 3.0' + #gem.add_development_dependency 'rdf-isomorphic', '~> 3.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 'yard' , '~> 0.9.12' gem.post_install_message = nil end From 66d0bb16220e2b9d4f66cf29d213dd4bed5ef9c7 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 30 Dec 2017 14:51:22 -0800 Subject: [PATCH 2/5] Update dependencies. --- .travis.yml | 3 +++ Gemfile | 5 ----- README.md | 2 +- rdf-n3.gemspec | 9 +++------ 4 files changed, 7 insertions(+), 12 deletions(-) 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/rdf-n3.gemspec b/rdf-n3.gemspec index 9d92bd8..7f5666b 100755 --- a/rdf-n3.gemspec +++ b/rdf-n3.gemspec @@ -22,17 +22,14 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] - #gem.add_dependency 'rdf', '~> 3.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', '~> 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', '~> 3.0' - #gem.add_development_dependency 'rdf-isomorphic', '~> 3.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 '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 From ab176dd39d07479a7707da9458ccbda623f9f55a Mon Sep 17 00:00:00 2001 From: Arthur Dingemans Date: Fri, 12 Jan 2018 15:33:45 +0100 Subject: [PATCH 3/5] Escape backslashes in multi-line literals Conforming spec: https://www.w3.org/TeamSubmission/n3/#strings --- lib/rdf/n3/writer.rb | 2 +- spec/writer_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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/spec/writer_spec.rb b/spec/writer_spec.rb index 8ccc644..b0e6fcc 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 From 3e8f9875167db4f7b0fd6c351268f113d9426d31 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 14 Jan 2018 13:04:28 -0800 Subject: [PATCH 4/5] Escape backslashes in multi-line literals --- .gitignore | 1 + example-files/back-slash.nt | 2 ++ script/parse | 2 -- spec/writer_spec.rb | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 example-files/back-slash.nt 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/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/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 b0e6fcc..c1135fa 100644 --- a/spec/writer_spec.rb +++ b/spec/writer_spec.rb @@ -281,12 +281,12 @@ end it "encodes embedded \\" do - n3 = %(:a :b """string with \\ escaped quote marks""" .) + 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 + n3 = %(:a :b """string with \\\\ escaped quote marks """ .) serialize(n3, nil, [/string with \\\\ escaped quote mark/]) end From 7d5ced5fc96cbbc73a8a69e0bd58559878906065 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 14 Jan 2018 13:05:40 -0800 Subject: [PATCH 5/5] Version 3.0.0. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ccbccc3..4a36342 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.0 +3.0.0