auto_html 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- auto_html [![Build Status](https://secure.travis-ci.org/dejan/auto_html.png)](http://travis-ci.org/dejan/auto_html)
1
+ auto_html [![Build Status](https://secure.travis-ci.org/dejan/auto_html.png?branch=master)](http://travis-ci.org/dejan/auto_html)
2
2
  =========
3
3
 
4
4
 
5
- auto_html is a Rails extension for transforming URLs to appropriate resource (image, link, YouTube, Vimeo video,...). It's the perfect choice if you don't want to bother visitors with rich HTML editor or markup code, but you still want to allow them to embed video, images, links and more on your site, purely by pasting URL. Check out the [live demo](http://auto-html.rors.org).
5
+ auto_html is a Rails extension for transforming URLs to appropriate resource (image, link, YouTube, Vimeo video,...). It's the perfect choice if you don't want to bother visitors with rich HTML editor or markup code, but you still want to allow them to embed video, images, links and more on your site, purely by pasting URL. Check out the [live demo](http://rors.org/demos/auto_html).
6
6
 
7
7
 
8
8
  ## Install
@@ -27,7 +27,7 @@ You'll probably have user input stored in model, so it's a good place to automat
27
27
  auto_html_for :body do
28
28
  html_escape
29
29
  image
30
- youtube(:width => 400, :height => 250)
30
+ youtube(:width => 400, :height => 250, :autoplay => true)
31
31
  link :target => "_blank", :rel => "nofollow"
32
32
  simple_format
33
33
  end
@@ -120,4 +120,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
120
120
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
121
121
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
122
122
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
123
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
123
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -7,14 +7,3 @@ desc 'Test AutoHtml'
7
7
  Rake::TestTask.new(:test) do |t|
8
8
  t.pattern = 'test/**/*_test.rb'
9
9
  end
10
-
11
- desc 'Test with versions of Rails available on the system'
12
- task :test_with_installed do
13
- versions = `gem list rails | grep rails`.gsub("rails (", "").chop.chop.split(', ')
14
- exclude = []
15
- (versions-exclude).each do |v|
16
- puts "\n###### TESTING WITH RAILS #{v}"
17
- ENV['RAILS_VERSION'] = v
18
- Rake::Task['test'].execute
19
- end
20
- end
@@ -1,3 +1,7 @@
1
+ require 'rails'
2
+
3
+ require 'active_support/core_ext/module/attribute_accessors' if Rails::VERSION::MAJOR >= 4
4
+
1
5
  module AutoHtmlFor
2
6
 
3
7
  # default options that can be overridden on the global level
@@ -14,6 +18,10 @@ module AutoHtmlFor
14
18
  def auto_html_for(raw_attrs, &proc)
15
19
  include AutoHtmlFor::InstanceMethods
16
20
 
21
+ if defined?(ActiveRecord) == "constant"
22
+ return unless ActiveRecord::Base.connection.table_exists? self.table_name
23
+ end
24
+
17
25
  suffix = AutoHtmlFor.auto_html_for_options[:htmlized_attribute_suffix]
18
26
  auto_html_for_columns = [raw_attrs].flatten.map { |a| "#{a}#{suffix}" }
19
27
 
@@ -24,7 +32,7 @@ module AutoHtmlFor
24
32
  missing_cache_columns.each do |missing_cache_column|
25
33
  raw_attr = missing_cache_column.gsub(suffix, '')
26
34
  define_method(missing_cache_column) do
27
- val = self[raw_attr]
35
+ val = self[raw_attr] || self.send(raw_attr.to_sym)
28
36
  auto_html(val, &proc)
29
37
  end
30
38
  end
@@ -3,4 +3,4 @@ AutoHtml.add_filter(:dailymotion).with(:width => 480, :height => 360) do |text,
3
3
  video_id = $1
4
4
  %{<object type="application/x-shockwave-flash" data="http://www.dailymotion.com/swf/#{video_id}&related=0" width="#{options[:width]}" height="#{options[:height]}"><param name="movie" value="http://www.dailymotion.com/swf/#{video_id}&related=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><a href="http://www.dailymotion.com/video/#{video_id}?embed=1"><img src="http://www.dailymotion.com/thumbnail/video/#{video_id}" width="#{options[:width]}" height="#{options[:height]}"/></a></object>}
5
5
  end
6
- end
6
+ end
@@ -1,9 +1,8 @@
1
1
  AutoHtml.add_filter(:gist).with({}) do |text, options|
2
2
  # E.g. https://gist.github.com/1710276
3
- regex = /https:\/\/gist\.github\.com\/(\d+)/
3
+ regex = %r{https?://gist\.github\.com/(\w+/)?(\d+)}
4
4
  text.gsub(regex) do
5
- gist_id = $1
5
+ gist_id = $2
6
6
  %{<script src="https://gist.github.com/#{gist_id}.js"></script>}
7
7
  end
8
8
  end
9
-
@@ -1,13 +1,19 @@
1
1
  # encoding: UTF-8
2
- AutoHtml.add_filter(:google_map).with(:width => 420, :height => 315, :style => "color:#000;text-align:left", :link_text => "View Larger Map") do |text, options|
3
- regex = /(https?):\/\/maps\.google\.co(.*)\/maps\?(.*)/
2
+ AutoHtml.add_filter(:google_map).with(:width => 420, :height => 315, :style => "color:#000;text-align:left", :link_text => "View Larger Map", :show_info => true, :type => :normal, :zoom => 18, :more => '') do |text, options|
3
+ map_type = { :normal => '&amp;t=m', :satellite => '&amp;t=k', :terrain => '&amp;t=p', :hibrid => '&amp;t=h' }
4
+ regex = /(https?):\/\/maps\.google\.([a-z\.]+)\/maps\?(.*)/
4
5
  text.gsub(regex) do
5
6
  domain_country = $2
6
7
  map_query = $3
7
8
  width = options[:width]
8
9
  height = options[:height]
9
10
  style = options[:style]
10
- link_text = options[:link_text]
11
- %{<iframe width="#{width}" height="#{height}" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.co#{domain_country}/maps?f=q&amp;source=s_q&amp;#{map_query}&amp;output=embed"></iframe><br /><small><a href="//maps.google.co#{domain_country}/maps?f=q&amp;source=embed&amp;#{map_query}" style="#{style}">#{link_text}</a></small>}
11
+ link_text = options[:link_text]
12
+ type = options[:type].to_sym
13
+ map_options = (options[:show_info] ? '' : '&amp;iwloc=near')
14
+ map_options << map_type[type] if map_type.has_key?(type)
15
+ map_options << "&amp;z=#{options[:zoom]}"
16
+ map_options << options[:more]
17
+ %{<iframe width="#{width}" height="#{height}" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.#{domain_country}/maps?f=q&amp;source=s_q&amp;#{map_query}&amp;output=embed#{map_options}"></iframe><br /><small><a href="//maps.google.#{domain_country}/maps?f=q&amp;source=embed&amp;#{map_query}" style="#{style}">#{link_text}</a></small>}
12
18
  end
13
19
  end
@@ -1,6 +1,6 @@
1
- AutoHtml.add_filter(:google_video).with(:width => 650, :height => 391) do |text, options|
2
- text.gsub(/http:\/\/video\.google\.com\/videoplay\?docid\=(-?[0-9]*)[&\w;=\+_\-]*/) do
3
- docid = $1
4
- %{<object width="#{options[:width]}" height="#{options[:height]}"><param name="movie" value="http://video.google.com/googleplayer.swf?docid=#{docid}&hl=en&fs=true"></param><param name="wmode" value="transparent"></param><embed src="http://video.google.com/googleplayer.swf?docid=#{docid}" type="application/x-shockwave-flash" wmode="transparent" width="#{options[:width]}" height="#{options[:height]}"></embed></object>}
5
- end
6
- end
1
+ # GoogleVideo is discontinued so don't do anything
2
+ # TODO Remove this filter in auto_html v2.0
3
+ AutoHtml.add_filter(:google_video) do |text, options|
4
+ text
5
+ end
6
+
@@ -0,0 +1,7 @@
1
+ AutoHtml.add_filter(:hashtag).with(:source => :twitter) do |text, options|
2
+ if options[:source] == :twitter
3
+ text.gsub(/#([^ ]+)/, '<a href="http://twitter.com/search?q=%23\1&f=realtime" class="hashtag" target="_blank">#\1</a>')
4
+ elsif options[:source] == :facebook
5
+ text.gsub(/#([^ ]+)/, '<a href="https://www.facebook.com/hashtag/\1" class="hashtag" target="_blank">#\1</a>')
6
+ end
7
+ end
@@ -3,13 +3,14 @@ require 'redcarpet'
3
3
  class NoParagraphRenderer < ::Redcarpet::Render::XHTML
4
4
  def paragraph(text)
5
5
  text
6
- end
6
+ end
7
7
  end
8
8
 
9
9
  AutoHtml.add_filter(:image).with({:alt => ''}) do |text, options|
10
10
  r = Redcarpet::Markdown.new(NoParagraphRenderer)
11
11
  alt = options[:alt]
12
- text.gsub(/https?:\/\/.+?\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match|
13
- r.render("![#{alt}](#{match})")
12
+ options[:proxy] ||= ""
13
+ text.gsub(/(?<!src=")https?:\/\/.+?\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match|
14
+ r.render("![#{alt}](#{options[:proxy]}#{match})")
14
15
  end
15
- end
16
+ end
@@ -1,7 +1,17 @@
1
+ require 'uri'
1
2
  require 'rinku'
2
3
  require 'rexml/document'
3
4
 
4
5
  AutoHtml.add_filter(:link).with({}) do |text, options|
6
+ option_short_link_name = options.delete(:short_link_name)
5
7
  attributes = Array(options).reject { |k,v| v.nil? }.map { |k, v| %{#{k}="#{REXML::Text::normalize(v)}"} }.join(' ')
6
- Rinku.auto_link(text, :all, attributes)
8
+ Rinku.auto_link(text, :all, attributes) do |url|
9
+ if option_short_link_name
10
+ uri = URI.parse(URI.encode(url.strip))
11
+ uri.query = nil
12
+ uri.to_s
13
+ else
14
+ url
15
+ end
16
+ end
7
17
  end
@@ -1,23 +1,20 @@
1
+ # encoding: UTF-8
1
2
  require 'uri'
2
- require 'net/http'
3
3
 
4
- AutoHtml.add_filter(:soundcloud).with({}) do |text, options|
5
- # set these options
6
- # :maxwidth => '', :maxheight => '', :auto_play => false, :show_comments => false
7
- text.gsub(/(https?:\/\/)?(www.)?soundcloud\.com\/.*/) do |match|
4
+ # set these options and default values
5
+ # :width => '100%', :height => 166, :auto_play => false, :theme_color => '00FF00', :color => '915f33', :show_comments => false
6
+ AutoHtml.add_filter(:soundcloud).with(:width => '100%', :height => 166, :auto_play => false, :theme_color => '00FF00', :color => '915f33', :show_comments => false, :show_artwork => false) do |text, options|
7
+ text.gsub(/(https?:\/\/)?(www.)?soundcloud\.com\/\S*/) do |match|
8
8
  new_uri = match.to_s
9
9
  new_uri = (new_uri =~ /^https?\:\/\/.*/) ? URI(new_uri) : URI("http://#{new_uri}")
10
10
  new_uri.normalize!
11
-
12
- uri = URI("http://soundcloud.com/oembed")
13
- params = {:format => 'json', :url => new_uri}.merge(options)
14
- uri.query = params.collect { |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join('&')
15
- response = Net::HTTP.get(uri)
16
- if !response.blank?
17
- JSON.parse(response)["html"]
18
- else
19
- match
20
- end
11
+ width = options[:width]
12
+ height = options[:height]
13
+ auto_play = options[:auto_play]
14
+ theme_color = options[:theme_color]
15
+ color = options[:color]
16
+ show_artwork = options[:show_artwork]
17
+ show_comments = options[:show_comments]
18
+ %{<iframe width="#{width}" height="#{height}" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=#{new_uri}&show_artwork=#{show_artwork}&show_comments=#{show_comments}&auto_play=#{auto_play}&color=#{color}&theme_color=#{theme_color}"></iframe>}
21
19
  end
22
20
  end
23
-
@@ -2,7 +2,7 @@ require 'uri'
2
2
  require 'net/http'
3
3
 
4
4
  AutoHtml.add_filter(:twitter).with({}) do |text, options|
5
- regex = %r{https://twitter\.com(/#!)?/[A-Za-z0-9_]{1,15}/status(es)?/\d+}
5
+ regex = %r{(?<!href=")https://twitter\.com(/#!)?/[A-Za-z0-9_]{1,15}/status(es)?/\d+}
6
6
 
7
7
  text.gsub(regex) do |match|
8
8
  params = { :url => match }.merge(options)
@@ -0,0 +1,8 @@
1
+ AutoHtml.add_filter(:worldstar).with(:width => 448, :height => 374) do |text,options|
2
+ text.gsub(/http:\/\/www\.worldstarhiphop\.com\/videos\/video\.php\?v\=(wshh[A-Za-z0-9]+)/) do
3
+ video_id = $1
4
+ width = options[:width]
5
+ height = options[:height]
6
+ %{<object width="#{width}" height="#{height}"><param name="movie" value="http://www.worldstarhiphop.com/videos/e/16711680/#{video_id}"><param name="allowFullScreen" value="true"></param><embed src="http://www.worldstarhiphop.com/videos/e/16711680/#{video_id}" type="application/x-shockwave-flash" allowFullscreen="true" width="#{width}" height="#{height}"></embed></object>}
7
+ end
8
+ end
@@ -1,14 +1,19 @@
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\/|youtube\.com\/watch\?feature=player_embedded&v=)([A-Za-z0-9_-]*)(\&\S+)?(\S)*/
1
+ AutoHtml.add_filter(:youtube).with(:width => 420, :height => 315, :frameborder => 0, :wmode => nil, :autoplay => false, :hide_related => false) do |text, options|
2
+ regex = /https?:\/\/(www.)?(youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/watch\?feature=player_embedded&v=)([A-Za-z0-9_-]*)(\&\S+)?(\?\S+)?/
3
3
  text.gsub(regex) do
4
4
  youtube_id = $3
5
5
  width = options[:width]
6
6
  height = options[:height]
7
7
  frameborder = options[:frameborder]
8
8
  wmode = options[:wmode]
9
+ autoplay = options[:autoplay]
10
+ hide_related = options[:hide_related]
9
11
  src = "//www.youtube.com/embed/#{youtube_id}"
10
- src += "?wmode=#{wmode}" if wmode
12
+ params = []
13
+ params << "wmode=#{wmode}" if wmode
14
+ params << "autoplay=1" if autoplay
15
+ params << "rel=0" if hide_related
16
+ src += "?#{params.join '&'}" unless params.empty?
11
17
  %{<iframe width="#{width}" height="#{height}" src="#{src}" frameborder="#{frameborder}" allowfullscreen></iframe>}
12
18
  end
13
19
  end
14
-
@@ -9,6 +9,11 @@ class Article < ActiveRecord::Base
9
9
  link(:target => "_blank")
10
10
  simple_format
11
11
  end
12
+
13
+ alias_attribute :plain_body, :body
14
+ auto_html_for :plain_body do
15
+ html_escape
16
+ end
12
17
  end
13
18
 
14
19
  class AutoHtmlForTest < Test::Unit::TestCase
@@ -43,4 +48,9 @@ class AutoHtmlForTest < Test::Unit::TestCase
43
48
  @article.save!
44
49
  assert_equal '<p><a href="http://vukajlija.com" target="_blank">http://vukajlija.com</a></p>', @article.body_html
45
50
  end
51
+
52
+ def test_transform_of_alias_attribute
53
+ @article = Article.new(:body => 'Hello there.')
54
+ assert_equal 'Hello there.', @article.plain_body_html
55
+ end
46
56
  end
data/test/test_helper.rb CHANGED
@@ -1,12 +1,5 @@
1
1
  require 'rubygems'
2
2
 
3
- rails_version = ENV['RAILS_VERSION']
4
- if rails_version
5
- gem "activesupport", rails_version
6
- gem "activerecord", rails_version
7
- gem "actionpack", rails_version
8
- end
9
-
10
3
  require 'test/unit'
11
4
  require 'active_record'
12
5
  require 'active_support/core_ext/class'
@@ -7,4 +7,9 @@ class GistTest < Test::Unit::TestCase
7
7
  assert_equal '<script src="https://gist.github.com/1710276.js"></script>', result
8
8
  end
9
9
 
10
- end
10
+ def test_transform_with_username
11
+ result = auto_html('https://gist.github.com/toctan/6547840') { gist }
12
+ assert_equal '<script src="https://gist.github.com/6547840.js"></script>', result
13
+ end
14
+
15
+ end
@@ -4,11 +4,21 @@ class GoogleMapTest < Test::Unit::TestCase
4
4
 
5
5
  def test_transform
6
6
  result = auto_html('http://maps.google.co.kr/maps?q=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&hl=ko&ie=UTF8&ll=37.472942,126.884762&spn=0.00774,0.010053&sll=37.473027,126.88451&sspn=0.003887,0.005026&vpsrc=6&gl=kr&hq=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&t=m&z=17&iwloc=A') { google_map }
7
- assert_equal '<iframe width="420" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.co.kr/maps?f=q&amp;source=s_q&amp;q=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&hl=ko&ie=UTF8&ll=37.472942,126.884762&spn=0.00774,0.010053&sll=37.473027,126.88451&sspn=0.003887,0.005026&vpsrc=6&gl=kr&hq=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&t=m&z=17&iwloc=A&amp;output=embed"></iframe><br /><small><a href="//maps.google.co.kr/maps?f=q&amp;source=embed&amp;q=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&hl=ko&ie=UTF8&ll=37.472942,126.884762&spn=0.00774,0.010053&sll=37.473027,126.88451&sspn=0.003887,0.005026&vpsrc=6&gl=kr&hq=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&t=m&z=17&iwloc=A" style="color:#000;text-align:left">View Larger Map</a></small>', result
7
+ assert_equal '<iframe width="420" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.co.kr/maps?f=q&amp;source=s_q&amp;q=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&hl=ko&ie=UTF8&ll=37.472942,126.884762&spn=0.00774,0.010053&sll=37.473027,126.88451&sspn=0.003887,0.005026&vpsrc=6&gl=kr&hq=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&t=m&z=17&iwloc=A&amp;output=embed&amp;t=m&amp;z=18"></iframe><br /><small><a href="//maps.google.co.kr/maps?f=q&amp;source=embed&amp;q=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&hl=ko&ie=UTF8&ll=37.472942,126.884762&spn=0.00774,0.010053&sll=37.473027,126.88451&sspn=0.003887,0.005026&vpsrc=6&gl=kr&hq=%ED%8C%8C%ED%8A%B8%EB%84%88%EC%8A%A4%ED%83%80%EC%9B%8C+1%EC%B0%A8&t=m&z=17&iwloc=A" style="color:#000;text-align:left">View Larger Map</a></small>', result
8
8
  end
9
-
9
+
10
10
  def test_transform_2
11
11
  result = auto_html('http://maps.google.com/maps?hl=en&q=newyork&gs_sm=e&gs_upl=917l917l0l1666l1l1l0l0l0l0l317l317l3-1l1l0&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1280&bih=679&um=1&ie=UTF-8&sa=N&tab=wl') { google_map }
12
- assert_equal '<iframe width="420" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&q=newyork&gs_sm=e&gs_upl=917l917l0l1666l1l1l0l0l0l0l317l317l3-1l1l0&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1280&bih=679&um=1&ie=UTF-8&sa=N&tab=wl&amp;output=embed"></iframe><br /><small><a href="//maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&q=newyork&gs_sm=e&gs_upl=917l917l0l1666l1l1l0l0l0l0l317l317l3-1l1l0&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1280&bih=679&um=1&ie=UTF-8&sa=N&tab=wl" style="color:#000;text-align:left">View Larger Map</a></small>', result
12
+ assert_equal '<iframe width="420" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&q=newyork&gs_sm=e&gs_upl=917l917l0l1666l1l1l0l0l0l0l317l317l3-1l1l0&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1280&bih=679&um=1&ie=UTF-8&sa=N&tab=wl&amp;output=embed&amp;t=m&amp;z=18"></iframe><br /><small><a href="//maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&q=newyork&gs_sm=e&gs_upl=917l917l0l1666l1l1l0l0l0l0l317l317l3-1l1l0&bav=on.2,or.r_gc.r_pw.,cf.osb&biw=1280&bih=679&um=1&ie=UTF-8&sa=N&tab=wl" style="color:#000;text-align:left">View Larger Map</a></small>', result
13
+ end
14
+
15
+ def test_show_info
16
+ result = auto_html('http://maps.google.com.br/maps?q=Joinville+-+Santa+Catarina') { google_map(:show_info => false) }
17
+ assert_equal '<iframe width="420" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.com.br/maps?f=q&amp;source=s_q&amp;q=Joinville+-+Santa+Catarina&amp;output=embed&amp;iwloc=near&amp;t=m&amp;z=18"></iframe><br /><small><a href="//maps.google.com.br/maps?f=q&amp;source=embed&amp;q=Joinville+-+Santa+Catarina" style="color:#000;text-align:left">View Larger Map</a></small>', result
18
+ end
19
+
20
+ def test_type_and_zoom
21
+ result = auto_html('http://maps.google.com.br/maps?q=Joinville+-+Santa+Catarina') { google_map(:type => :satellite, :zoom => 3) }
22
+ assert_equal '<iframe width="420" height="315" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="//maps.google.com.br/maps?f=q&amp;source=s_q&amp;q=Joinville+-+Santa+Catarina&amp;output=embed&amp;t=k&amp;z=3"></iframe><br /><small><a href="//maps.google.com.br/maps?f=q&amp;source=embed&amp;q=Joinville+-+Santa+Catarina" style="color:#000;text-align:left">View Larger Map</a></small>', result
13
23
  end
14
24
  end
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../../unit_test_helper', __FILE__)
2
+
3
+ class HashtagTest < Test::Unit::TestCase
4
+
5
+ def test_transform
6
+ result = auto_html("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. #LoremIpsum") { hashtag }
7
+ assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. <a href="http://twitter.com/search?q=%23LoremIpsum&f=realtime" class="hashtag" target="_blank">#LoremIpsum</a>', result
8
+ end
9
+
10
+ def test_transform_with_multiple_hashtags
11
+ result = auto_html("Lorem ipsum #dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo #adipiscingUltrices. Etiam ac elementum cras amet.") { hashtag }
12
+ assert_equal 'Lorem ipsum <a href="http://twitter.com/search?q=%23dolor&f=realtime" class="hashtag" target="_blank">#dolor</a> sit amet, consectetur adipiscing elit. Donec vel ipsum et leo <a href="http://twitter.com/search?q=%23adipiscingUltrices.&f=realtime" class="hashtag" target="_blank">#adipiscingUltrices.</a> Etiam ac elementum cras amet.', result
13
+ end
14
+
15
+ def test_transform_with_twitter_source
16
+ result = auto_html("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. #LoremIpsum") { hashtag source: :twitter }
17
+ assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. <a href="http://twitter.com/search?q=%23LoremIpsum&f=realtime" class="hashtag" target="_blank">#LoremIpsum</a>', result
18
+ end
19
+
20
+ def test_transform_with_facebook_source
21
+ result = auto_html("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. #LoremIpsum") { hashtag source: :facebook }
22
+ assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vel ipsum et leo adipiscing ultrices. Etiam ac elementum cras amet. <a href="https://www.facebook.com/hashtag/LoremIpsum" class="hashtag" target="_blank">#LoremIpsum</a>', result
23
+ end
24
+
25
+ end
@@ -12,6 +12,11 @@ class ImageTest < Test::Unit::TestCase
12
12
  assert_equal 'http://blog.phusion.nl/2009/04/16/phusions-one-year-anniversary-gift-phusion-passenger-220/', result
13
13
  end
14
14
 
15
+ def test_dont_transform_a_formatted_image
16
+ result = auto_html('<img src="http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg" alt=""/>'){ image({:alt => nil}) }
17
+ assert_equal '<img src="http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg" alt=""/>', result
18
+ end
19
+
15
20
  def test_transform2
16
21
  result = auto_html('http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg') { image({:alt => nil}) }
17
22
  assert_equal '<img src="http://farm4.static.flickr.com/3459/3270173112_5099d3d730.jpg" alt=""/>', result
@@ -52,4 +57,9 @@ class ImageTest < Test::Unit::TestCase
52
57
  assert_equal '<img src="https://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png" alt=""/>', result
53
58
  end
54
59
 
55
- end
60
+ def test_proxy_option
61
+ result = auto_html('http://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png') { image({:alt => nil,:proxy => "https://proxy/?url="}) }
62
+ assert_equal '<img src="https://proxy/?url=http://img.skitch.com/20100910-1wrbg5749xe29ya5t3s85bnaiy.png" alt=""/>', result
63
+ end
64
+
65
+ end
@@ -43,4 +43,13 @@ class LinkTest < Test::Unit::TestCase
43
43
  assert_equal '<a href="http://rors.org" target="_blank">http://rors.org</a>', result
44
44
  end
45
45
 
46
- end
46
+ def test_transform_with_short_link_name_option
47
+ result = auto_html("http://rors.org?some=params&and=more") { link :short_link_name => true }
48
+ assert_equal '<a href="http://rors.org?some=params&and=more" >http://rors.org</a>', result
49
+ end
50
+
51
+ def test_transform_with_short_link_name_option_false
52
+ result = auto_html("http://rors.org?some=params&and=more") { link :short_link_name => false }
53
+ assert_equal '<a href="http://rors.org?some=params&and=more" >http://rors.org?some=params&and=more</a>', result
54
+ end
55
+ end
@@ -2,37 +2,28 @@ require File.expand_path('../../unit_test_helper', __FILE__)
2
2
  require 'fakeweb'
3
3
 
4
4
  class SoundcloudTest < Test::Unit::TestCase
5
-
6
- def setup
7
- response = '{"version":1.0,"type":"rich","provider_name":"SoundCloud","provider_url":"http://soundcloud.com","height":166,"width":"100%","title":"Flickermood by Forss","description":"From the Soulhack album,\u0026nbsp;recently featured in this ad \u003Ca href=\"https://www.dswshoes.com/tv_commercial.jsp?m=october2007\"\u003Ehttps://www.dswshoes.com/tv_commercial.jsp?m=october2007\u003C/a\u003E ","thumbnail_url":"http://i1.sndcdn.com/artworks-000000001720-91c40a-t500x500.jpg?330b92d","html":"\u003Ciframe width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293\u0026show_artwork=true\"\u003E\u003C/iframe\u003E","author_name":"Forss","author_url":"http://soundcloud.com/forss"}'
8
- FakeWeb.register_uri(:get, %r|http://soundcloud\.com/oembed|, :body => response)
9
- end
10
-
11
5
  def test_transform_url_with_www
12
6
  result = auto_html('http://www.soundcloud.com/forss/flickermood') { soundcloud }
13
- assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293&show_artwork=true"></iframe>', result
7
+ assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http://www.soundcloud.com/forss/flickermood&show_artwork=false&show_comments=false&auto_play=false&color=915f33&theme_color=00FF00"></iframe>', result
14
8
  end
15
9
 
16
10
  def test_transform_url_without_www
17
11
  result = auto_html('http://soundcloud.com/forss/flickermood') { soundcloud }
18
- assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293&show_artwork=true"></iframe>', result
12
+ assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http://soundcloud.com/forss/flickermood&show_artwork=false&show_comments=false&auto_play=false&color=915f33&theme_color=00FF00"></iframe>', result
19
13
  end
20
14
 
21
15
  def test_transform_url_without_protocol
22
16
  result = auto_html('soundcloud.com/forss/flickermood') { soundcloud }
23
- assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293&show_artwork=true"></iframe>', result
17
+ assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http://soundcloud.com/forss/flickermood&show_artwork=false&show_comments=false&auto_play=false&color=915f33&theme_color=00FF00"></iframe>', result
24
18
  end
25
19
 
26
20
  def test_transform_url_with_ssl
27
21
  result = auto_html('https://soundcloud.com/forss/flickermood') { soundcloud }
28
- assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293&show_artwork=true"></iframe>', result
22
+ assert_equal '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=https://soundcloud.com/forss/flickermood&show_artwork=false&show_comments=false&auto_play=false&color=915f33&theme_color=00FF00"></iframe>', result
29
23
  end
30
24
 
31
25
  def test_transform_url_with_options
32
- response = '{"version":1.0,"type":"rich","provider_name":"SoundCloud","provider_url":"http://soundcloud.com","height":100,"width":100,"title":"Flickermood by Forss","description":"From the Soulhack album,\u0026nbsp;recently featured in this ad \u003Ca href=\"https://www.dswshoes.com/tv_commercial.jsp?m=october2007\"\u003Ehttps://www.dswshoes.com/tv_commercial.jsp?m=october2007\u003C/a\u003E ","thumbnail_url":"http://i1.sndcdn.com/artworks-000000001720-91c40a-t500x500.jpg?330b92d","html":"\u003Ciframe width=\"100\" height=\"100\" scrolling=\"no\" frameborder=\"no\" src=\"http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293\u0026show_artwork=true\u0026show_comments=false\u0026maxwidth=100\u0026maxheight=100\u0026auto_play=false\"\u003E\u003C/iframe\u003E","author_name":"Forss","author_url":"http://soundcloud.com/forss"}'
33
- FakeWeb.register_uri(:get, %r|http://soundcloud\.com/oembed|, :body => response)
34
-
35
- result = auto_html('http://www.soundcloud.com/forss/flickermood') { soundcloud(:maxwidth => '100', :maxheight => '100', :auto_play => false, :show_comments => false) }
36
- assert_equal '<iframe width="100" height="100" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F293&show_artwork=true&show_comments=false&maxwidth=100&maxheight=100&auto_play=false"></iframe>', result
26
+ result = auto_html('http://www.soundcloud.com/forss/flickermood') { soundcloud(:width => '50%', :height => '100', :auto_play => true, :show_comments => true) }
27
+ assert_equal '<iframe width="50%" height="100" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http://www.soundcloud.com/forss/flickermood&show_artwork=false&show_comments=true&auto_play=true&color=915f33&theme_color=00FF00"></iframe>', result
37
28
  end
38
29
  end
@@ -0,0 +1,40 @@
1
+ require File.expand_path('../../unit_test_helper', __FILE__)
2
+ require 'fakeweb'
3
+
4
+ class TwitterTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ response = %Q(
8
+ {
9
+ "type": "rich",
10
+ "url": "http://twitter.com/danmartell/status/279651488517738496",
11
+ "cache_age": "31536000000",
12
+ "height": null,
13
+ "html": "things",
14
+ "version": "1.0",
15
+ "provider_name": "Twitter",
16
+ "width": 550,
17
+ "provider_url": "http://twitter.com",
18
+ "author_name": "Dan Martell",
19
+ "author_url": "http://twitter.com/danmartell"
20
+ })
21
+
22
+ FakeWeb.register_uri(:get, %r|http://api\.twitter\.com/1/statuses/oembed\.json|, :body => response)
23
+ end
24
+
25
+ def test_transform
26
+ transormed_html = "things"
27
+ result = auto_html('https://twitter.com/danmartell/statuses/279651488517738496') { twitter }
28
+ assert_equal transormed_html, result
29
+ end
30
+
31
+ def test_dont_transform_a_regular_link_to_twitter
32
+ transormed_html = %Q(<blockquote class="twitter-tweet"><p>Stop saying you can't! Start asking "What would need to be true for me to accomplish this" - it'll change your life. <a href="https://twitter.com/search/%23focus">#focus</a> <a href="https://twitter.com/search/%23solutions">#solutions</a></p>&mdash; Dan Martell (@danmartell) <a href="https://twitter.com/danmartell/status/279651488517738496" data-datetime="2012-12-14T18:18:05+00:00">December 14, 2012</a></blockquote>
33
+ <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>)
34
+
35
+ result = auto_html(transormed_html) { twitter }
36
+
37
+ assert_equal transormed_html, result
38
+ end
39
+
40
+ end
@@ -0,0 +1,14 @@
1
+ require File.expand_path('../../unit_test_helper', __FILE__)
2
+
3
+ class WorldstarTest < Test::Unit::TestCase
4
+
5
+ def test_transform
6
+ result = auto_html('http://www.worldstarhiphop.com/videos/video.php?v=wshhc29WLkx550Hv9o31') { worldstar }
7
+ assert_equal '<object width="448" height="374"><param name="movie" value="http://www.worldstarhiphop.com/videos/e/16711680/wshhc29WLkx550Hv9o31"><param name="allowFullScreen" value="true"></param><embed src="http://www.worldstarhiphop.com/videos/e/16711680/wshhc29WLkx550Hv9o31" type="application/x-shockwave-flash" allowFullscreen="true" width="448" height="374"></embed></object>', result
8
+ end
9
+
10
+ def test_transform_with_options
11
+ result = auto_html('http://www.worldstarhiphop.com/videos/video.php?v=wshhc29WLkx550Hv9o31') { worldstar(:width => 400, :height => 250)}
12
+ assert_equal '<object width="400" height="250"><param name="movie" value="http://www.worldstarhiphop.com/videos/e/16711680/wshhc29WLkx550Hv9o31"><param name="allowFullScreen" value="true"></param><embed src="http://www.worldstarhiphop.com/videos/e/16711680/wshhc29WLkx550Hv9o31" type="application/x-shockwave-flash" allowFullscreen="true" width="400" height="250"></embed></object>', result
13
+ end
14
+ end
@@ -16,12 +16,17 @@ class YouTubeTest < Test::Unit::TestCase
16
16
  result = auto_html('http://www.youtube.com/watch?v=BwNrmYRiX_o&feature=related') { youtube }
17
17
  assert_equal '<iframe width="420" height="315" src="//www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
18
18
  end
19
-
19
+
20
20
  def test_transform3
21
21
  result = auto_html('foo http://www.youtube.com/watch?v=fT1ahr81HLw bar') { youtube }
22
22
  assert_equal 'foo <iframe width="420" height="315" src="//www.youtube.com/embed/fT1ahr81HLw" frameborder="0" allowfullscreen></iframe> bar', result
23
23
  end
24
24
 
25
+ def test_transform4
26
+ result = auto_html('foo http://www.youtube.com/watch?v=fT1ahr81HLw<br>bar') { youtube }
27
+ assert_equal 'foo <iframe width="420" height="315" src="//www.youtube.com/embed/fT1ahr81HLw" frameborder="0" allowfullscreen></iframe><br>bar', result
28
+ end
29
+
25
30
  def test_transform_url_without_www
26
31
  result = auto_html('http://youtube.com/watch?v=BwNrmYRiX_o') { youtube }
27
32
  assert_equal '<iframe width="420" height="315" src="//www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
@@ -36,12 +41,12 @@ class YouTubeTest < Test::Unit::TestCase
36
41
  result = auto_html('http://www.youtu.be/BwNrmYRiX_o') { youtube }
37
42
  assert_equal '<iframe width="420" height="315" src="//www.youtube.com/embed/BwNrmYRiX_o" frameborder="0" allowfullscreen></iframe>', result
38
43
  end
39
-
44
+
40
45
  def test_transform_https
41
46
  result = auto_html("https://www.youtube.com/watch?v=t7NdBIA4zJg") { youtube }
42
47
  assert_equal '<iframe width="420" height="315" src="//www.youtube.com/embed/t7NdBIA4zJg" frameborder="0" allowfullscreen></iframe>', result
43
48
  end
44
-
49
+
45
50
  def test_short_with_params
46
51
  result = auto_html("http://youtu.be/t7NdBIA4zJg?t=1s&hd=1") { youtube }
47
52
  assert_equal '<iframe width="420" height="315" src="//www.youtube.com/embed/t7NdBIA4zJg" frameborder="0" allowfullscreen></iframe>', result
metadata CHANGED
@@ -1,62 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: auto_html
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 6
9
- - 0
10
- version: 1.6.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Dejan Simic
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-07-29 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2014-01-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rinku
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 1
31
- - 5
32
- - 0
20
+ - !ruby/object:Gem::Version
33
21
  version: 1.5.0
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: redcarpet
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
40
25
  none: false
41
- requirements:
26
+ requirements:
42
27
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 2
47
- - 0
48
- version: "2.0"
28
+ - !ruby/object:Gem::Version
29
+ version: 1.5.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: redcarpet
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '2.0'
49
38
  type: :runtime
50
- version_requirements: *id002
51
- description: Automatically transforms URIs (via domain) and includes the destination resource (Vimeo, YouTube movie, image, ...) in your document
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '2.0'
46
+ description: Automatically transforms URIs (via domain) and includes the destination
47
+ resource (Vimeo, YouTube movie, image, ...) in your document
52
48
  email: desimic@gmail.com
53
49
  executables: []
54
-
55
50
  extensions: []
56
-
57
51
  extra_rdoc_files: []
58
-
59
- files:
52
+ files:
60
53
  - Rakefile
61
54
  - lib/auto_html/auto_html_for.rb
62
55
  - lib/auto_html/base.rb
@@ -68,6 +61,7 @@ files:
68
61
  - lib/auto_html/filters/gist.rb
69
62
  - lib/auto_html/filters/google_map.rb
70
63
  - lib/auto_html/filters/google_video.rb
64
+ - lib/auto_html/filters/hashtag.rb
71
65
  - lib/auto_html/filters/html_escape.rb
72
66
  - lib/auto_html/filters/image.rb
73
67
  - lib/auto_html/filters/link.rb
@@ -78,6 +72,7 @@ files:
78
72
  - lib/auto_html/filters/soundcloud.rb
79
73
  - lib/auto_html/filters/twitter.rb
80
74
  - lib/auto_html/filters/vimeo.rb
75
+ - lib/auto_html/filters/worldstar.rb
81
76
  - lib/auto_html/filters/youtube.rb
82
77
  - lib/auto_html/filters/youtube_js_api.rb
83
78
  - lib/auto_html/railtie.rb
@@ -95,7 +90,7 @@ files:
95
90
  - test/unit/filters/dailymotion_test.rb
96
91
  - test/unit/filters/gist_test.rb
97
92
  - test/unit/filters/google_map_test.rb
98
- - test/unit/filters/google_video_test.rb
93
+ - test/unit/filters/hashtag_test.rb
99
94
  - test/unit/filters/html_escape_test.rb
100
95
  - test/unit/filters/image_test.rb
101
96
  - test/unit/filters/link_test.rb
@@ -104,43 +99,35 @@ files:
104
99
  - test/unit/filters/sanitize_test.rb
105
100
  - test/unit/filters/simple_format_test.rb
106
101
  - test/unit/filters/soundcloud_test.rb
102
+ - test/unit/filters/twitter_test.rb
107
103
  - test/unit/filters/vimeo_test.rb
104
+ - test/unit/filters/worldstar_test.rb
108
105
  - test/unit/filters/youtube_js_api_test.rb
109
106
  - test/unit/filters/youtube_test.rb
110
107
  - test/unit/unit_test_helper.rb
111
108
  - README.md
112
109
  homepage: http://github.com/dejan/auto_html
113
110
  licenses: []
114
-
115
111
  post_install_message:
116
112
  rdoc_options: []
117
-
118
- require_paths:
113
+ require_paths:
119
114
  - lib
120
- required_ruby_version: !ruby/object:Gem::Requirement
115
+ required_ruby_version: !ruby/object:Gem::Requirement
121
116
  none: false
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- hash: 3
126
- segments:
127
- - 0
128
- version: "0"
129
- required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
122
  none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
136
- - 0
137
- version: "0"
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
138
127
  requirements: []
139
-
140
128
  rubyforge_project:
141
- rubygems_version: 1.8.24
129
+ rubygems_version: 1.8.23
142
130
  signing_key:
143
131
  specification_version: 3
144
132
  summary: Transform URIs to appropriate markup
145
133
  test_files: []
146
-
@@ -1,15 +0,0 @@
1
- require File.expand_path('../../unit_test_helper', __FILE__)
2
-
3
- class GoogleVideoTest < Test::Unit::TestCase
4
-
5
- def test_transform
6
- result = auto_html("http://video.google.com/videoplay?docid=-7533500868750350977&ei=Xin8Sc-KBYeg2ALXkKymAQ&q=office+space&emb=1") { google_video }
7
- assert_equal '<object width="650" height="391"><param name="movie" value="http://video.google.com/googleplayer.swf?docid=-7533500868750350977&hl=en&fs=true"></param><param name="wmode" value="transparent"></param><embed src="http://video.google.com/googleplayer.swf?docid=-7533500868750350977" type="application/x-shockwave-flash" wmode="transparent" width="650" height="391"></embed></object>', result
8
- end
9
-
10
- def test_transform_with_options
11
- result = auto_html("http://video.google.com/videoplay?docid=7442132741322615356") { google_video(:width => 500, :height => 300) }
12
- assert_equal '<object width="500" height="300"><param name="movie" value="http://video.google.com/googleplayer.swf?docid=7442132741322615356&hl=en&fs=true"></param><param name="wmode" value="transparent"></param><embed src="http://video.google.com/googleplayer.swf?docid=7442132741322615356" type="application/x-shockwave-flash" wmode="transparent" width="500" height="300"></embed></object>', result
13
- end
14
-
15
- end