X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=make-news.py;h=5d196bf9760b9e83adbf3c0af772db9c51485a99;hb=3a6c1b4d3f07d18b433aaa9c79114134be3a9517;hp=2fcb7163c1352e7de1571dc16695992134ee031d;hpb=81cad035ca8ae880554bea9fe65c1f6391cca268;p=phdru.name%2Fphdru.name.git
diff --git a/make-news.py b/make-news.py
index 2fcb716..5d196bf 100755
--- a/make-news.py
+++ b/make-news.py
@@ -1,4 +1,5 @@
#! /usr/local/bin/python -O
+# -*- coding: koi8-r -*-
__version__ = "$Revision$"[11:-2]
__revision__ = "$Id$"[5:-2]
@@ -28,6 +29,27 @@ for item in news_items:
new_text.append("""\
+
+
+""")
+
+if lang == "en":
+ new_text.append("""\
+News are also available in
+Atom 1.0
+and RSS 2.0
+formats.
+""")
+
+elif lang == "ru":
+ new_text.append("""\
+îÏ×ÏÓÔÅ×ÁÑ ÌÅÎÔÁ × ÆÏÒÍÁÔÁÈ
+Atom 1.0
+É RSS 2.0
.
+""")
+
+new_text.append("""\
+
#end def
$phd_pp_ru.respond(self)
""")
@@ -41,17 +63,31 @@ from rss_20 import rss_20
namespace = {
"title": "Oleg Broytmann's Personal Page - News",
"baseURL": "http://phd.pp.ru/",
+ "indexFile": "news.html",
"description": "",
"lang": lang,
"author": "Oleg Broytmann",
"email": "phd@phd.pp.ru",
+ "generator": os.path.basename(sys.argv[0]),
"posts": news_items,
}
if lang == "ru":
namespace["title"] = "Oleg Broytmann's Personal Page - Russian News"
namespace["baseURL"] = baseURL = "http://phd.pp.ru/Russian/"
- for item in news_items: item.baseURL = baseURL
+ for item in news_items:
+ item.baseURL = baseURL
+
+for item in news_items:
+ href_parts = item.rel_link.split('/')
+ if href_parts:
+ if href_parts[0] == '.':
+ category = "Home page"
+ elif href_parts[0] == "..":
+ category = href_parts[1]
+ else:
+ category = href_parts[0]
+ if category: item.categoryList = [category]
atom_tmpl = str(atom_10(searchList=[namespace]))
write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl)