-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix html stripping to get entire html-ish substring
- Loading branch information
1 parent
c5b4c77
commit f246934
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<rss version="2.0"> | ||
<channel> | ||
<title>Channel title</title> | ||
<link>http://example.com/</link> | ||
<description>Channel</description> | ||
<item> | ||
<title>RSS <<< Title >>></title> | ||
</item> | ||
</channel> | ||
</rss> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
describe('strip html', function () { | ||
|
||
var feed = __dirname + '/feeds/title-with-angle-brackets.xml'; | ||
|
||
it('should aggressively strip html', function (done) { | ||
fs.createReadStream(feed).pipe(new FeedParser()) | ||
.once('readable', function () { | ||
var stream = this; | ||
assert.equal(stream.read().title, 'RSS '); | ||
done(); | ||
}) | ||
.on('error', function (err) { | ||
assert.ifError(err); | ||
done(err); | ||
}); | ||
}); | ||
|
||
}); |