htmlclipping 0.1.3 → 0.1.4
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 +3 -3
- data/lib/htmlclipping.rb~ +7 -3
- metadata +2 -2
data/lib/htmlclipping.rb
CHANGED
@@ -33,16 +33,16 @@
|
|
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.
|
40
40
|
# excerpt_limit:: The maximum size of the resulting clipping
|
41
41
|
def initialize( html, referred_uri, excerpt_limit )
|
42
42
|
@contents = html
|
43
|
-
if @contents =~ %r{<meta
|
43
|
+
if @contents =~ %r{<meta[^>]*charset=("|')?(.*?)('|")}i
|
44
44
|
begin
|
45
|
-
@converter = Iconv.new( '
|
45
|
+
@converter = Iconv.new( 'utf8', $2 )
|
46
46
|
rescue Errno::EINVAL
|
47
47
|
# skip it
|
48
48
|
end
|
data/lib/htmlclipping.rb~
CHANGED
@@ -33,15 +33,19 @@
|
|
33
33
|
require 'iconv'
|
34
34
|
|
35
35
|
class HtmlClipping
|
36
|
-
Version = '0.1.
|
36
|
+
Version = '0.1.3'
|
37
37
|
|
38
38
|
# html:: The HTML of the referring web page.
|
39
39
|
# referred_uri:: The URI that is being referred to.
|
40
40
|
# excerpt_limit:: The maximum size of the resulting clipping
|
41
41
|
def initialize( html, referred_uri, excerpt_limit )
|
42
42
|
@contents = html
|
43
|
-
if @contents =~ %r{<meta
|
44
|
-
|
43
|
+
if @contents =~ %r{<meta[^>]*charset=("|')?(.*?)('|")}i
|
44
|
+
begin
|
45
|
+
@converter = Iconv.new( 'utf8', $2 )
|
46
|
+
rescue Errno::EINVAL
|
47
|
+
# skip it
|
48
|
+
end
|
45
49
|
end
|
46
50
|
@referred_uri = referred_uri
|
47
51
|
@excerpt_limit = excerpt_limit
|
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.4
|
7
|
+
date: 2005-11-04
|
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
|