]> git.phdru.name Git - phdru.name/phdru.name.git/blobdiff - reindex_blog.py
Partially revert the previous patch
[phdru.name/phdru.name.git] / reindex_blog.py
index a9ec95e749b3888942e9645ff954038a76878acc..33e9077aefd0e6472959c3300d1f105ea59ef6b0 100755 (executable)
@@ -2,7 +2,7 @@
 # -*- coding: koi8-r -*-
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2006-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2006-2014 PhiloSoft Design"
 
 import sys, os
 
@@ -264,13 +264,20 @@ def write_template(level, year, month, day, titles, tags=None):
       new_text.append('''
 <p class="head">�� �����:
 ''')
+
+      year_counts = {}
+      for year, month, day, file, title, lead in all_titles:
+         year_counts[year] = 0
+      for year, month, day, file, title, lead in all_titles:
+         year_counts[year] += 1
+
       first_year = True
       for year in years:
          if first_year:
             first_year = False
          else:
             new_text.append(' - ')
-         new_text.append('<a href="%s/">%s</a>' % (year, year))
+         new_text.append('<a href="%s/">%s (%d)</a>' % (year, year, year_counts[str(year)]))
       new_text.append('''
 </p>
 ''')
@@ -345,7 +352,29 @@ new_text = ["""\
 #def body_html
 <h1>����</h1>
 
-<p class="head">
+<p class="head small">
+����� ������ ��������� ������ ��������� � �����, ��������������� ���������.
+��������� ���������:</p>
+<ul class="small">
+    <li>��� - ���� ����� ��� ����������, �������ģ� ��������������� �� �������� ����.</li>
+    <li>�������� '!' (NOT, not) - ���� ������, � ������� ��� ����� ����.</li>
+    <li>�������� '&amp;' (AND, and) - ���� ������, � ������� ���� ��� ����.</li>
+    <li>�������� '|' (OR, or) - ���� ������, � ������� ���� ����� �� �����.</li>
+    <li>������ '()' ��������� ���������� ���������.</li>
+</ul>
+<p class="small">
+������� ���������: linux - �������ģ� ���������������
+�� �������� linux.html; linux&amp;!audio - ������ ������ � ������� ���� ���
+linux � ��� ���� audio; linux and not audio - �� �� �����.
+</p>
+
+<center>
+<form method=GET action="../../../cgi-bin/blog-ru/search-tags/search-tags.py">
+    <input type=text name=q>
+    <input type=submit name=submit value="������">
+</form>
+</center>
+
 <dl>
 """]
 
@@ -398,7 +427,6 @@ for i, (count, tag, links) in enumerate(all_tags):
 #def body_html
 <h1>%s</h1>
 
-<p class="head">
 <ul>
 """ % tag)
 
@@ -415,7 +443,6 @@ for i, (count, tag, links) in enumerate(all_tags):
 
    tag_text.append("""\
 </ul>
-</p>
 #end def
 $phd_site.respond(self)
 """)
@@ -423,7 +450,6 @@ $phd_site.respond(self)
 
 new_text.append("""\
 </dl>
-</p>
 #end def
 $phd_site.respond(self)
 """)
@@ -537,7 +563,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)