diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2005-08-26 14:30:08 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2005-08-26 14:30:08 +0000 |
commit | 2298509476727c7b67b6e9f1623d953c44c71853 (patch) | |
tree | 3cfb9a8d3769674c0f316f875d3e93ad685c3d21 | |
parent | 34963a00abbd92d4fec6d062fd9e9239996e41a3 (diff) | |
download | feed2imap-2298509476727c7b67b6e9f1623d953c44c71853.tar.gz feed2imap-2298509476727c7b67b6e9f1623d953c44c71853.tar.bz2 feed2imap-2298509476727c7b67b6e9f1623d953c44c71853.zip |
html2text bug with <a> without href
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@56 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/feed2imap/html2text-parser.rb | 4 | ||||
-rwxr-xr-x | test/tc_converters_html2text.rb | 4 |
3 files changed, 6 insertions, 3 deletions
@@ -1,5 +1,6 @@ Feed2Imap 0.5 (XX/XX/2005) ============================ +* Fixed a bug in the HTML2Text converter with <a> tags without href. * Reserved characters (eg @) can now be included in the login/password. * Feed2Imap is now included in Debian (package name: feed2imap). * Much better handling of feeds with escaped HTML (LinuxFR for example). diff --git a/lib/feed2imap/html2text-parser.rb b/lib/feed2imap/html2text-parser.rb index a6bf400..51bebfe 100644 --- a/lib/feed2imap/html2text-parser.rb +++ b/lib/feed2imap/html2text-parser.rb @@ -62,7 +62,9 @@ class HTML2TextParser < SGMLParser @href = a[1] end end - @links << @href.gsub(/^("|'|)(.*)("|')$/,'\2') + if @href + @links << @href.gsub(/^("|'|)(.*)("|')$/,'\2') + end end end diff --git a/test/tc_converters_html2text.rb b/test/tc_converters_html2text.rb index 8074672..f17e47d 100755 --- a/test/tc_converters_html2text.rb +++ b/test/tc_converters_html2text.rb @@ -76,9 +76,9 @@ test de caractères étendus : éàèç ah ah def test_link inputtext = <<-EOF -<p>ceci est un <a href="http://slashdot.org" style="">lien</a>. Ceci est un <a href=http://linuxfr.org/>autre lien</a></p> +<p>ceci est un <a href="http://slashdot.org" style="">lien</a>. Ceci est un <a href=http://linuxfr.org/>autre lien</a> <a name="namedlink">named link</a></p> EOF - outputtext = "ceci est un lien[1]. Ceci est un autre lien[2]\n\n[1] http://slashdot.org\n[2] http://linuxfr.org/" + outputtext = "ceci est un lien[1]. Ceci est un autre lien[2] named link\n\n[1] http://slashdot.org\n[2] http://linuxfr.org/" assert_equal(outputtext, inputtext.html2text) end end |