auto_html 1.2.0 → 1.2.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/CHANGELOG.rdoc +5 -0
 - data/README.rdoc +2 -2
 - data/VERSION.yml +1 -1
 - data/auto_html.gemspec +2 -2
 - data/lib/auto_html/filters/vimeo.rb +11 -2
 - data/test/unit/filters/vimeo_test.rb +20 -0
 - metadata +2 -2
 
    
        data/CHANGELOG.rdoc
    CHANGED
    
    | 
         @@ -1,3 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == 1.2.1, released 2009-10-28
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * more options for vimeo filter
         
     | 
| 
      
 4 
     | 
    
         
            +
            * switch to gemcutter
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       1 
6 
     | 
    
         
             
            == 1.2.0, released 2009-09-26
         
     | 
| 
       2 
7 
     | 
    
         | 
| 
       3 
8 
     | 
    
         
             
            * link filter now uses Rails' link discovery engine. Closes: http://github.com/dejan/auto_html/issues#issue/2 and  http://github.com/dejan/auto_html/issues#issue/3 if Rails 2.3+ is in use.
         
     | 
    
        data/README.rdoc
    CHANGED
    
    | 
         @@ -64,7 +64,7 @@ As from version 1.2.0 auto_html uses Rails' engine for discovering links. There 
     | 
|
| 
       64 
64 
     | 
    
         | 
| 
       65 
65 
     | 
    
         
             
            Rails::           auto_html
         
     | 
| 
       66 
66 
     | 
    
         
             
            <= 2.3.1::        1.1.2
         
     | 
| 
       67 
     | 
    
         
            -
            >= 2.3.2::        1.2. 
     | 
| 
      
 67 
     | 
    
         
            +
            >= 2.3.2::        1.2.1
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
            === As a gem
         
     | 
| 
         @@ -72,7 +72,7 @@ Rails::           auto_html 
     | 
|
| 
       72 
72 
     | 
    
         
             
            To enable the library in your Rails 2.1 (or greater) project, use the gem configuration method in "config/environment.rb"
         
     | 
| 
       73 
73 
     | 
    
         | 
| 
       74 
74 
     | 
    
         
             
              Rails::Initializer.run do |config|
         
     | 
| 
       75 
     | 
    
         
            -
                config.gem 'dejan-auto_html', :version => '~> 1.2. 
     | 
| 
      
 75 
     | 
    
         
            +
                config.gem 'dejan-auto_html', :version => '~> 1.2.1', :lib => 'auto_html', :source => 'http://gemcutter.org'
         
     | 
| 
       76 
76 
     | 
    
         
             
              end
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
            === As a Rails plugin
         
     | 
    
        data/VERSION.yml
    CHANGED
    
    
    
        data/auto_html.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{auto_html}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "1.2. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "1.2.1"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Dejan Simic"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2009- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2009-10-28}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{Automatically transforms urls (via domain) and includes the destination resource (Vimeo, YouTube movie, image, ...) in your document}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{desimic@gmail.com}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
         @@ -1,6 +1,15 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            AutoHtml.add_filter(:vimeo).with(:width => 440, :height => 248) do |text, options|
         
     | 
| 
      
 1 
     | 
    
         
            +
            AutoHtml.add_filter(:vimeo).with(:width => 440, :height => 248, :show_title => false, :fullscreen => true, :show_byline => false, :show_portrait => false) do |text, options|
         
     | 
| 
       2 
