auto_html 1.4.2 → 1.5.0
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 +12 -1
- data/lib/auto_html.rb +2 -1
- data/lib/auto_html/capistrano.rb +17 -0
- data/lib/auto_html/filters/image.rb +10 -2
- data/lib/auto_html/filters/link.rb +3 -2
- data/lib/auto_html/filters/redcarpet.rb +2 -6
- data/lib/auto_html/filters/youtube.rb +8 -5
- data/lib/auto_html/railtie.rb +10 -0
- data/lib/auto_html/rake_tasks.rb +30 -0
- data/lib/auto_html/task.rb +9 -0
- data/test/unit/auto_html_test.rb +2 -7
- data/test/unit/filters/image_test.rb +8 -8
- data/test/unit/filters/link_test.rb +1 -1
- data/test/unit/filters/redcarpet_test.rb +8 -2
- data/test/unit/filters/youtube_test.rb +18 -16
- metadata +19 -41
- data/lib/auto_html/filters/redcloth.rb +0 -9
- data/test/unit/filters/redcloth_test.rb +0 -25
data/README.md
CHANGED
@@ -72,6 +72,17 @@ AutoHtml uses standard ActiveModel API, which means that you can include AutoHtm
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
## Rake and Capistrano tasks
|
76
|
+
|
77
|
+
AutoHtml has a Rake task for rebuilding cached in DB column values
|
78
|
+
Usage: `rake auto_html:rebuild CLASS=[your model]`
|
79
|
+
Where `[your model]` is the name of model which values you want to rebuild.
|
80
|
+
|
81
|
+
If you want to run it on remote server, just add this to your `deploy.rb`:
|
82
|
+
|
83
|
+
require 'auto_html/capistrano'
|
84
|
+
|
85
|
+
Now you can run `cap auto_html:rebuild CLASS=[your_model]`.
|
75
86
|
|
76
87
|
## Bundled filters
|
77
88
|
|
@@ -88,4 +99,4 @@ Specify the gem in Gemfile of the project
|
|
88
99
|
## Credits
|
89
100
|
|
90
101
|
Author: [Dejan Simic](http://github.com/dejan)<br/>
|
91
|
-
Contributors: [Claudio Perez Gamayo](https://github.com/crossblaim), [Matt Polito](https://github.com/mattpolito), [Ryan Heneise](https://github.com/mysmallidea), [Caleb Wright](https://github.com/fabrikagency), [Derrick Camerino](https://github.com/robustdj), [Daniel Weinmann](https://github.com/danielweinmann), [Edgars Beigarts](https://github.com/ebeigarts), [Henning Thies](https://github.com/henningthies), [rbq](https://github.com/
|
102
|
+
Contributors: [Claudio Perez Gamayo](https://github.com/crossblaim), [Matt Polito](https://github.com/mattpolito), [Ryan Heneise](https://github.com/mysmallidea), [Caleb Wright](https://github.com/fabrikagency), [Derrick Camerino](https://github.com/robustdj), [Daniel Weinmann](https://github.com/danielweinmann), [Edgars Beigarts](https://github.com/ebeigarts), [Henning Thies](https://github.com/henningthies), [rbq](https://github.com/rbq), [Kir Shatrov](https://github.com/kirs) ([Evrone Company](https://github.com/evrone)), [Demange Anthony](https://github.com/tinoutinou), [Hinrik Örn Sigurðsson](https://github.com/hinrik)
|
data/lib/auto_html.rb
CHANGED
@@ -7,10 +7,11 @@ Dir["#{File.dirname(__FILE__) + '/auto_html/filters'}/**/*"].each do |filter|
|
|
7
7
|
end
|
8
8
|
|
9
9
|
# if rails
|
10
|
+
require 'auto_html/railtie' if defined?(Rails::Railtie)
|
10
11
|
if defined?(ActiveRecord::Base)
|
11
12
|
ActiveRecord::Base.send :include, AutoHtmlFor
|
12
13
|
|
13
14
|
module ActionView::Helpers::TextHelper
|
14
15
|
include AutoHtml
|
15
16
|
end
|
16
|
-
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'auto_html/task'
|
2
|
+
|
3
|
+
# Capistrano task for AutoHtml.
|
4
|
+
# Just add:
|
5
|
+
|
6
|
+
# require 'auto_html/capistrano'
|
7
|
+
# in your Capistrano deploy.rb, you will have AutoHtml rake task in Capistrano
|
8
|
+
|
9
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
10
|
+
namespace :auto_html do
|
11
|
+
desc "Rebuild auto_html columns"
|
12
|
+
task :rebuild do
|
13
|
+
klass = AutoHtml::Task.obtain_class
|
14
|
+
run "cd #{current_path} && bundle exec rake auto_html:rebuild CLASS=#{klass} RAILS_ENV=#{rails_env}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,7 +1,15 @@
|
|
1
|
-
require '
|
1
|
+
require 'redcarpet'
|
2
|
+
|
3
|
+
class NoParagraphRenderer < ::Redcarpet::Render::XHTML
|
4
|
+
def paragraph(text)
|
5
|
+
text
|
6
|
+
end
|
7
|
+
end
|
2
8
|
|
3
9
|
AutoHtml.add_filter(:image).with({:alt => ''}) do |text, options|
|
10
|
+
r = Redcarpet::Markdown.new(NoParagraphRenderer)
|
11
|
+
alt = options[:alt]
|
4
12
|
text.gsub(/https?:\/\/.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match|
|
5
|
-
|
13
|
+
r.render("")
|
6
14
|
end
|
7
15
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rinku'
|
2
|
-
require '
|
2
|
+
require 'rexml/document'
|
3
3
|
|
4
4
|
AutoHtml.add_filter(:link).with({}) do |text, options|
|
5
|
-
|
5
|
+
attributes = Array(options).reject { |k,v| v.nil? }.map { |k, v| %{#{k}="#{REXML::Text::normalize(v)}"} }.join(' ')
|
6
|
+
Rinku.auto_link(text, :all, attributes)
|
6
7
|
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'redcarpet'
|
2
2
|
|
3
|
-
AutoHtml.add_filter(:redcarpet).with(
|
4
|
-
|
5
|
-
if options and options[:target] and options[:target].to_sym == :_blank
|
6
|
-
result.gsub!(/<a/,'<a target="_blank"')
|
7
|
-
end
|
8
|
-
result
|
3
|
+
AutoHtml.add_filter(:redcarpet).with(:renderer => Redcarpet::Render::HTML) do |text, options|
|
4
|
+
Redcarpet::Markdown.new(options[:renderer]).render(text)
|
9
5
|
end
|
@@ -1,12 +1,15 @@
|
|
1
|
-
AutoHtml.add_filter(:youtube).with(:width =>
|
2
|
-
regex = /
|
1
|
+
AutoHtml.add_filter(:youtube).with(:width => 420, :height => 315, :frameborder => 0, :wmode => nil) do |text, options|
|
2
|
+
regex = /(https?):\/\/(www.)?(youtube\.com\/watch\?v=|youtu\.be\/)([A-Za-z0-9_-]*)(\&\S+)?.*/
|
3
3
|
text.gsub(regex) do
|
4
|
-
|
4
|
+
protocol = $1
|
5
|
+
youtube_id = $4
|
5
6
|
width = options[:width]
|
6
7
|
height = options[:height]
|
7
8
|
frameborder = options[:frameborder]
|
8
|
-
|
9
|
-
|
9
|
+
wmode = options[:wmode]
|
10
|
+
src = "#{protocol}://www.youtube.com/embed/#{youtube_id}"
|
11
|
+
src += "?wmode=#{wmode}" if wmode
|
12
|
+
%{<iframe width="#{width}" height="#{height}" src="#{src}" frameborder="#{frameborder}" allowfullscreen></iframe>}
|
10
13
|
end
|
11
14
|
end
|
12
15
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'auto_html/task'
|
2
|
+
|
3
|
+
# Rake task for rebuilding cached in DB auto_html columns values
|
4
|
+
# Usage: rake auto_html:rebuild CLASS=[your model]
|
5
|
+
# Where [your model] is the name of model which contains auto_html_for columns
|
6
|
+
|
7
|
+
namespace :auto_html do
|
8
|
+
desc "Rebuild auto_html columns"
|
9
|
+
task :rebuild => :environment do
|
10
|
+
klass = AutoHtml::Task.obtain_class.constantize
|
11
|
+
i = 0
|
12
|
+
auto_html_fields = []
|
13
|
+
klass.find_each do |item|
|
14
|
+
unless auto_html_fields.any?
|
15
|
+
auto_html_methods = item.methods.select { |m| m=~/^auto_html_prepare_/ }
|
16
|
+
auto_html_methods.each do |method|
|
17
|
+
auto_html_fields << method
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
auto_html_fields.each do |field|
|
22
|
+
item.send(field)
|
23
|
+
end
|
24
|
+
|
25
|
+
item.save
|
26
|
+
i += 1
|
27
|
+
end
|
28
|
+
puts "Done! Processed #{pluralize(i, 'item')}."
|
29
|
+
end
|
30
|
+
end
|
data/test/unit/auto_html_test.rb
CHANGED
@@ -16,19 +16,14 @@ class AutoHtmlTest < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
def test_should_apply_simple_format_and_image_filter
|
18
18
|
result = auto_html("Check the logo: http://rors.org/images/rails.png") { simple_format; image(:alt => nil) }
|
19
|
-
assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" /></p>', result
|
19
|
+
assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" alt=""/></p>', result
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_should_apply_simple_format_image_and_link_filter
|
23
23
|
result = auto_html("Check the logo: http://rors.org/images/rails.png. Visit: http://rubyonrails.org") { simple_format; image(:alt => nil); link }
|
24
|
-
assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" />. Visit: <a href="http://rubyonrails.org" >http://rubyonrails.org</a></p>', result
|
24
|
+
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
|
25
25
|
end
|
26
26
|
|
27
|
-
def test_should_apply_simple_format_image_and_redcloth_and_link_filter
|
28
|
-
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(:alt => nil); redcloth; link }
|
29
|
-
assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" />. Visit: <a href="http://rubyonrails.org" >http://rubyonrails.org</a> and <a href="http://guides.rubyonrails.org/">Read the Guides</a></p>', result
|
30
|
-
end
|
31
|
-
|
32
27
|
def test_should_return_blank_if_input_is_blank
|
33
28
|
result = auto_html("") { simple_format; image(:alt => nil); link }
|
34
29
|
assert_equal "", result
|
@@ -4,7 +4,7 @@ class ImageTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def test_transform
|
6
6
|
result = auto_html('http://rors.org/images/rails.png') { image({:alt => nil}) }
|
7
|
-
assert_equal '<img src="http://rors.org/images/rails.png" />', result
|
7
|
+
assert_equal '<img src="http://rors.org/images/rails.png" alt=""/>', result
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_dont_transform
|
@@ -14,37 +14,37 @@ class ImageTest < Test::Unit::TestCase
|
|
14
14
|
|
15
15
|
def test_transform2
|
16
16
|
result = auto_html('http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg') { image({:alt => nil}) }
|
17
|
-
assert_equal '<img src="http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg" />', result
|
17
|
+
assert_equal '<img src="http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg" alt=""/>', result
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_transform3
|
21
21
|
result = auto_html('http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG') { image({:alt => nil}) }
|
22
|
-
assert_equal '<img src="http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG" />', result
|
22
|
+
assert_equal '<img src="http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG" alt=""/>', result
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_transform4
|
26
26
|
result = auto_html('http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG') { image({:alt => nil}) }
|
27
|
-
assert_equal '<img src="http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG" />', result
|
27
|
+
assert_equal '<img src="http://www.lockhartfineart.com/images/Rio_Grande_Frost.JPG" alt=""/>', result
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_transform5
|
31
31
|
result = auto_html('http://farm4.static.flickr.com/3664/3512431377_71b8d002ef.jpg?v=0') { image({:alt => nil}) }
|
32
|
-
assert_equal '<img src="http://farm4.static.flickr.com/3664/3512431377_71b8d002ef.jpg?v=0" />', result
|
32
|
+
assert_equal '<img src="http://farm4.static.flickr.com/3664/3512431377_71b8d002ef.jpg?v=0" alt=""/>', result
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_transform6
|
36
36
|
result = auto_html('Do you like this logo http://rors.org/images/rails.png? Yeah?') { image({:alt => nil}) }
|
37
|
-
assert_equal 'Do you like this logo <img src="http://rors.org/images/rails.png" />? Yeah?', result
|
37
|
+
assert_equal 'Do you like this logo <img src="http://rors.org/images/rails.png" alt=""/>? Yeah?', result
|
38
38
|
end
|
39
39
|
|
40
40
|
def test_transform7
|
41
41
|
result = auto_html('http://tbn3.google.com/images?q=tbn:vS-jtEi9Xc8K6M:http://upload.wikimedia.org/wikipedia/commons/b/ba/Potturinn.jpeg') { image({:alt => nil}) }
|
42
|
-
assert_equal '<img src="http://tbn3.google.com/images?q=tbn:vS-jtEi9Xc8K6M:http://upload.wikimedia.org/wikipedia/commons/b/ba/Potturinn.jpeg" />', result
|
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
45
|
def test_https
|
46
46
|
result = auto_html('https://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png') { image({:alt => nil}) }
|
47
|
-
assert_equal '<img src="https://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png" />', result
|
47
|
+
assert_equal '<img src="https://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png" alt=""/>', result
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -35,7 +35,7 @@ class LinkTest < Test::Unit::TestCase
|
|
35
35
|
def test_transform_complex_url
|
36
36
|
url = 'http://www.google.com/#q=nikola+tesla&ct=tesla09&oi=ddle&fp=Xmf0jJ9P_V0'
|
37
37
|
# uses auto_link instead raw to support both Rails 2 & 3
|
38
|
-
assert_equal('<a href="http://www.google.com/#q=nikola+tesla&
|
38
|
+
assert_equal('<a href="http://www.google.com/#q=nikola+tesla&ct=tesla09&oi=ddle&fp=Xmf0jJ9P_V0" >http://www.google.com/#q=nikola+tesla&ct=tesla09&oi=ddle&fp=Xmf0jJ9P_V0</a>', auto_html(url) { link })
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_transform_with_options
|
@@ -17,9 +17,15 @@ class RedcarpetTest < Test::Unit::TestCase
|
|
17
17
|
assert_equal '<p><a href="http://example.org/">This is a link</a></p>'+"\n", result
|
18
18
|
end
|
19
19
|
|
20
|
+
class LinksInNewWindow < ::Redcarpet::Render::HTML
|
21
|
+
def link(link, title, content)
|
22
|
+
"<a href=\"#{link}\" target=\"_blank\">#{content}</a>"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
20
26
|
def test_transform_link_target_blank
|
21
|
-
result = auto_html('[This is a link](http://example.org/)') { redcarpet
|
22
|
-
assert_equal '<p><a
|
27
|
+
result = auto_html('[This is a link](http://example.org/)') { redcarpet(:renderer => LinksInNewWindow) }
|
28
|
+
assert_equal '<p><a href="http://example.org/" target="_blank">This is a link</a></p>'+"\n", result
|
23
29
|
end
|
24
30
|
|
25
31
|
end
|
@@ -4,39 +4,41 @@ class YouTubeTest < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def test_transform
|
6
6
|
result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o') { youtube }
|
7
|
-
assert_equal '<iframe
|
8
|
-
</iframe>', result
|
7
|
+
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
|
9
8
|
end
|
10
9
|
|
11
10
|
def test_transform2
|
12
11
|
result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o&eurl=http%3A%2F%2Fvukajlija.com%2Fvideo%2Fklipovi%3Fstrana%3D6&feature=player_embedded') { youtube }
|
13
|
-
assert_equal '<iframe
|
14
|
-
</iframe>', result
|
12
|
+
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
|
15
13
|
end
|
16
14
|
|
17
15
|
def test_transform3
|
18
16
|
result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o&feature=related') { youtube }
|
19
|
-
assert_equal '<iframe
|
20
|
-
</iframe>', result
|
17
|
+
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
|
21
18
|
end
|
22
19
|
|
23
20
|
def test_transform_url_without_www
|
24
21
|
result = auto_html('http://youtube.com/watch?v=BwNrmYRiX_o') { youtube }
|
25
|
-
assert_equal '<iframe
|
26
|
-
</iframe>', result
|
22
|
+
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
|
27
23
|
end
|
28
24
|
|
29
25
|
def test_transform_with_options
|
30
|
-
result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o') { youtube(:width => 300, :height => 255, :frameborder => 1) }
|
31
|
-
assert_equal '<iframe
|
32
|
-
</iframe>', result
|
26
|
+
result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o') { youtube(:width => 300, :height => 255, :frameborder => 1, :wmode => 'window') }
|
27
|
+
assert_equal '<iframe width="300" height="255" src="http://www.youtube.com/embed/BwNrmYRiX_o?wmode=window" frameborder="1" allowfullscreen></iframe>', result
|
33
28
|
end
|
34
|
-
|
35
|
-
|
29
|
+
|
36
30
|
def test_transform_with_short_url
|
37
31
|
result = auto_html('http://www.youtu.be/BwNrmYRiX_o') { youtube }
|
38
|
-
assert_equal '<iframe
|
39
|
-
|
32
|
+
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_transform_https
|
36
|
+
result = auto_html("https://www.youtube.com/watch?v=t7NdBIA4zJg") { youtube }
|
37
|
+
assert_equal '<iframe width="420" height="315" src="https://www.youtube.com/embed/t7NdBIA4zJg" frameborder="0" allowfullscreen></iframe>', result
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_short_with_params
|
41
|
+
result = auto_html("http://youtu.be/t7NdBIA4zJg?t=1s&hd=1") { youtube }
|
42
|
+
assert_equal '<iframe width="420" height="315" src="http://www.youtube.com/embed/t7NdBIA4zJg" frameborder="0" allowfullscreen></iframe>', result
|
40
43
|
end
|
41
|
-
|
42
44
|
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dejan Simic
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08
|
18
|
+
date: 2011-12-08 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,56 +24,32 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
hash: 3
|
30
30
|
segments:
|
31
|
+
- 1
|
32
|
+
- 5
|
31
33
|
- 0
|
32
|
-
version:
|
34
|
+
version: 1.5.0
|
33
35
|
type: :runtime
|
34
36
|
version_requirements: *id001
|
35
37
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
38
|
+
name: redcarpet
|
37
39
|
prerelease: false
|
38
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
42
|
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
47
|
-
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: RedCloth
|
51
|
-
prerelease: false
|
52
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
43
|
+
- - ~>
|
56
44
|
- !ruby/object:Gem::Version
|
57
|
-
hash:
|
45
|
+
hash: 15
|
58
46
|
segments:
|
47
|
+
- 2
|
59
48
|
- 0
|
60
|
-
version: "0"
|
61
|
-
type: :runtime
|
62
|
-
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: redcarpet
|
65
|
-
prerelease: false
|
66
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
49
|
- 0
|
74
|
-
version:
|
50
|
+
version: 2.0.0
|
75
51
|
type: :runtime
|
76
|
-
version_requirements: *
|
52
|
+
version_requirements: *id002
|
77
53
|
description: Automatically transforms URIs (via domain) and includes the destination resource (Vimeo, YouTube movie, image, ...) in your document
|
78
54
|
email: desimic@gmail.com
|
79
55
|
executables: []
|
@@ -87,6 +63,7 @@ files:
|
|
87
63
|
- lib/auto_html/auto_html_for.rb
|
88
64
|
- lib/auto_html/base.rb
|
89
65
|
- lib/auto_html/builder.rb
|
66
|
+
- lib/auto_html/capistrano.rb
|
90
67
|
- lib/auto_html/filter.rb
|
91
68
|
- lib/auto_html/filters/dailymotion.rb
|
92
69
|
- lib/auto_html/filters/google_video.rb
|
@@ -95,12 +72,14 @@ files:
|
|
95
72
|
- lib/auto_html/filters/link.rb
|
96
73
|
- lib/auto_html/filters/metacafe.rb
|
97
74
|
- lib/auto_html/filters/redcarpet.rb
|
98
|
-
- lib/auto_html/filters/redcloth.rb
|
99
75
|
- lib/auto_html/filters/sanitize.rb
|
100
76
|
- lib/auto_html/filters/simple_format.rb
|
101
77
|
- lib/auto_html/filters/vimeo.rb
|
102
78
|
- lib/auto_html/filters/youtube.rb
|
103
79
|
- lib/auto_html/filters/youtube_js_api.rb
|
80
|
+
- lib/auto_html/railtie.rb
|
81
|
+
- lib/auto_html/rake_tasks.rb
|
82
|
+
- lib/auto_html/task.rb
|
104
83
|
- lib/auto_html.rb
|
105
84
|
- test/fixture_setup.rb
|
106
85
|
- test/fixtures/database.yml
|
@@ -117,7 +96,6 @@ files:
|
|
117
96
|
- test/unit/filters/link_test.rb
|
118
97
|
- test/unit/filters/metacafe_test.rb
|
119
98
|
- test/unit/filters/redcarpet_test.rb
|
120
|
-
- test/unit/filters/redcloth_test.rb
|
121
99
|
- test/unit/filters/sanitize_test.rb
|
122
100
|
- test/unit/filters/simple_format_test.rb
|
123
101
|
- test/unit/filters/vimeo_test.rb
|
@@ -155,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
133
|
requirements: []
|
156
134
|
|
157
135
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.
|
136
|
+
rubygems_version: 1.6.2
|
159
137
|
signing_key:
|
160
138
|
specification_version: 3
|
161
139
|
summary: Transform URIs to appropriate markup
|
@@ -1,25 +0,0 @@
|
|
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
|