From: Oleg Broytman Date: Fri, 17 Mar 2006 13:32:51 +0000 (+0000) Subject: Category - the first essential part of the link. X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=fc837f18ffeafc4d71e77f1cd47c99f3eef1f841;p=phdru.name%2Fphdru.name.git Category - the first essential part of the link. git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@35 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- diff --git a/make-news.py b/make-news.py index 2fcb716..e9ab91e 100755 --- a/make-news.py +++ b/make-news.py @@ -51,7 +51,19 @@ namespace = { 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)