2 
     | 
    
         
             
              text.gsub(/http:\/\/(www.)?vimeo\.com\/([A-Za-z0-9._%-]*)((\?|#)\S+)?/) do
         
     | 
| 
       3 
3 
     | 
    
         
             
                vimeo_id = $2
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                
         
     | 
| 
      
 5 
     | 
    
         
            +
                width  = options[:width]
         
     | 
| 
      
 6 
     | 
    
         
            +
                height = options[:height]
         
     | 
| 
      
 7 
     | 
    
         
            +
                
         
     | 
| 
      
 8 
     | 
    
         
            +
                allowfullscreen = options[:fullscreen]
         
     | 
| 
      
 9 
     | 
    
         
            +
                fullscreen      = options[:fullscreen]    ? 1 : 0 
         
     | 
| 
      
 10 
     | 
    
         
            +
                show_title      = options[:show_title]    ? 1 : 0
         
     | 
| 
      
 11 
     | 
    
         
            +
                show_byline     = options[:show_byline]   ? 1 : 0
         
     | 
| 
      
 12 
     | 
    
         
            +
                show_portrait   = options[:show_portrait] ? 1 : 0
         
     | 
| 
      
 13 
     | 
    
         
            +
                %{<object width="#{width}" height="#{height}"><param name="allowfullscreen" value="#{allowfullscreen}" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=#{vimeo_id}&server=vimeo.com&show_title=#{show_title}&show_byline=#{show_byline}&show_portrait=#{show_portrait}&color=00adef&fullscreen=#{fullscreen}" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=#{vimeo_id}&server=vimeo.com&show_title=#{show_title}&show_byline=#{show_byline}&show_portrait=#{show_portrait}&color=00adef&fullscreen=#{fullscreen}" type="application/x-shockwave-flash" allowfullscreen="#{allowfullscreen}" allowscriptaccess="always" width="#{options[:width]}" height="#{options[:height]}"></embed></object>}    
         
     | 
| 
       5 
14 
     | 
    
         
             
              end
         
     | 
| 
       6 
15 
     | 
    
         
             
            end
         
     | 
| 
         @@ -27,4 +27,24 @@ class VimeoTest < Test::Unit::TestCase 
     | 
|
| 
       27 
27 
     | 
    
         
             
                assert_equal '<object width="300" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="300" height="250"></embed></object>', result
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
      
 30 
     | 
    
         
            +
              def test_transform_with_fullscreen_false
         
     | 
| 
      
 31 
     | 
    
         
            +
                result = auto_html("http://www.vimeo.com/1472714") { vimeo(:width => 300, :height => 250, :fullscreen => false) }
         
     | 
| 
      
 32 
     | 
    
         
            +
                assert_equal '<object width="300" height="250"><param name="allowfullscreen" value="false" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=0" type="application/x-shockwave-flash" allowfullscreen="false" allowscriptaccess="always" width="300" height="250"></embed></object>', result
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              def test_transform_with_show_title
         
     | 
| 
      
 36 
     | 
    
         
            +
                result = auto_html("http://www.vimeo.com/1472714") { vimeo(:width => 300, :height => 250, :show_title => true) }
         
     | 
| 
      
 37 
     | 
    
         
            +
                assert_equal '<object width="300" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=1&show_byline=0&show_portrait=0&color=00adef&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=1&show_byline=0&show_portrait=0&color=00adef&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="300" height="250"></embed></object>', result
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              def test_transform_with_show_byline
         
     | 
| 
      
 41 
     | 
    
         
            +
                result = auto_html("http://www.vimeo.com/1472714") { vimeo(:width => 300, :height => 250, :show_title => true, :show_byline => true) }
         
     | 
| 
      
 42 
     | 
    
         
            +
                assert_equal '<object width="300" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00adef&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=00adef&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="300" height="250"></embed></object>', result
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              def test_transform_with_show_show_portrait
         
     | 
| 
      
 46 
     | 
    
         
            +
                result = auto_html("http://www.vimeo.com/1472714") { vimeo(:width => 300, :height => 250, :show_title => true, :show_byline => true, :show_portrait => true) }
         
     | 
| 
      
 47 
     | 
    
         
            +
                assert_equal '<object width="300" height="250"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00adef&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=1472714&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00adef&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="300" height="250"></embed></object>', result
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       30 
50 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: auto_html
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.2.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Dejan Simic
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2009- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2009-10-28 00:00:00 +01:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         |