auto_html 1.3.4 → 1.3.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.
- data/README.md +1 -3
- data/lib/auto_html/filters/image.rb +1 -1
- data/lib/auto_html/filters/redcloth.rb +9 -0
- data/lib/auto_html.rb +1 -2
- data/test/functional/auto_html_for_options_test.rb +3 -3
- data/test/functional/auto_html_for_test.rb +2 -2
- data/test/functional/filter_test.rb +3 -3
- data/test/unit/auto_html_test.rb +7 -1
- data/test/unit/filters/dailymotion_test.rb +1 -1
- data/test/unit/filters/google_video_test.rb +1 -1
- data/test/unit/filters/html_escape_test.rb +1 -1
- data/test/unit/filters/image_test.rb +6 -1
- data/test/unit/filters/link_test.rb +1 -1
- data/test/unit/filters/metacafe_test.rb +1 -1
- data/test/unit/filters/redcloth_test.rb +25 -0
- data/test/unit/filters/sanitize_test.rb +1 -1
- data/test/unit/filters/simple_format_test.rb +1 -1
- data/test/unit/filters/vimeo_test.rb +1 -1
- data/test/unit/filters/youtube_js_api_test.rb +1 -1
- data/test/unit/filters/youtube_test.rb +1 -1
- metadata +21 -6
data/README.md
CHANGED
@@ -71,8 +71,6 @@ As from version 1.2.0 auto_html uses Rails' engine for discovering links. There
|
|
71
71
|
for Rails <= 2.3.1 use auto_html 1.1.2<br/>
|
72
72
|
for Rails >= 2.3.2 use the latest auto_html
|
73
73
|
|
74
|
-
As of version 1.3.0, auto_html has been tested to work with Rails 3 and Ruby 1.9.
|
75
|
-
|
76
74
|
### As a gem
|
77
75
|
|
78
76
|
To enable the library in your Rails 2.1-2.3 project, use the gem configuration method in "config/environment.rb"
|
@@ -93,4 +91,4 @@ In Rails 3.0 specify the gem in your Gemfile
|
|
93
91
|
## Credits
|
94
92
|
|
95
93
|
Author: [Dejan Simic](http://github.com/dejan)<br/>
|
96
|
-
Contributors: [Claudio Perez Gamayo](http://github.com/crossblaim), [Matt Polito](http://github.com/mattpolito), [Ryan Heneise](http://github.com/mysmallidea), [Caleb Wright](http://github.com/fabrikagency), [Derrick Camerino](https://github.com/robustdj)
|
94
|
+
Contributors: [Claudio Perez Gamayo](http://github.com/crossblaim), [Matt Polito](http://github.com/mattpolito), [Ryan Heneise](http://github.com/mysmallidea), [Caleb Wright](http://github.com/fabrikagency), [Derrick Camerino](https://github.com/robustdj), [Daniel Weinmann](https://github.com/danielweinmann)
|
data/lib/auto_html.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
%w(base filter builder auto_html_for).each do |f|
|
2
|
-
require File.
|
2
|
+
require File.expand_path("../auto_html/#{f}", __FILE__)
|
3
3
|
end
|
4
4
|
|
5
|
-
# Register built-in filters
|
6
5
|
Dir["#{File.dirname(__FILE__) + '/auto_html/filters'}/**/*"].each do |filter|
|
7
6
|
require "#{filter}"
|
8
7
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require File.
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
require File.expand_path('../../fixture_setup', __FILE__)
|
3
3
|
|
4
4
|
# store default so we can revert so that other tests use default option
|
5
5
|
default_suffix = AutoHtmlFor.auto_html_for_options[:htmlized_attribute_suffix]
|
@@ -11,7 +11,7 @@ class Article < ActiveRecord::Base
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
class
|
14
|
+
class AutoHtmlForOptionsTest < Test::Unit::TestCase
|
15
15
|
include FixtureSetup
|
16
16
|
|
17
17
|
def test_transform_after_save
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require File.
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
require File.expand_path('../../fixture_setup', __FILE__)
|
3
3
|
|
4
4
|
class Article < ActiveRecord::Base
|
5
5
|
auto_html_for :body do
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.
|
2
|
-
require File.
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
require File.expand_path('../../fixture_setup', __FILE__)
|
3
3
|
|
4
4
|
AutoHtml.add_filter(:foo) do |text|
|
5
5
|
nil
|
@@ -17,7 +17,7 @@ class User < ActiveRecord::Base
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
class
|
20
|
+
class FilterTest < Test::Unit::TestCase
|
21
21
|
include FixtureSetup
|
22
22
|
|
23
23
|
def test_transform_after_save
|
data/test/unit/auto_html_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../unit_test_helper', __FILE__)
|
2
|
+
|
2
3
|
|
3
4
|
class AutoHtmlTest < Test::Unit::TestCase
|
4
5
|
|
@@ -22,6 +23,11 @@ class AutoHtmlTest < Test::Unit::TestCase
|
|
22
23
|
assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" alt=""/>. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a></p>', result
|
23
24
|
end
|
24
25
|
|
26
|
+
def test_should_apply_simple_format_image_and_redcloth_and_link_filter
|
27
|
+
result = auto_html('Check the logo: http://rors.org/images/rails.png. Visit: http://rubyonrails.org and "Read the Guides":http://guides.rubyonrails.org/') { simple_format; image; redcloth; link }
|
28
|
+
assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" alt=""/>. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a> and <a href="http://guides.rubyonrails.org/">Read the Guides</a></p>', result
|
29
|
+
end
|
30
|
+
|
25
31
|
def test_should_return_blank_if_input_is_blank
|
26
32
|
result = auto_html("") { simple_format; image; link }
|
27
33
|
assert_equal "", result
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../unit_test_helper', __FILE__)
|
2
2
|
|
3
3
|
class ImageTest < Test::Unit::TestCase
|
4
4
|
|
@@ -42,4 +42,9 @@ class ImageTest < Test::Unit::TestCase
|
|
42
42
|
assert_equal '<img src="http://tbn3.google.com/images?q=tbn:vS-jtEi9Xc8K6M:http://upload.wikimedia.org/wikipedia/commons/b/ba/Potturinn.jpeg" alt=""/>', result
|
43
43
|
end
|
44
44
|
|
45
|
+
def test_https
|
46
|
+
result = auto_html('https://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png') { image }
|
47
|
+
assert_equal '<img src="https://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png" alt=""/>', result
|
48
|
+
end
|
49
|
+
|
45
50
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../../unit_test_helper', __FILE__)
|
2
|
+
|
3
|
+
class RedClothTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_transform_strong
|
6
|
+
result = auto_html("This is *my* text.") { redcloth }
|
7
|
+
assert_equal '<p>This is <strong>my</strong> text.</p>', result
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_transform_title
|
11
|
+
result = auto_html("h2. This is a title") { redcloth }
|
12
|
+
assert_equal '<h2>This is a title</h2>', result
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_transform_link
|
16
|
+
result = auto_html('"This is a link (This is a title)":http://www.textism.com') { redcloth }
|
17
|
+
assert_equal '<p><a href="http://www.textism.com" title="This is a title">This is a link</a></p>', result
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_transform_link_target_blank
|
21
|
+
result = auto_html('"This is a link (This is a title)":http://www.textism.com') { redcloth :target => :_blank }
|
22
|
+
assert_equal '<p><a target="_blank" href="http://www.textism.com" title="This is a title">This is a link</a></p>', result
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 5
|
10
|
+
version: 1.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dejan Simic
|
@@ -15,10 +15,23 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-30 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: redcloth
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
22
35
|
description: Automatically transforms URIs (via domain) and includes the destination resource (Vimeo, YouTube movie, image, ...) in your document
|
23
36
|
email: desimic@gmail.com
|
24
37
|
executables: []
|
@@ -39,6 +52,7 @@ files:
|
|
39
52
|
- lib/auto_html/filters/image.rb
|
40
53
|
- lib/auto_html/filters/link.rb
|
41
54
|
- lib/auto_html/filters/metacafe.rb
|
55
|
+
- lib/auto_html/filters/redcloth.rb
|
42
56
|
- lib/auto_html/filters/sanitize.rb
|
43
57
|
- lib/auto_html/filters/simple_format.rb
|
44
58
|
- lib/auto_html/filters/vimeo.rb
|
@@ -59,6 +73,7 @@ files:
|
|
59
73
|
- test/unit/filters/image_test.rb
|
60
74
|
- test/unit/filters/link_test.rb
|
61
75
|
- test/unit/filters/metacafe_test.rb
|
76
|
+
- test/unit/filters/redcloth_test.rb
|
62
77
|
- test/unit/filters/sanitize_test.rb
|
63
78
|
- test/unit/filters/simple_format_test.rb
|
64
79
|
- test/unit/filters/vimeo_test.rb
|