From: Oleg Broytman Date: Thu, 27 Dec 2007 19:33:24 +0000 (+0000) Subject: Strip every line in title. X-Git-Tag: v4.5.3~241 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=5bf527cabbb158190e9b1ac17e19684135d9a6d2;p=bookmarks_db.git Strip every line in title. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@135 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/parse_html.py b/Robots/parse_html.py index 666c707..d3870fa 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -87,7 +87,8 @@ def parse_html(filename, charset=None, log=None): if log: log(" unknown charset: `%s' or `%s'" % (parser.charset, current_charset)) title = recode_entities(title, current_charset) - title = title.replace('\r', '').replace('\n', ' ').strip() + parts = [s.strip() for s in title.replace('\r', '').split('\n')] + title = ' '.join([s for s in parts if s]) if log: log(" final title : %s" % title) parser.title = title return parser