+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
+
+if blog_root:
+ baseURL = "http://phd.pp.ru/%s/" % blog_root
+else:
+ baseURL = "http://phd.pp.ru/"
+
+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)