]> git.phdru.name Git - bookmarks_db.git/commitdiff
Do all manipulations with title in one place.
authorOleg Broytman <phd@phdru.name>
Tue, 18 Dec 2007 18:40:42 +0000 (18:40 +0000)
committerOleg Broytman <phd@phdru.name>
Tue, 18 Dec 2007 18:40:42 +0000 (18:40 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@118 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Robots/bkmk_rsimple.py
Robots/parse_html.py

index 27c7dc3625c5e00554f55538bcf5c77a806d1ecd..77c7a150109509583c2eb3d5fb5f538d45806283 100644 (file)
@@ -144,9 +144,7 @@ class robot_simple(Robot):
                      if self.log: self.log("   no charset in Content-Type header")
                   if content_type == "text/html":
                      parser = parse_html(fname, charset, self.log)
-                     title = parser.title.replace('\r', '').replace('\n', ' ').strip()
-                     bookmark.real_title = parser.unescape(title)
-                     if self.log: self.log("   final title    : %s" % bookmark.real_title)
+                     bookmark.real_title = parser.title
                      if parser.refresh:
                         refresh = parser.refresh
                         try:
index 96022b07335f2ddc487f1eaea87d29f54acd5345..4117b5fd2c00bd0256db024ddb3864be99362d4a 100755 (executable)
@@ -83,7 +83,10 @@ def parse_html(filename, charset=None, log=None):
       except LookupError:
          if log: log("   unknown charset: `%s' or `%s'" % (parser.charset, current_charset))
 
-   parser.title = recode_entities(title, current_charset)
+   title = recode_entities(title, current_charset)
+   title = title.replace('\r', '').replace('\n', ' ').strip()
+   if self.log: self.log("   final title    : %s" % title)
+   parser.title = title
    return parser