#attr $Title = "Oleg BroytMann's blog"
#attr $Description = "BroytMann Russian Blog Index Document"
#attr $Copyright = %(cyear)s
+#attr $alternates = (("application/atom+xml", "News [Atom 1.0]", "atom_10.xml"),
+ ("application/rss+xml", "News [RSS 2.0]", "rss_20.xml")
+)
##
#def body_html
<H1>Журнал</H1>
''' % (lead, href, title))
if level == 0:
+ new_text.append("""
+<hr>
+
+<p class="head">Новостевая лента в форматах
+<A HREF="atom_10.xml">Atom 1.0 <img src="../../Graphics/atom_10.jpg" border=0></A>
+и <A HREF="rss_20.xml">RSS 2.0 <img src="../../Graphics/rss_20.jpg" border=0></A>.
+</p>
+""")
+
years = {}
for year, month, day, file, title, lead in save_titles:
years[year] = True
new_text.append('''
-<hr>
-
-<p class="noindent"><a href="tags/">Теги</a>:
+<p class="head"><a href="tags/">Теги</a>:
''')
first_tag = True
for count, tag, links in all_tags:
''')
new_text.append('''
-<p class="noindent">По годам:
+<p class="head">По годам:
''')
first_year = True
for year in sorted(years.keys()):
write_if_changed(index_name, ''.join(new_text))
-all_titles = []
all_tags = {}
+all_titles = []
+all_titles_tags = []
for year in sorted(years.keys()):
year_titles = []
for file, title, lead, tags in blog[key]:
if file.endswith(".tmpl"): file = file[:-len("tmpl")] + "html"
value = (year, month, day, file, title, lead)
+ all_titles_tags.append((year, month, day, file, title, lead, tags))
all_titles.append(value)
year_titles.append(value)
month_titles.append(value)
$phd_pp_ru.respond(self)
""")
write_if_changed(os.path.join(blog_root, "tags", "index.tmpl"), ''.join(new_text))
+
+
+from atom_10 import atom_10
+from rss_20 import rss_20
+from news import NewsItem
+
+baseURL = "http://phd.pp.ru/Russian/blog/"
+
+items = []
+for item in tuple(reversed(all_titles_tags))[:10]:
+ year, month, day, file, title, lead, tags = item
+ if lead:
+ lead = lead + ' '
+ else:
+ lead = ''
+ item = NewsItem(
+ "%s-%s-%s" % (year, month, day),
+ "%s%s" % (lead, title),
+ "%s/%s/%s/%s" % (year, month, day, file)
+ )
+ items.append(item)
+ item.baseURL = baseURL
+ item.categoryList = tags
+
+namespace = {
+ "title": "Oleg Broytmann's blog",
+ "baseURL": baseURL,
+ "indexFile": "",
+ "description": "",
+ "lang": "ru",
+ "author": "Oleg Broytmann",
+ "email": "phd@phd.pp.ru",
+ "generator": os.path.basename(sys.argv[0]),
+ "posts": items,
+}
+
+# For english dates
+locale.setlocale(locale.LC_TIME, 'C')
+
+atom_tmpl = str(atom_10(searchList=[namespace]))
+write_if_changed(os.path.join(blog_root, "atom_10.xml"), atom_tmpl)
+rss_tmpl = str(rss_20(searchList=[namespace]))
+write_if_changed(os.path.join(blog_root, "rss_20.xml"), rss_tmpl)