gpodder / podcastparser

Simplified, fast RSS parsing library in Python
ISC License
135 stars 35 forks source link

Do not strip '\n' or '\r' in squash_whitespace() #24

Closed tpikonen closed 3 years ago

tpikonen commented 4 years ago

Currently episode descriptions are stripped of newlines with squash_whitespace(). This makes longer descriptions unreadable in gpodder. This patch modifies squash_whitespace() to squash only whitespace other than newlines.

Note that squash_whitespace() is also used for the title, where removing newlines might make more sense. Should the titles perhaps be handled separately?

The second commit uses raw Pythons strings in regexps consistently, as is the recommendation. This fixes a few DeprecationWarnings in tests.

auouymous commented 4 years ago

Adding a squash_whitespace_except_linefeeds function for descriptions would allow titles to continue using the current squash_whitespace.

tpikonen commented 4 years ago

Ok, I rewrote the patch. This adds function squash_whitespace_not_nl() which is used for descriptions.

auouymous commented 4 years ago

I don't know why, but this patch also fixes URL highlighting in gpodder descriptions. Thanks!

elelay commented 3 years ago

Merged, thanks