]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/parse_html.py
Strip every line in title.
[bookmarks_db.git] / Robots / parse_html.py
index 666c7071fd0072a8249b9e2bf8a0ba4cb4a6e3c6..d3870fa210b8c3bdeefdac3c45d05aa13ec6cc1a 100755 (executable)
@@ -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