outfile.close()
-def write_template(level, year, month, day, titles):
+def write_template(level, year, month, day, titles, tags=None):
path = []
if level >= 1:
path.append(year)
years = {}
for year, month, day, file, title, lead in save_titles:
years[year] = True
- first_year = True
new_text.append('''
<hr>
-<p class="years">
+<p class="noindent"><a href="tags/">Теги</a>:
+''')
+ first_tag = True
+ for count, tag, links in all_tags:
+ if first_tag:
+ first_tag = False
+ else:
+ new_text.append(' - ')
+ new_text.append("""<a href="tags/%s.html">%s (%d)</a>""" % (tag, tag, count))
+ new_text.append('''
+</p>
''')
+
+ new_text.append('''
+<p class="noindent">По годам:
+''')
+ first_year = True
for year in sorted(years.keys()):
if first_year:
first_year = False
write_template(3, year, month, day, day_titles)
write_template(2, year, month, day, month_titles)
write_template(1, year, month, day, year_titles)
-write_template(0, year, month, day, all_titles[-20:])
all_tags = [(len(links), tag, links) for (tag, links) in all_tags.items()]
all_tags.sort()
+write_template(0, year, month, day, all_titles[-20:], all_tags)
+
new_text = ["""\
## THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
#extends phd_pp_ru