htmlclipping 0.1.4 → 0.1.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/lib/htmlclipping.rb +5 -1
 - data/lib/htmlclipping.rb~ +5 -1
 - metadata +2 -2
 
    
        data/lib/htmlclipping.rb
    CHANGED
    
    | 
         @@ -33,7 +33,7 @@ 
     | 
|
| 
       33 
33 
     | 
    
         
             
            require 'iconv'
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
            class HtmlClipping
         
     | 
| 
       36 
     | 
    
         
            -
            	Version = '0.1. 
     | 
| 
      
 36 
     | 
    
         
            +
            	Version = '0.1.5'
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            	# html:: The HTML of the referring web page.
         
     | 
| 
       39 
39 
     | 
    
         
             
            	# referred_uri:: The URI that is being referred to.
         
     | 
| 
         @@ -187,6 +187,9 @@ class HtmlClipping 
     | 
|
| 
       187 
187 
     | 
    
         
             
            				%r{</?(acronym|nobr|abbr|strong|td|tt|small|em|img|font|span|input|hr|noscript|legend|address).*?>}im, ''
         
     | 
| 
       188 
188 
     | 
    
         
             
            			)
         
     | 
| 
       189 
189 
     | 
    
         
             
            			@detokenized.gsub!( %r{</?(b|i)(\s+.*?)?>}i, '' )
         
     | 
| 
      
 190 
     | 
    
         
            +
            			@detokenized.gsub!( %r{</?.*?>} ) do |match|
         
     | 
| 
      
 191 
     | 
    
         
            +
            				match =~ %r{</?(xhtml:)?(br|a)(\s.*?)?>}i ? match : ''
         
     | 
| 
      
 192 
     | 
    
         
            +
            			end
         
     | 
| 
       190 
193 
     | 
    
         
             
            			substitute_links
         
     | 
| 
       191 
194 
     | 
    
         
             
            			compact_brs
         
     | 
| 
       192 
195 
     | 
    
         
             
            			@detokenized.gsub!( /\s+/, ' ' )
         
     | 
| 
         @@ -201,6 +204,7 @@ class HtmlClipping 
     | 
|
| 
       201 
204 
     | 
    
         
             
            				if ( a_att =~ /href=('|")?([^'" ]*)("|')?/i )
         
     | 
| 
       202 
205 
     | 
    
         
             
            					href = $2
         
     | 
| 
       203 
206 
     | 
    
         
             
            					href.gsub!( /("|')$/, '' )
         
     | 
| 
      
 207 
     | 
    
         
            +
            					href.strip!
         
     | 
| 
       204 
208 
     | 
    
         
             
            					matches_self = ( href == @referred_uri )
         
     | 
| 
       205 
209 
     | 
    
         
             
            				else
         
     | 
| 
       206 
210 
     | 
    
         
             
            					matches_self = false
         
     | 
    
        data/lib/htmlclipping.rb~
    CHANGED
    
    | 
         @@ -33,7 +33,7 @@ 
     | 
|
| 
       33 
33 
     | 
    
         
             
            require 'iconv'
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
            class HtmlClipping
         
     | 
| 
       36 
     | 
    
         
            -
            	Version = '0.1. 
     | 
| 
      
 36 
     | 
    
         
            +
            	Version = '0.1.4'
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            	# html:: The HTML of the referring web page.
         
     | 
| 
       39 
39 
     | 
    
         
             
            	# referred_uri:: The URI that is being referred to.
         
     | 
| 
         @@ -187,6 +187,9 @@ class HtmlClipping 
     | 
|
| 
       187 
187 
     | 
    
         
             
            				%r{</?(acronym|nobr|abbr|strong|td|tt|small|em|img|font|span|input|hr|noscript|legend|address).*?>}im, ''
         
     | 
| 
       188 
188 
     | 
    
         
             
            			)
         
     | 
| 
       189 
189 
     | 
    
         
             
            			@detokenized.gsub!( %r{</?(b|i)(\s+.*?)?>}i, '' )
         
     | 
| 
      
 190 
     | 
    
         
            +
            			@detokenized.gsub!( %r{</?.*?>} ) do |match|
         
     | 
| 
      
 191 
     | 
    
         
            +
            				match =~ %r{</?(xhtml:)?(br|a)(\s.*?)?>}i ? match : ''
         
     | 
| 
      
 192 
     | 
    
         
            +
            			end
         
     | 
| 
       190 
193 
     | 
    
         
             
            			substitute_links
         
     | 
| 
       191 
194 
     | 
    
         
             
            			compact_brs
         
     | 
| 
       192 
195 
     | 
    
         
             
            			@detokenized.gsub!( /\s+/, ' ' )
         
     | 
| 
         @@ -201,6 +204,7 @@ class HtmlClipping 
     | 
|
| 
       201 
204 
     | 
    
         
             
            				if ( a_att =~ /href=('|")?([^'" ]*)("|')?/i )
         
     | 
| 
       202 
205 
     | 
    
         
             
            					href = $2
         
     | 
| 
       203 
206 
     | 
    
         
             
            					href.gsub!( /("|')$/, '' )
         
     | 
| 
      
 207 
     | 
    
         
            +
            					href.strip!
         
     | 
| 
       204 
208 
     | 
    
         
             
            					matches_self = ( href == @referred_uri )
         
     | 
| 
       205 
209 
     | 
    
         
             
            				else
         
     | 
| 
       206 
210 
     | 
    
         
             
            					matches_self = false
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -3,8 +3,8 @@ rubygems_version: 0.8.6 
     | 
|
| 
       3 
3 
     | 
    
         
             
            specification_version: 1
         
     | 
| 
       4 
4 
     | 
    
         
             
            name: htmlclipping
         
     | 
| 
       5 
5 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       6 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
       7 
     | 
    
         
            -
            date: 2005- 
     | 
| 
      
 6 
     | 
    
         
            +
              version: 0.1.5
         
     | 
| 
      
 7 
     | 
    
         
            +
            date: 2005-12-25
         
     | 
| 
       8 
8 
     | 
    
         
             
            summary: HtmlClipping generates excerpts from an HTML page that has a link pointing to a particular URI.
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_paths: 
         
     | 
| 
       10 
10 
     | 
    
         
             
              - lib
         
     |