diff --git a/generators/index.py b/generators/index.py index bae8c30..a6f78dd 100644 --- a/generators/index.py +++ b/generators/index.py @@ -22,10 +22,11 @@ class Index(DynastieGenerator): self.hooks = {'posts' : self.createPosts, 'title' : self.createTitle, + 'date' : self.createDate, 'navigation' : self.createNavigation, - 'recents' : self.createRecents, + 'recents' : self.createRecents, 'tags' : self.createTags, - 'replace' : self.createReplace} + 'replace' : self.createReplace} self.first_try = True @@ -106,6 +107,16 @@ class Index(DynastieGenerator): root.replaceChild(node, title_elem) + def createDate(self, posts, dom, root, date_elem): + date_format = date_elem.getAttribute('format') + if date_format == '': + date_format = '%A, %d %B %Y %H:%m' + + post = self.cur_post_obj + node = self.createElement(dom, 'date', post.creation_date.strftime(date_format)) + + root.replaceChild(node, date_elem) + def createPost(self, posts, dom, post_elem, root): post = self.cur_post_obj @@ -115,7 +126,6 @@ class Index(DynastieGenerator): values = {} values['author'] = post.author.first_name + ' ' + post.author.last_name - values['date'] = post.creation_date.strftime('%A, %d %B %Y %H:%m') values['post_content'] = '' blog = post.blog