inline_svg 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of inline_svg might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20cf938dedae16a9b3f2282f60666911ea31918d
|
4
|
+
data.tar.gz: 3e85ceba1e9306512ce5b6c8bf5e362449da05fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 913ca48724b6e124be585023a910568f7f7d850521f0e8294832160b84cd7c6e063b51cd5ddc097a22c92078c32f2f29be48c81ef0b300ff37f07fecd54c1ea6
|
7
|
+
data.tar.gz: ee22b302999f9bd020af932b4615a061cf3c8a14bb0a5bb5091f6f44edeb2f6fbd11e90fb82dba031d0161fe5e97a0fd368b6ed559246c0fd1b4e30fffe677be
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
## [Unreleased][unreleased]
|
6
6
|
- Nothing.
|
7
7
|
|
8
|
+
## [0.6.4] - 2016-04-23
|
9
|
+
### Fixed
|
10
|
+
- Don't duplicate the `title` element. Addresses issue
|
11
|
+
[#31](https://github.com/jamesmartin/inline_svg/issues/31).
|
12
|
+
- Make the `title` element the first child node of the SVG document.
|
13
|
+
|
8
14
|
## [0.6.3] - 2016-04-19
|
9
15
|
### Added
|
10
16
|
- Accept `IO` objects as arguments to `inline_svg`. Thanks,
|
@@ -74,8 +80,9 @@ transformations](https://github.com/jamesmartin/inline_svg/blob/master/README.md
|
|
74
80
|
### Added
|
75
81
|
- Basic Railtie and view helper to inline SVG documents to Rails views.
|
76
82
|
|
77
|
-
[unreleased]: https://github.com/jamesmartin/inline_svg/compare/v0.6.
|
78
|
-
[0.6.
|
83
|
+
[unreleased]: https://github.com/jamesmartin/inline_svg/compare/v0.6.4...HEAD
|
84
|
+
[0.6.4]: https://github.com/jamesmartin/inline_svg/compare/v0.6.3...v0.6.4
|
85
|
+
[0.6.3]: https://github.com/jamesmartin/inline_svg/compare/v0.6.2...v0.6.3
|
79
86
|
[0.6.2]: https://github.com/jamesmartin/inline_svg/compare/v0.6.1...v0.6.2
|
80
87
|
[0.6.1]: https://github.com/jamesmartin/inline_svg/compare/v0.6.0...v0.6.1
|
81
88
|
[0.6.0]: https://github.com/jamesmartin/inline_svg/compare/v0.5.3...v0.6.0
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Want to embed SVGs with Javascript? You might like [RemoteSvg](https://github.co
|
|
13
13
|
|
14
14
|
## Changelog
|
15
15
|
|
16
|
-
|
16
|
+
This project adheres to [Semantic Versioning](http://sermver.org). All notable changes are documented in the
|
17
17
|
[CHANGELOG](https://github.com/jamesmartin/inline_svg/blob/master/CHANGELOG.md).
|
18
18
|
|
19
19
|
## Installation
|
data/inline_svg.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.2"
|
24
|
+
spec.add_development_dependency "rspec_junit_formatter", "0.2.2"
|
24
25
|
|
25
26
|
spec.add_runtime_dependency "activesupport", ">= 4.0.4"
|
26
27
|
spec.add_runtime_dependency "nokogiri", "~> 1.6", '~> 1.6'
|
@@ -4,7 +4,8 @@ module InlineSvg::TransformPipeline::Transformations
|
|
4
4
|
doc = Nokogiri::XML::Document.parse(doc.to_html)
|
5
5
|
node = Nokogiri::XML::Node.new('title', doc)
|
6
6
|
node.content = value
|
7
|
-
doc.
|
7
|
+
doc.search('svg title').each { |node| node.remove }
|
8
|
+
doc.at_css('svg').prepend_child(node)
|
8
9
|
doc
|
9
10
|
end
|
10
11
|
end
|
data/lib/inline_svg/version.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'inline_svg/transform_pipeline'
|
2
|
+
|
3
|
+
describe InlineSvg::TransformPipeline::Transformations::Title do
|
4
|
+
it "adds a title element as the first element in the SVG document" do
|
5
|
+
document = Nokogiri::XML::Document.parse('<svg>Some document</svg>')
|
6
|
+
transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title")
|
7
|
+
|
8
|
+
expect(transformation.transform(document).to_html).to eq(
|
9
|
+
"<svg><title>Some Title</title>Some document</svg>\n"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "overwrites the content of an existing title element" do
|
14
|
+
document = Nokogiri::XML::Document.parse('<svg><title>My Title</title>Some document</svg>')
|
15
|
+
transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title")
|
16
|
+
|
17
|
+
expect(transformation.transform(document).to_html).to eq(
|
18
|
+
"<svg><title>Some Title</title>Some document</svg>\n"
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "handles empty SVG documents" do
|
23
|
+
document = Nokogiri::XML::Document.parse('<svg></svg>')
|
24
|
+
transformation = InlineSvg::TransformPipeline::Transformations::Title.create_with_value("Some Title")
|
25
|
+
|
26
|
+
expect(transformation.transform(document).to_html).to eq(
|
27
|
+
"<svg><title>Some Title</title></svg>\n"
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.2
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,6 +154,7 @@ files:
|
|
140
154
|
- spec/transformation_pipeline/transformations/id_attribute_spec.rb
|
141
155
|
- spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb
|
142
156
|
- spec/transformation_pipeline/transformations/size_spec.rb
|
157
|
+
- spec/transformation_pipeline/transformations/title_spec.rb
|
143
158
|
- spec/transformation_pipeline/transformations/width_spec.rb
|
144
159
|
- spec/transformation_pipeline/transformations_spec.rb
|
145
160
|
homepage: https://github.com/jamesmartin/inline_svg
|
@@ -178,5 +193,6 @@ test_files:
|
|
178
193
|
- spec/transformation_pipeline/transformations/id_attribute_spec.rb
|
179
194
|
- spec/transformation_pipeline/transformations/preserve_aspect_ratio_spec.rb
|
180
195
|
- spec/transformation_pipeline/transformations/size_spec.rb
|
196
|
+
- spec/transformation_pipeline/transformations/title_spec.rb
|
181
197
|
- spec/transformation_pipeline/transformations/width_spec.rb
|
182
198
|
- spec/transformation_pipeline/transformations_spec.rb
|