wking / rss2email

open-source tool for Windows, Mac OS and UNIX for getting news from RSS feeds in email
http://pypi.python.org/pypi/rss2email/
GNU General Public License v2.0
268 stars 48 forks source link

Setting width no longer works #115

Closed Gumnos closed 5 years ago

Gumnos commented 5 years ago

Previously I could add

body-width =  72

to my config file and it would wrap as expected. I recently did a fresh install on a new machine and it looks like the underlying html2text library has possibly changed how the BODY_WIDTH is handled so it no longer wraps output. The fix would require some sort of tweak in the config.py file.

In case it matters, I have it also configured to do use-8bit = True.

Gumnos commented 5 years ago

On deeper inspection, this seems to be caused by paragraphs containing links. html2text.HTML2Text.optwrap() calls html2text.utils.skipwrap(). In the RSS item's paragraphs in question, they contain links, so skipwrap() instructs optwrap() not to wrap the paragraph at all. Looks like the immediate solution is to add a configuration option for html2text.config.WRAP_LINKS to let html2text wrap paragraphs containing links. A better solution might be to make upstream html2textsmarter about wrapping links.

Gumnos commented 5 years ago

Grr, this appears to be an upstream issue withhtml2text not producing wrapped results for lists (see html2text.utils.py:194-199 for the code in question) . Sorry for the noise.