attributer 0.0.1
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.
- data/.gitignore +17 -0
- data/.travis.yml +3 -0
- data/CONTRIBUTING.md +8 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +133 -0
- data/Rakefile +7 -0
- data/attributer.gemspec +27 -0
- data/lib/attributer.rb +65 -0
- data/lib/attributer/version.rb +3 -0
- data/spec/attributer_spec.rb +152 -0
- data/spec/results.html +23 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/test.html +23 -0
- data/spec/test.png +0 -0
- data/spec/test2.html +23 -0
- metadata +182 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# Contributing to vatsim_online
|
2
|
+
|
3
|
+
1. Fork it
|
4
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
5
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
6
|
+
4. Make sure all tests are passing!
|
7
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
8
|
+
6. Create new Pull Request
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Svilen Vassilev
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# Attributer
|
2
|
+
|
3
|
+
Ruby gem for adding width and height attributes to image tags within HTML blocks.
|
4
|
+
|
5
|
+
This library will parse a piece of HTML, find all the image tags inside it, obtain
|
6
|
+
the width and height of these images and insert them as attributes to the `img` tag.
|
7
|
+
It will then return the entire HTML with the image attributes properly in place.
|
8
|
+
|
9
|
+
Useful for example as a callback with WYSIWYG editors that don't automatically add
|
10
|
+
`width` and `height` attributes to images or for instantly optimizing all your old blog
|
11
|
+
or CMS posts with img tag attributes for speed and standarts compliance.
|
12
|
+
|
13
|
+
[](http://travis-ci.org/tarakanbg/attributer)
|
14
|
+
[](https://codeclimate.com/github/tarakanbg/attributer)
|
15
|
+
[](https://gemnasium.com/tarakanbg/attributer)
|
16
|
+
[](http://badge.fury.io/rb/attributer)
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
gem 'attributer'
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install attributer
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
This library augments the default Ruby `String` class with 1 public method:
|
35
|
+
`.image_attributes`. You can attach this method to a string variable containing a piece of HTML
|
36
|
+
of any length or complexity. This method takes one of 2 mandatory arguments:
|
37
|
+
`(:domain => "http://my-domain.com")` or `(:path => /my/local/filesystem/path)`.
|
38
|
+
It will raise an `ArgumentError` exception if neither argument is passed.
|
39
|
+
|
40
|
+
These arguments are **only used** to locate the images referenced in your HTML and poll their width and height;
|
41
|
+
they are **not** written in the resulting HTML: the `src` attribute of the `img` tag
|
42
|
+
remains unchanged. Either a full local path or a URL prefix is needed.
|
43
|
+
|
44
|
+
For discovery purposes these arguments are concatenated to the `src` attribute of the image tag,
|
45
|
+
i.e. if your images are accessible via `http://my-domain.com/assets/test.jpg` and you
|
46
|
+
already have `src="/assets/test.jpg"` in your image tag, then you only need to use
|
47
|
+
`(:domain => "http://my-domain.com")` as an argument.
|
48
|
+
|
49
|
+
Likewise if your images are locally accessible via `/home/www/site/assets/test.jpg` and you
|
50
|
+
already have `src="/assets/test.jpg"` in your image tag, then you only need to use
|
51
|
+
`(:path => "/home/www/site")` as an argument.
|
52
|
+
|
53
|
+
The `.image_attributes` method will return a string of the entire HTML block with the image
|
54
|
+
attributes properly in place.
|
55
|
+
|
56
|
+
### Examples
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
html = '<img alt="test" class="gallery" src="/assets/test.jpg">'
|
60
|
+
html.image_attributes(:domain => "http://my-domain.com")
|
61
|
+
# => '<img alt="test" class="gallery" src="/assets/test.jpg" width="200" height="266">'
|
62
|
+
|
63
|
+
html = '<img alt="test2" class="fuzzy" src="/images/test2.jpg">'
|
64
|
+
html.image_attributes(:path => "/home/www/site")
|
65
|
+
# => '<img alt="test2" class="fuzzy" src="/images/test2.jpg" width="340" height="155">'
|
66
|
+
|
67
|
+
html = Post.find(20).body # =>
|
68
|
+
# <div id='gallery'>
|
69
|
+
# <img alt="1" class="gallery" src="/assets/1.jpg" />
|
70
|
+
# <img alt="2" class="gallery" src="/assets/2.jpg" />
|
71
|
+
# <img alt="3" class="gallery" src="/assets/3.jpg" />
|
72
|
+
# <img alt="4" class="gallery" src="/assets/4.jpg" />
|
73
|
+
# <img alt="5" class="gallery" src="/assets/5.jpg" />
|
74
|
+
# <img alt="6" class="gallery" src="/assets/6.jpg" />
|
75
|
+
# <img alt="7" class="gallery" src="/assets/7.jpg" />
|
76
|
+
# <img alt="8" class="gallery" src="/assets/8.jpg" />
|
77
|
+
# <img alt="9" class="gallery" src="/assets/9.jpg" />
|
78
|
+
# <img alt="10" class="gallery" src="/assets/10.jpg" />
|
79
|
+
# <img alt="11" class="gallery" src="/assets/11.jpg" />
|
80
|
+
# <img alt="12" class="gallery" src="/assets/12.jpg" />
|
81
|
+
# <img alt="13" class="gallery" src="/assets/13.jpg" />
|
82
|
+
# <img alt="14" class="gallery" src="/assets/14.jpg" />
|
83
|
+
# <img alt="15" class="gallery" src="/assets/15.jpg" />
|
84
|
+
# <img alt="16" class="gallery" src="/assets/16.jpg" />
|
85
|
+
# <img alt="17" class="gallery" src="/assets/17.jpg" />
|
86
|
+
# <img alt="18" class="gallery" src="/assets/18.jpg" />
|
87
|
+
# <img alt="19" class="gallery" src="/assets/19.jpg" />
|
88
|
+
# <img alt="20" class="gallery" src="/assets/20.jpg" />
|
89
|
+
# </div>
|
90
|
+
html.image_attributes(:domain => "http://my-domain.com") # =>
|
91
|
+
# <div id='gallery'>
|
92
|
+
# <img alt="1" class="gallery" src="/assets/1.jpg" width="200" height="266">
|
93
|
+
# <img alt="2" class="gallery" src="/assets/2.jpg" width="200" height="266">
|
94
|
+
# <img alt="3" class="gallery" src="/assets/3.jpg" width="200" height="266">
|
95
|
+
# <img alt="4" class="gallery" src="/assets/4.jpg" width="200" height="266">
|
96
|
+
# <img alt="5" class="gallery" src="/assets/5.jpg" width="200" height="266">
|
97
|
+
# <img alt="6" class="gallery" src="/assets/6.jpg" width="200" height="266">
|
98
|
+
# <img alt="7" class="gallery" src="/assets/7.jpg" width="200" height="266">
|
99
|
+
# <img alt="8" class="gallery" src="/assets/8.jpg" width="200" height="266">
|
100
|
+
# <img alt="9" class="gallery" src="/assets/9.jpg" width="200" height="266">
|
101
|
+
# <img alt="10" class="gallery" src="/assets/10.jpg" width="200" height="266">
|
102
|
+
# <img alt="11" class="gallery" src="/assets/11.jpg" width="200" height="266">
|
103
|
+
# <img alt="12" class="gallery" src="/assets/12.jpg" width="200" height="266">
|
104
|
+
# <img alt="13" class="gallery" src="/assets/13.jpg" width="200" height="266">
|
105
|
+
# <img alt="14" class="gallery" src="/assets/14.jpg" width="200" height="266">
|
106
|
+
# <img alt="15" class="gallery" src="/assets/15.jpg" width="200" height="266">
|
107
|
+
# <img alt="16" class="gallery" src="/assets/16.jpg" width="200" height="266">
|
108
|
+
# <img alt="17" class="gallery" src="/assets/17.jpg" width="200" height="266">
|
109
|
+
# <img alt="18" class="gallery" src="/assets/18.jpg" width="200" height="266">
|
110
|
+
# <img alt="19" class="gallery" src="/assets/19.jpg" width="200" height="266">
|
111
|
+
# <img alt="20" class="gallery" src="/assets/20.jpg" width="200" height="266">
|
112
|
+
# </div>
|
113
|
+
```
|
114
|
+
|
115
|
+
## Contributing
|
116
|
+
|
117
|
+
1. Fork it
|
118
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
119
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
120
|
+
4. Make sure all rspec tests pass!
|
121
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
122
|
+
6. Create new Pull Request
|
123
|
+
|
124
|
+
## Credits
|
125
|
+
|
126
|
+
Copyright © 2013 [Svilen Vassilev](http://svilen.rubystudio.net)
|
127
|
+
|
128
|
+
*If you find my work useful or time-saving, you can endorse it or buy me a cup of coffee:*
|
129
|
+
|
130
|
+
[](http://coderwall.com/svilenv)
|
131
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5FR7AQA4PLD8A)
|
132
|
+
|
133
|
+
Released under the [MIT LICENSE](https://github.com/tarakanbg/attributer/blob/master/LICENSE.txt)
|
data/Rakefile
ADDED
data/attributer.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'attributer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "attributer"
|
8
|
+
gem.version = Attributer::VERSION
|
9
|
+
gem.authors = ["Svilen Vassilev"]
|
10
|
+
gem.email = ["svilen@rubystudio.net"]
|
11
|
+
gem.description = %q{Ruby gem for adding width and height attributes to image tags within HTML blocks}
|
12
|
+
gem.summary = %q{Ruby gem for adding width and height attributes to image tags within HTML blocks}
|
13
|
+
gem.homepage = "https://github.com/tarakanbg/attributer"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency "rspec"
|
21
|
+
gem.add_development_dependency "rake"
|
22
|
+
gem.add_development_dependency "guard"
|
23
|
+
gem.add_development_dependency "libnotify"
|
24
|
+
gem.add_development_dependency "guard-rspec"
|
25
|
+
gem.add_dependency "fastimage", "~> 1.2.13"
|
26
|
+
gem.add_dependency "nokogiri", "~> 1.5.6"
|
27
|
+
end
|
data/lib/attributer.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require "attributer/version"
|
2
|
+
|
3
|
+
class String
|
4
|
+
def image_attributes(args={})
|
5
|
+
Attributer::Attributer.new(self, args).parsed_string
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module Attributer
|
10
|
+
class Attributer
|
11
|
+
require "fastimage"
|
12
|
+
require "nokogiri"
|
13
|
+
|
14
|
+
attributes = %w{lpost images old_htmls new_htmls uri new_post}
|
15
|
+
attributes.each {|attribute| attr_accessor attribute.to_sym }
|
16
|
+
|
17
|
+
def initialize(string, args = nil)
|
18
|
+
args[:domain] ? @uri = args[:domain] : @uri = args[:path]
|
19
|
+
raise ArgumentError, "No domain or local path specified! Attributer can't find image!\nPlease use either :domain or :path options in your\n'image_attributes' method!" if @uri.nil?
|
20
|
+
@lpost = Nokogiri::HTML::DocumentFragment.parse( string.force_encoding "UTF-8" )
|
21
|
+
@new_post = string.force_encoding "UTF-8"
|
22
|
+
parse_image_tags
|
23
|
+
add_attributes
|
24
|
+
replace_images
|
25
|
+
end
|
26
|
+
|
27
|
+
def parsed_string
|
28
|
+
@new_post
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def parse_image_tags
|
34
|
+
@old_htmls = []; @new_htmls = []
|
35
|
+
@images = @lpost.css("img")
|
36
|
+
@images.each {|i| @old_htmls << i.to_html}
|
37
|
+
process_trailing_slashes
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_attributes
|
41
|
+
for image in @old_htmls
|
42
|
+
imagetag = Nokogiri::HTML::DocumentFragment.parse( image )
|
43
|
+
img = imagetag.at_css "img"
|
44
|
+
size = FastImage.size(@uri + img['src'], :timeout => 5)
|
45
|
+
img['width'] = size.first.to_s
|
46
|
+
img['height'] = size.last.to_s
|
47
|
+
@new_htmls << imagetag.to_html
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def replace_images
|
52
|
+
@old_htmls.each do |old|
|
53
|
+
@new_post.sub!(old, @new_htmls.shift)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def process_trailing_slashes
|
58
|
+
@old_htmls.each do |image|
|
59
|
+
image.sub!(">", " />") unless @new_post.include? image
|
60
|
+
image.sub!(" />", "/>") unless @new_post.include? image
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
local_test_file
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
|
7
|
+
describe "local_test_file" do
|
8
|
+
it "should return a string" do
|
9
|
+
local_test_file.class.should eq(String)
|
10
|
+
end
|
11
|
+
it "should be read corectly" do
|
12
|
+
local_test_file.should eq(File.open(File.realpath("spec/test.html"), "rb").read)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "image_attributes" do
|
17
|
+
it "should return a string" do
|
18
|
+
local_test_file.image_attributes(:domain => "http://darvazaogrev.com").class.should eq(String)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should handle domains" do
|
22
|
+
test_string = '<img alt="1" class="gallery" src="/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg">'
|
23
|
+
test_string.image_attributes(:domain => "http://darvazaogrev.com").should eq("<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\" width=\"200\" height=\"266\">")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should raise exception if used without args" do
|
27
|
+
test_string = "<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\">"
|
28
|
+
expect {test_string.image_attributes}.to raise_error(ArgumentError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should handle local path" do
|
32
|
+
path = File.realpath("spec")
|
33
|
+
test_string = "<img alt=\"test\" src=\"/test.png\">"
|
34
|
+
test_string.image_attributes(:path => path).should eq("<img alt=\"test\" src=\"/test.png\" width=\"500\" height=\"333\">")
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should produce matching results" do
|
38
|
+
local_test_file.image_attributes(:domain => "http://darvazaogrev.com").should eq(results_file)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should handle HTML with or without trailing slashes in the img tag" do
|
42
|
+
local_test_file_2.image_attributes(:domain => "http://darvazaogrev.com").should eq(results_file)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
describe Attributer::Attributer do
|
50
|
+
|
51
|
+
describe "parsing the html block" do
|
52
|
+
it "should be successful" do
|
53
|
+
parsed = Nokogiri::HTML::DocumentFragment.parse(local_test_file)
|
54
|
+
parsed.class.should eq(Nokogiri::HTML::DocumentFragment)
|
55
|
+
images = parsed.css("img")
|
56
|
+
images.class.should eq(Nokogiri::XML::NodeSet)
|
57
|
+
images.count.should eq(20)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should yield a valid array of img tags" do
|
61
|
+
old_htmls = []; new_htmls = []
|
62
|
+
parsed = Nokogiri::HTML::DocumentFragment.parse(local_test_file)
|
63
|
+
parsed.class.should eq(Nokogiri::HTML::DocumentFragment)
|
64
|
+
images = parsed.css("img")
|
65
|
+
images.class.should eq(Nokogiri::XML::NodeSet)
|
66
|
+
images.count.should eq(20)
|
67
|
+
images.each {|i| old_htmls << i.to_html}
|
68
|
+
old_htmls.count.should eq(20)
|
69
|
+
old_htmls.class.should eq(Array)
|
70
|
+
old_htmls.first.should eq("<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\">")
|
71
|
+
old_htmls.last.should eq("<img alt=\"20\" class=\"gallery\" src=\"/assets/thumbnails/20-7edabdea6a94e8b70ffc37ee324b9fab.jpg\">")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should parse down to XML element" do
|
75
|
+
old_htmls = []; new_htmls = []
|
76
|
+
parsed = Nokogiri::HTML::DocumentFragment.parse(local_test_file)
|
77
|
+
images = parsed.css("img")
|
78
|
+
images.each {|i| old_htmls << i.to_html}
|
79
|
+
imagetag = Nokogiri::HTML::DocumentFragment.parse( old_htmls.first )
|
80
|
+
imagetag.class.should eq(Nokogiri::HTML::DocumentFragment)
|
81
|
+
img = imagetag.at_css "img"
|
82
|
+
img.class.should eq(Nokogiri::XML::Element)
|
83
|
+
img['src'].class.should eq(String)
|
84
|
+
img['src'].should eq("/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg")
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should construct valid paths" do
|
88
|
+
old_htmls = []; new_htmls = []
|
89
|
+
parsed = Nokogiri::HTML::DocumentFragment.parse(local_test_file)
|
90
|
+
images = parsed.css("img")
|
91
|
+
images.each {|i| old_htmls << i.to_html}
|
92
|
+
imagetag = Nokogiri::HTML::DocumentFragment.parse( old_htmls.first )
|
93
|
+
img = imagetag.at_css "img"
|
94
|
+
img['src'].class.should eq(String)
|
95
|
+
domain = "http://darvazaogrev.com"
|
96
|
+
path = domain + img['src']
|
97
|
+
path.should eq("http://darvazaogrev.com/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should pull dimensions" do
|
101
|
+
old_htmls = []; new_htmls = []
|
102
|
+
parsed = Nokogiri::HTML::DocumentFragment.parse(local_test_file)
|
103
|
+
images = parsed.css("img")
|
104
|
+
images.each {|i| old_htmls << i.to_html}
|
105
|
+
imagetag = Nokogiri::HTML::DocumentFragment.parse( old_htmls.first )
|
106
|
+
img = imagetag.at_css "img"
|
107
|
+
domain = "http://darvazaogrev.com"
|
108
|
+
path = domain + img['src']
|
109
|
+
size = FastImage.size(path)
|
110
|
+
size.should eq([200, 266])
|
111
|
+
size.class.should eq(Array)
|
112
|
+
img['width'] = size.first.to_s
|
113
|
+
img['height'] = size.last.to_s
|
114
|
+
imagetag.to_html.should eq("<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\" width=\"200\" height=\"266\">")
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should sub old with new" do
|
118
|
+
old_htmls = []; new_htmls = []
|
119
|
+
parsed = Nokogiri::HTML::DocumentFragment.parse(local_test_file)
|
120
|
+
images = parsed.css("img")
|
121
|
+
images.each {|i| old_htmls << i.to_html}
|
122
|
+
for image in old_htmls
|
123
|
+
imagetag = Nokogiri::HTML::DocumentFragment.parse( image )
|
124
|
+
img = imagetag.at_css "img"
|
125
|
+
domain = "http://darvazaogrev.com"
|
126
|
+
path = domain + img['src']
|
127
|
+
size = FastImage.size(path, :timeout => 5)
|
128
|
+
img['width'] = size.first.to_s
|
129
|
+
img['height'] = size.last.to_s
|
130
|
+
new_htmls << imagetag.to_html
|
131
|
+
end
|
132
|
+
new_htmls.should eq(["<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\" width=\"200\" height=\"266\">", "<img alt=\"2\" class=\"gallery\" src=\"/assets/thumbnails/2-413bd5c8b6b7263beffbbbad112568fd.jpg\" width=\"200\" height=\"266\">", "<img alt=\"3\" class=\"gallery\" src=\"/assets/thumbnails/3-50cea3d1ecb37bc0a7158adfee38d020.jpg\" width=\"200\" height=\"266\">", "<img alt=\"4\" class=\"gallery\" src=\"/assets/thumbnails/4-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg\" width=\"200\" height=\"266\">", "<img alt=\"5\" class=\"gallery\" src=\"/assets/thumbnails/5-900f1e2e061af1ea2f0ea622d0be5c38.jpg\" width=\"200\" height=\"266\">", "<img alt=\"6\" class=\"gallery\" src=\"/assets/thumbnails/6-4837c7ac224fc26dd995f4441aa7a458.jpg\" width=\"200\" height=\"266\">", "<img alt=\"7\" class=\"gallery\" src=\"/assets/thumbnails/7-79120b81863981edf1a997711e8268fb.jpg\" width=\"200\" height=\"266\">", "<img alt=\"8\" class=\"gallery\" src=\"/assets/thumbnails/8-2057ca29648dc1530b752918f09fba8d.jpg\" width=\"200\" height=\"266\">", "<img alt=\"9\" class=\"gallery\" src=\"/assets/thumbnails/9-413bd5c8b6b7263beffbbbad112568fd.jpg\" width=\"200\" height=\"266\">", "<img alt=\"10\" class=\"gallery\" src=\"/assets/thumbnails/10-900f1e2e061af1ea2f0ea622d0be5c38.jpg\" width=\"200\" height=\"266\">", "<img alt=\"11\" class=\"gallery\" src=\"/assets/thumbnails/11-900f1e2e061af1ea2f0ea622d0be5c38.jpg\" width=\"200\" height=\"266\">", "<img alt=\"12\" class=\"gallery\" src=\"/assets/thumbnails/12-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg\" width=\"200\" height=\"266\">", "<img alt=\"13\" class=\"gallery\" src=\"/assets/thumbnails/13-4837c7ac224fc26dd995f4441aa7a458.jpg\" width=\"200\" height=\"266\">", "<img alt=\"14\" class=\"gallery\" src=\"/assets/thumbnails/14-79120b81863981edf1a997711e8268fb.jpg\" width=\"200\" height=\"266\">", "<img alt=\"15\" class=\"gallery\" src=\"/assets/thumbnails/15-51330c678115d1236ce46e1ea8e6c019.jpg\" width=\"200\" height=\"267\">", "<img alt=\"16\" class=\"gallery\" src=\"/assets/thumbnails/16-1883f9ecb69aebe721037b4b19c6cec4.jpg\" width=\"200\" height=\"267\">", "<img alt=\"17\" class=\"gallery\" src=\"/assets/thumbnails/17-7b163458e971099e316f1d28f686b01a.jpg\" width=\"200\" height=\"267\">", "<img alt=\"18\" class=\"gallery\" src=\"/assets/thumbnails/18-c2b893d1a1b624bf740afebf1464d78d.jpg\" width=\"200\" height=\"267\">", "<img alt=\"19\" class=\"gallery\" src=\"/assets/thumbnails/19-6ea454cbc4a895408c9ad38dd8edce4e.jpg\" width=\"200\" height=\"267\">", "<img alt=\"20\" class=\"gallery\" src=\"/assets/thumbnails/20-7edabdea6a94e8b70ffc37ee324b9fab.jpg\" width=\"200\" height=\"267\">"])
|
133
|
+
old_htmls.should eq(["<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\">", "<img alt=\"2\" class=\"gallery\" src=\"/assets/thumbnails/2-413bd5c8b6b7263beffbbbad112568fd.jpg\">", "<img alt=\"3\" class=\"gallery\" src=\"/assets/thumbnails/3-50cea3d1ecb37bc0a7158adfee38d020.jpg\">", "<img alt=\"4\" class=\"gallery\" src=\"/assets/thumbnails/4-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg\">", "<img alt=\"5\" class=\"gallery\" src=\"/assets/thumbnails/5-900f1e2e061af1ea2f0ea622d0be5c38.jpg\">", "<img alt=\"6\" class=\"gallery\" src=\"/assets/thumbnails/6-4837c7ac224fc26dd995f4441aa7a458.jpg\">", "<img alt=\"7\" class=\"gallery\" src=\"/assets/thumbnails/7-79120b81863981edf1a997711e8268fb.jpg\">", "<img alt=\"8\" class=\"gallery\" src=\"/assets/thumbnails/8-2057ca29648dc1530b752918f09fba8d.jpg\">", "<img alt=\"9\" class=\"gallery\" src=\"/assets/thumbnails/9-413bd5c8b6b7263beffbbbad112568fd.jpg\">", "<img alt=\"10\" class=\"gallery\" src=\"/assets/thumbnails/10-900f1e2e061af1ea2f0ea622d0be5c38.jpg\">", "<img alt=\"11\" class=\"gallery\" src=\"/assets/thumbnails/11-900f1e2e061af1ea2f0ea622d0be5c38.jpg\">", "<img alt=\"12\" class=\"gallery\" src=\"/assets/thumbnails/12-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg\">", "<img alt=\"13\" class=\"gallery\" src=\"/assets/thumbnails/13-4837c7ac224fc26dd995f4441aa7a458.jpg\">", "<img alt=\"14\" class=\"gallery\" src=\"/assets/thumbnails/14-79120b81863981edf1a997711e8268fb.jpg\">", "<img alt=\"15\" class=\"gallery\" src=\"/assets/thumbnails/15-51330c678115d1236ce46e1ea8e6c019.jpg\">", "<img alt=\"16\" class=\"gallery\" src=\"/assets/thumbnails/16-1883f9ecb69aebe721037b4b19c6cec4.jpg\">", "<img alt=\"17\" class=\"gallery\" src=\"/assets/thumbnails/17-7b163458e971099e316f1d28f686b01a.jpg\">", "<img alt=\"18\" class=\"gallery\" src=\"/assets/thumbnails/18-c2b893d1a1b624bf740afebf1464d78d.jpg\">", "<img alt=\"19\" class=\"gallery\" src=\"/assets/thumbnails/19-6ea454cbc4a895408c9ad38dd8edce4e.jpg\">", "<img alt=\"20\" class=\"gallery\" src=\"/assets/thumbnails/20-7edabdea6a94e8b70ffc37ee324b9fab.jpg\">"])
|
134
|
+
new_post = local_test_file.force_encoding "UTF-8"
|
135
|
+
new_post.should eq(local_test_file)
|
136
|
+
old_htmls.first.should eq("<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\">")
|
137
|
+
new_htmls.first.should eq("<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\" width=\"200\" height=\"266\">")
|
138
|
+
old_htmls.each do |image|
|
139
|
+
image.sub!(">", " />") unless new_post.include? image
|
140
|
+
image.sub!(" />", "/>") unless new_post.include? image
|
141
|
+
end
|
142
|
+
old_htmls.first.should eq("<img alt=\"1\" class=\"gallery\" src=\"/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg\" />")
|
143
|
+
new_post.include?(old_htmls.first).should be(true)
|
144
|
+
old_htmls.each do |old|
|
145
|
+
new_post.sub!(old, new_htmls.shift)
|
146
|
+
end
|
147
|
+
new_post.should eq(results_file)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
end
|
data/spec/results.html
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<div id='gallery'>
|
2
|
+
<a href="/assets/gallery/1-00ddf8ce5eff6b1ba814e42861762ba3.jpg"><img alt="1" class="gallery" src="/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg" width="200" height="266"></a>
|
3
|
+
<a href="/assets/gallery/2-d53fb77c8f41a8f024afd0ae91559f6e.jpg"><img alt="2" class="gallery" src="/assets/thumbnails/2-413bd5c8b6b7263beffbbbad112568fd.jpg" width="200" height="266"></a>
|
4
|
+
<a href="/assets/gallery/3-161da8a490d8b303e514a58bbcc206d4.jpg"><img alt="3" class="gallery" src="/assets/thumbnails/3-50cea3d1ecb37bc0a7158adfee38d020.jpg" width="200" height="266"></a>
|
5
|
+
<a href="/assets/gallery/4-aa69df4395880f01bc9ab63fd8e0ed7d.jpg"><img alt="4" class="gallery" src="/assets/thumbnails/4-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg" width="200" height="266"></a>
|
6
|
+
<a href="/assets/gallery/5-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="5" class="gallery" src="/assets/thumbnails/5-900f1e2e061af1ea2f0ea622d0be5c38.jpg" width="200" height="266"></a>
|
7
|
+
<a href="/assets/gallery/6-72531cf7122d2628fc1436275b44a588.jpg"><img alt="6" class="gallery" src="/assets/thumbnails/6-4837c7ac224fc26dd995f4441aa7a458.jpg" width="200" height="266"></a>
|
8
|
+
<a href="/assets/gallery/7-4a7a7a05eeab9818897e820b106e0f68.jpg"><img alt="7" class="gallery" src="/assets/thumbnails/7-79120b81863981edf1a997711e8268fb.jpg" width="200" height="266"></a>
|
9
|
+
<a href="/assets/gallery/8-00ddf8ce5eff6b1ba814e42861762ba3.jpg"><img alt="8" class="gallery" src="/assets/thumbnails/8-2057ca29648dc1530b752918f09fba8d.jpg" width="200" height="266"></a>
|
10
|
+
<a href="/assets/gallery/9-d53fb77c8f41a8f024afd0ae91559f6e.jpg"><img alt="9" class="gallery" src="/assets/thumbnails/9-413bd5c8b6b7263beffbbbad112568fd.jpg" width="200" height="266"></a>
|
11
|
+
<a href="/assets/gallery/10-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="10" class="gallery" src="/assets/thumbnails/10-900f1e2e061af1ea2f0ea622d0be5c38.jpg" width="200" height="266"></a>
|
12
|
+
<a href="/assets/gallery/11-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="11" class="gallery" src="/assets/thumbnails/11-900f1e2e061af1ea2f0ea622d0be5c38.jpg" width="200" height="266"></a>
|
13
|
+
<a href="/assets/gallery/12-aa69df4395880f01bc9ab63fd8e0ed7d.jpg"><img alt="12" class="gallery" src="/assets/thumbnails/12-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg" width="200" height="266"></a>
|
14
|
+
<a href="/assets/gallery/13-72531cf7122d2628fc1436275b44a588.jpg"><img alt="13" class="gallery" src="/assets/thumbnails/13-4837c7ac224fc26dd995f4441aa7a458.jpg" width="200" height="266"></a>
|
15
|
+
<a href="/assets/gallery/14-4a7a7a05eeab9818897e820b106e0f68.jpg"><img alt="14" class="gallery" src="/assets/thumbnails/14-79120b81863981edf1a997711e8268fb.jpg" width="200" height="266"></a>
|
16
|
+
<a href="/assets/gallery/15-6fce044628982154e4973a09b01e0b10.jpg"><img alt="15" class="gallery" src="/assets/thumbnails/15-51330c678115d1236ce46e1ea8e6c019.jpg" width="200" height="267"></a>
|
17
|
+
<a href="/assets/gallery/16-7ae3cf25358e1875f1573e57e6f4dba5.jpg"><img alt="16" class="gallery" src="/assets/thumbnails/16-1883f9ecb69aebe721037b4b19c6cec4.jpg" width="200" height="267"></a>
|
18
|
+
<a href="/assets/gallery/17-1614a92550727f54beb2cfb0aa486be3.jpg"><img alt="17" class="gallery" src="/assets/thumbnails/17-7b163458e971099e316f1d28f686b01a.jpg" width="200" height="267"></a>
|
19
|
+
<a href="/assets/gallery/18-ab272eb68dd0503398177e807cc8cf45.jpg"><img alt="18" class="gallery" src="/assets/thumbnails/18-c2b893d1a1b624bf740afebf1464d78d.jpg" width="200" height="267"></a>
|
20
|
+
<a href="/assets/gallery/19-9a93d133120b8bc0212049288251c38e.jpg"><img alt="19" class="gallery" src="/assets/thumbnails/19-6ea454cbc4a895408c9ad38dd8edce4e.jpg" width="200" height="267"></a>
|
21
|
+
<a href="/assets/gallery/20-92b6c80cc58d833c7d2095c099d2a2a7.jpg"><img alt="20" class="gallery" src="/assets/thumbnails/20-7edabdea6a94e8b70ffc37ee324b9fab.jpg" width="200" height="267"></a>
|
22
|
+
<div class='clear'></div>
|
23
|
+
</div>
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'attributer'
|
2
|
+
|
3
|
+
def local_test_file
|
4
|
+
path = File.realpath("spec/test.html")
|
5
|
+
string = File.open(path, "rb").read
|
6
|
+
string.force_encoding "UTF-8"
|
7
|
+
end
|
8
|
+
|
9
|
+
def results_file
|
10
|
+
path = File.realpath("spec/results.html")
|
11
|
+
string = File.open(path, "rb").read
|
12
|
+
end
|
13
|
+
|
14
|
+
def local_test_file_2
|
15
|
+
path = File.realpath("spec/test2.html")
|
16
|
+
string = File.open(path, "rb").read
|
17
|
+
string.force_encoding "UTF-8"
|
18
|
+
end
|
data/spec/test.html
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<div id='gallery'>
|
2
|
+
<a href="/assets/gallery/1-00ddf8ce5eff6b1ba814e42861762ba3.jpg"><img alt="1" class="gallery" src="/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg" /></a>
|
3
|
+
<a href="/assets/gallery/2-d53fb77c8f41a8f024afd0ae91559f6e.jpg"><img alt="2" class="gallery" src="/assets/thumbnails/2-413bd5c8b6b7263beffbbbad112568fd.jpg" /></a>
|
4
|
+
<a href="/assets/gallery/3-161da8a490d8b303e514a58bbcc206d4.jpg"><img alt="3" class="gallery" src="/assets/thumbnails/3-50cea3d1ecb37bc0a7158adfee38d020.jpg" /></a>
|
5
|
+
<a href="/assets/gallery/4-aa69df4395880f01bc9ab63fd8e0ed7d.jpg"><img alt="4" class="gallery" src="/assets/thumbnails/4-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg" /></a>
|
6
|
+
<a href="/assets/gallery/5-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="5" class="gallery" src="/assets/thumbnails/5-900f1e2e061af1ea2f0ea622d0be5c38.jpg" /></a>
|
7
|
+
<a href="/assets/gallery/6-72531cf7122d2628fc1436275b44a588.jpg"><img alt="6" class="gallery" src="/assets/thumbnails/6-4837c7ac224fc26dd995f4441aa7a458.jpg" /></a>
|
8
|
+
<a href="/assets/gallery/7-4a7a7a05eeab9818897e820b106e0f68.jpg"><img alt="7" class="gallery" src="/assets/thumbnails/7-79120b81863981edf1a997711e8268fb.jpg" /></a>
|
9
|
+
<a href="/assets/gallery/8-00ddf8ce5eff6b1ba814e42861762ba3.jpg"><img alt="8" class="gallery" src="/assets/thumbnails/8-2057ca29648dc1530b752918f09fba8d.jpg" /></a>
|
10
|
+
<a href="/assets/gallery/9-d53fb77c8f41a8f024afd0ae91559f6e.jpg"><img alt="9" class="gallery" src="/assets/thumbnails/9-413bd5c8b6b7263beffbbbad112568fd.jpg" /></a>
|
11
|
+
<a href="/assets/gallery/10-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="10" class="gallery" src="/assets/thumbnails/10-900f1e2e061af1ea2f0ea622d0be5c38.jpg" /></a>
|
12
|
+
<a href="/assets/gallery/11-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="11" class="gallery" src="/assets/thumbnails/11-900f1e2e061af1ea2f0ea622d0be5c38.jpg" /></a>
|
13
|
+
<a href="/assets/gallery/12-aa69df4395880f01bc9ab63fd8e0ed7d.jpg"><img alt="12" class="gallery" src="/assets/thumbnails/12-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg" /></a>
|
14
|
+
<a href="/assets/gallery/13-72531cf7122d2628fc1436275b44a588.jpg"><img alt="13" class="gallery" src="/assets/thumbnails/13-4837c7ac224fc26dd995f4441aa7a458.jpg" /></a>
|
15
|
+
<a href="/assets/gallery/14-4a7a7a05eeab9818897e820b106e0f68.jpg"><img alt="14" class="gallery" src="/assets/thumbnails/14-79120b81863981edf1a997711e8268fb.jpg" /></a>
|
16
|
+
<a href="/assets/gallery/15-6fce044628982154e4973a09b01e0b10.jpg"><img alt="15" class="gallery" src="/assets/thumbnails/15-51330c678115d1236ce46e1ea8e6c019.jpg" /></a>
|
17
|
+
<a href="/assets/gallery/16-7ae3cf25358e1875f1573e57e6f4dba5.jpg"><img alt="16" class="gallery" src="/assets/thumbnails/16-1883f9ecb69aebe721037b4b19c6cec4.jpg" /></a>
|
18
|
+
<a href="/assets/gallery/17-1614a92550727f54beb2cfb0aa486be3.jpg"><img alt="17" class="gallery" src="/assets/thumbnails/17-7b163458e971099e316f1d28f686b01a.jpg" /></a>
|
19
|
+
<a href="/assets/gallery/18-ab272eb68dd0503398177e807cc8cf45.jpg"><img alt="18" class="gallery" src="/assets/thumbnails/18-c2b893d1a1b624bf740afebf1464d78d.jpg" /></a>
|
20
|
+
<a href="/assets/gallery/19-9a93d133120b8bc0212049288251c38e.jpg"><img alt="19" class="gallery" src="/assets/thumbnails/19-6ea454cbc4a895408c9ad38dd8edce4e.jpg" /></a>
|
21
|
+
<a href="/assets/gallery/20-92b6c80cc58d833c7d2095c099d2a2a7.jpg"><img alt="20" class="gallery" src="/assets/thumbnails/20-7edabdea6a94e8b70ffc37ee324b9fab.jpg" /></a>
|
22
|
+
<div class='clear'></div>
|
23
|
+
</div>
|
data/spec/test.png
ADDED
Binary file
|
data/spec/test2.html
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<div id='gallery'>
|
2
|
+
<a href="/assets/gallery/1-00ddf8ce5eff6b1ba814e42861762ba3.jpg"><img alt="1" class="gallery" src="/assets/thumbnails/1-2057ca29648dc1530b752918f09fba8d.jpg"></a>
|
3
|
+
<a href="/assets/gallery/2-d53fb77c8f41a8f024afd0ae91559f6e.jpg"><img alt="2" class="gallery" src="/assets/thumbnails/2-413bd5c8b6b7263beffbbbad112568fd.jpg"></a>
|
4
|
+
<a href="/assets/gallery/3-161da8a490d8b303e514a58bbcc206d4.jpg"><img alt="3" class="gallery" src="/assets/thumbnails/3-50cea3d1ecb37bc0a7158adfee38d020.jpg"></a>
|
5
|
+
<a href="/assets/gallery/4-aa69df4395880f01bc9ab63fd8e0ed7d.jpg"><img alt="4" class="gallery" src="/assets/thumbnails/4-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg"></a>
|
6
|
+
<a href="/assets/gallery/5-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="5" class="gallery" src="/assets/thumbnails/5-900f1e2e061af1ea2f0ea622d0be5c38.jpg"></a>
|
7
|
+
<a href="/assets/gallery/6-72531cf7122d2628fc1436275b44a588.jpg"><img alt="6" class="gallery" src="/assets/thumbnails/6-4837c7ac224fc26dd995f4441aa7a458.jpg"></a>
|
8
|
+
<a href="/assets/gallery/7-4a7a7a05eeab9818897e820b106e0f68.jpg"><img alt="7" class="gallery" src="/assets/thumbnails/7-79120b81863981edf1a997711e8268fb.jpg"></a>
|
9
|
+
<a href="/assets/gallery/8-00ddf8ce5eff6b1ba814e42861762ba3.jpg"><img alt="8" class="gallery" src="/assets/thumbnails/8-2057ca29648dc1530b752918f09fba8d.jpg"></a>
|
10
|
+
<a href="/assets/gallery/9-d53fb77c8f41a8f024afd0ae91559f6e.jpg"><img alt="9" class="gallery" src="/assets/thumbnails/9-413bd5c8b6b7263beffbbbad112568fd.jpg"></a>
|
11
|
+
<a href="/assets/gallery/10-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="10" class="gallery" src="/assets/thumbnails/10-900f1e2e061af1ea2f0ea622d0be5c38.jpg"></a>
|
12
|
+
<a href="/assets/gallery/11-eab72fa06f26bb2b92f94feece17cdc8.jpg"><img alt="11" class="gallery" src="/assets/thumbnails/11-900f1e2e061af1ea2f0ea622d0be5c38.jpg"></a>
|
13
|
+
<a href="/assets/gallery/12-aa69df4395880f01bc9ab63fd8e0ed7d.jpg"><img alt="12" class="gallery" src="/assets/thumbnails/12-a958b0ef2ef3ef8419736ef9aa5f9f6a.jpg"></a>
|
14
|
+
<a href="/assets/gallery/13-72531cf7122d2628fc1436275b44a588.jpg"><img alt="13" class="gallery" src="/assets/thumbnails/13-4837c7ac224fc26dd995f4441aa7a458.jpg"></a>
|
15
|
+
<a href="/assets/gallery/14-4a7a7a05eeab9818897e820b106e0f68.jpg"><img alt="14" class="gallery" src="/assets/thumbnails/14-79120b81863981edf1a997711e8268fb.jpg"></a>
|
16
|
+
<a href="/assets/gallery/15-6fce044628982154e4973a09b01e0b10.jpg"><img alt="15" class="gallery" src="/assets/thumbnails/15-51330c678115d1236ce46e1ea8e6c019.jpg"></a>
|
17
|
+
<a href="/assets/gallery/16-7ae3cf25358e1875f1573e57e6f4dba5.jpg"><img alt="16" class="gallery" src="/assets/thumbnails/16-1883f9ecb69aebe721037b4b19c6cec4.jpg"></a>
|
18
|
+
<a href="/assets/gallery/17-1614a92550727f54beb2cfb0aa486be3.jpg"><img alt="17" class="gallery" src="/assets/thumbnails/17-7b163458e971099e316f1d28f686b01a.jpg"></a>
|
19
|
+
<a href="/assets/gallery/18-ab272eb68dd0503398177e807cc8cf45.jpg"><img alt="18" class="gallery" src="/assets/thumbnails/18-c2b893d1a1b624bf740afebf1464d78d.jpg"></a>
|
20
|
+
<a href="/assets/gallery/19-9a93d133120b8bc0212049288251c38e.jpg"><img alt="19" class="gallery" src="/assets/thumbnails/19-6ea454cbc4a895408c9ad38dd8edce4e.jpg"></a>
|
21
|
+
<a href="/assets/gallery/20-92b6c80cc58d833c7d2095c099d2a2a7.jpg"><img alt="20" class="gallery" src="/assets/thumbnails/20-7edabdea6a94e8b70ffc37ee324b9fab.jpg"></a>
|
22
|
+
<div class='clear'></div>
|
23
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: attributer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Svilen Vassilev
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: guard
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: libnotify
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: fastimage
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.2.13
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.2.13
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: nokogiri
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.5.6
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.5.6
|
126
|
+
description: Ruby gem for adding width and height attributes to image tags within
|
127
|
+
HTML blocks
|
128
|
+
email:
|
129
|
+
- svilen@rubystudio.net
|
130
|
+
executables: []
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- .gitignore
|
135
|
+
- .travis.yml
|
136
|
+
- CONTRIBUTING.md
|
137
|
+
- Gemfile
|
138
|
+
- Guardfile
|
139
|
+
- LICENSE.txt
|
140
|
+
- README.md
|
141
|
+
- Rakefile
|
142
|
+
- attributer.gemspec
|
143
|
+
- lib/attributer.rb
|
144
|
+
- lib/attributer/version.rb
|
145
|
+
- spec/attributer_spec.rb
|
146
|
+
- spec/results.html
|
147
|
+
- spec/spec_helper.rb
|
148
|
+
- spec/test.html
|
149
|
+
- spec/test.png
|
150
|
+
- spec/test2.html
|
151
|
+
homepage: https://github.com/tarakanbg/attributer
|
152
|
+
licenses: []
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 1.8.24
|
172
|
+
signing_key:
|
173
|
+
specification_version: 3
|
174
|
+
summary: Ruby gem for adding width and height attributes to image tags within HTML
|
175
|
+
blocks
|
176
|
+
test_files:
|
177
|
+
- spec/attributer_spec.rb
|
178
|
+
- spec/results.html
|
179
|
+
- spec/spec_helper.rb
|
180
|
+
- spec/test.html
|
181
|
+
- spec/test.png
|
182
|
+
- spec/test2.html
|