hexp 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +6 -2
- data/hexp.gemspec +1 -1
- data/lib/hexp/unparser.rb +2 -2
- data/lib/hexp/version.rb +1 -1
- data/spec/spec_helper.rb +13 -16
- data/spec/unit/hexp/unparser_spec.rb +19 -0
- metadata +9 -9
- data/spec/shared_helper.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82cf0421b04b36a3d4d397510dcd90adc0a181d1
|
4
|
+
data.tar.gz: 1f4a2ab57c547894e180ede1c5cb4001b98889cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d6668354d47a11855b83d08178c24e98a05759ef063884f5b6576c17d8ce3cfb058fb15b3ffec3663cd210fa742ba64ae1a36d795661c50ba31faebc80e7d49
|
7
|
+
data.tar.gz: cba13dcce9246705dd2cfcbe03638f93314a850809b5952c89377b04fbcd53dbea599fe4e0b0c3cfa871808ec1aaa951904e9694542832d7a60c9558a62b3138
|
data/Changelog.md
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
### Development
|
2
2
|
|
3
|
-
[full diff](http://github.com/plexus/hexp/compare/v0.4.
|
3
|
+
[full diff](http://github.com/plexus/hexp/compare/v0.4.5...master)
|
4
|
+
|
5
|
+
### v0.4.5
|
6
|
+
|
7
|
+
* Bugfix: don't do entity escaping inside :script tags, also not when
|
8
|
+
there's more than one text node as a child element
|
4
9
|
|
5
10
|
### v0.4.4
|
6
11
|
|
7
12
|
* Drop the dependency on SASS, use Nokogiri instead for parsing CSS
|
8
13
|
selectors
|
9
14
|
|
10
|
-
|
11
15
|
### v0.4.3
|
12
16
|
|
13
17
|
Performance improvements
|
data/hexp.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_runtime_dependency 'concord', '~> 0.0'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'rake'
|
25
|
-
gem.add_development_dependency 'rspec'
|
25
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
26
26
|
gem.add_development_dependency 'benchmark_suite'
|
27
27
|
gem.add_development_dependency 'mutant-rspec'
|
28
28
|
gem.add_development_dependency 'rspec-its'
|
data/lib/hexp/unparser.rb
CHANGED
@@ -67,8 +67,8 @@ module Hexp
|
|
67
67
|
def add_child_nodes(buffer, tag, children)
|
68
68
|
# TODO look into the special parsing mode that browsers use inside <script> tags,
|
69
69
|
# at the least we should throw an error if the text contains </script>
|
70
|
-
if options[:no_escape].include?(tag) && children.
|
71
|
-
buffer <<
|
70
|
+
if options[:no_escape].include?(tag) && children.all?(&:text?)
|
71
|
+
children.each {|node| buffer << node }
|
72
72
|
else
|
73
73
|
children.each {|node| add_node(buffer, node) }
|
74
74
|
end
|
data/lib/hexp/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
if ENV['COVERAGE'] == 'true'
|
6
|
-
require 'simplecov'
|
7
|
-
require 'coveralls'
|
3
|
+
require 'hexp'
|
4
|
+
require 'rspec/its'
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
]
|
13
|
-
|
14
|
-
SimpleCov.start do
|
15
|
-
command_name 'spec:unit'
|
16
|
-
add_filter 'hexp/h.rb'
|
17
|
-
|
18
|
-
minimum_coverage 98.5
|
6
|
+
RSpec::Matchers.define :dom_eq do |other_dom|
|
7
|
+
match do |dom|
|
8
|
+
Hexp::Nokogiri::Equality.new(dom, other_dom).call
|
19
9
|
end
|
20
10
|
end
|
21
11
|
|
22
|
-
|
12
|
+
RSpec.configure do |rspec|
|
13
|
+
rspec.mock_with :rspec do |configuration|
|
14
|
+
configuration.syntax = :expect
|
15
|
+
end
|
16
|
+
rspec.around(:each) do |example|
|
17
|
+
Timeout.timeout(1, &example)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hexp::Unparser do
|
4
|
+
let(:unparser) { described_class.new({}) }
|
5
|
+
let(:node) { H[:p, %q{Hello "world", it's great meet & chat >.<}] }
|
6
|
+
let(:html) { unparser.call(node) }
|
7
|
+
|
8
|
+
it 'should escape sensitive characters' do
|
9
|
+
expect(html).to eql '<p>Hello "world", it's great meet & chat >.<</p>'
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'inside a script tag' do
|
13
|
+
let(:node) { H[:script, %q{Hello "world", }, %q{it's great meet & chat >.<}] }
|
14
|
+
|
15
|
+
it 'should not escape' do
|
16
|
+
expect(html).to eql %q{<script>Hello "world", it's great meet & chat >.<</script>}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arne Brasseur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.1'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: benchmark_suite
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,7 +182,6 @@ files:
|
|
182
182
|
- lib/hexp/unparser.rb
|
183
183
|
- lib/hexp/version.rb
|
184
184
|
- spec/integration/literal_syntax_spec.rb
|
185
|
-
- spec/shared_helper.rb
|
186
185
|
- spec/spec_helper.rb
|
187
186
|
- spec/unit/hexp/builder_spec.rb
|
188
187
|
- spec/unit/hexp/css_selector/attribute_spec.rb
|
@@ -214,6 +213,7 @@ files:
|
|
214
213
|
- spec/unit/hexp/nokogiri/reader_spec.rb
|
215
214
|
- spec/unit/hexp/parse_spec.rb
|
216
215
|
- spec/unit/hexp/text_node_spec.rb
|
216
|
+
- spec/unit/hexp/unparser_spec.rb
|
217
217
|
- spec/unit/hexp_spec.rb
|
218
218
|
homepage: https://github.com/plexus/hexp
|
219
219
|
licenses:
|
@@ -235,13 +235,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
237
|
rubyforge_project:
|
238
|
-
rubygems_version: 2.
|
238
|
+
rubygems_version: 2.2.2
|
239
239
|
signing_key:
|
240
240
|
specification_version: 4
|
241
241
|
summary: Generate and manipulate HTML documents and nodes.
|
242
242
|
test_files:
|
243
243
|
- spec/integration/literal_syntax_spec.rb
|
244
|
-
- spec/shared_helper.rb
|
245
244
|
- spec/spec_helper.rb
|
246
245
|
- spec/unit/hexp/builder_spec.rb
|
247
246
|
- spec/unit/hexp/css_selector/attribute_spec.rb
|
@@ -273,4 +272,5 @@ test_files:
|
|
273
272
|
- spec/unit/hexp/nokogiri/reader_spec.rb
|
274
273
|
- spec/unit/hexp/parse_spec.rb
|
275
274
|
- spec/unit/hexp/text_node_spec.rb
|
275
|
+
- spec/unit/hexp/unparser_spec.rb
|
276
276
|
- spec/unit/hexp_spec.rb
|
data/spec/shared_helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'hexp'
|
2
|
-
require 'rspec/its'
|
3
|
-
|
4
|
-
RSpec::Matchers.define :dom_eq do |other_dom|
|
5
|
-
match do |dom|
|
6
|
-
Hexp::Nokogiri::Equality.new(dom, other_dom).call
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
RSpec.configure do |rspec|
|
11
|
-
rspec.mock_with :rspec do |configuration|
|
12
|
-
configuration.syntax = :expect
|
13
|
-
end
|
14
|
-
rspec.around(:each) do |example|
|
15
|
-
Timeout.timeout(1, &example)
|
16
|
-
end
|
17
|
-
end
|