]> git.phdru.name Git - phdru.name/phdru.name.git/blobdiff - reindex_blog.py
Fix [ -nt ]-test for /bin/sh
[phdru.name/phdru.name.git] / reindex_blog.py
index 82cdde591b34951ef3d82a9a2bc5ff01331801a6..c2a87c603062d38d493ed1bef8031b88413ff47a 100755 (executable)
@@ -2,9 +2,10 @@
 # -*- coding: koi8-r -*-
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2006-2013 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2006-2017 PhiloSoft Design"
 
 import sys, os
+from Cheetah.compat import string_type
 
 blog_data_root = sys.argv[1]
 blog_root = sys.argv[2]
@@ -54,7 +55,7 @@ for dirpath, dirs, files in os.walk(blog_root):
       lead = template.Lead.decode('utf-8').encode('koi8-r')
 
       tags = template.Tag
-      if isinstance(tags, basestring):
+      if isinstance(tags, string_type):
          tags = (tags,)
       tags = [tag.decode('utf-8').encode('koi8-r') for tag in tags]
 
@@ -360,7 +361,7 @@ new_text = ["""\
     <li>Оператор '!' (NOT, not) - ищет записи, в которых нет этого тега.</li>
     <li>Оператор '&amp;' (AND, and) - ищет записи, в которых есть оба тега.</li>
     <li>Оператор '|' (OR, or) - ищет записи, в которых есть любые из тегов.</li>
-    <li>Скобки '()' позволяют объединять выражения.</li>
+    <li>Приоритет операций стандартный: NOT &gt; AND &gt; OR. Скобки '()' позволяют объединять выражения.</li>
 </ul>
 <p class="small">
 Примеры выражений: linux - произойдёт перенаправление
@@ -375,7 +376,6 @@ linux 
 </form>
 </center>
 
-<p class="head">
 <dl>
 """]
 
@@ -428,7 +428,6 @@ for i, (count, tag, links) in enumerate(all_tags):
 #def body_html
 <h1>%s</h1>
 
-<p class="head">
 <ul>
 """ % tag)
 
@@ -445,7 +444,6 @@ for i, (count, tag, links) in enumerate(all_tags):
 
    tag_text.append("""\
 </ul>
-</p>
 #end def
 $phd_site.respond(self)
 """)
@@ -453,7 +451,6 @@ $phd_site.respond(self)
 
 new_text.append("""\
 </dl>
-</p>
 #end def
 $phd_site.respond(self)
 """)
@@ -567,7 +564,6 @@ for item in tuple(reversed(all_titles_tags))[:10]:
    item.categoryList = tags
    body = bodies[(year, month, day, file)]
    body = absolute_urls(body, baseURL + url_path)
-   body = body.decode('koi8-r').encode('utf-8')
    item.body = body
    item.excerpt = get_first_p(body)