summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--lib/feed2imap/html2text-parser.rb4
-rwxr-xr-xtest/tc_converters_html2text.rb4
3 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 93d50f8..75f59c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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