diff --git a/generators/archive.py b/generators/archive.py
index 72907ba..076d1d9 100644
--- a/generators/archive.py
+++ b/generators/archive.py
@@ -62,20 +62,18 @@ class Archive(Index):
if i < nb_post-1:
if posts[i].creation_date.year != posts[i+1].creation_date.year:
- dom = parse(src + '/_archive.html')
my_post.reverse()
+
self.nb_pages = 0
self.cur_page = 0
self.cur_post = 0
self.dirname = '/archive/' + str(self.cur_year)
- self.generatePages(dom, my_post, src, output, 'archive', 'archive')
+ self.generatePages(dom, my_post, src, output, 'archive')
self.cur_year = int(posts[i+1].creation_date.year)
#print 'New year ' + str(self.cur_year)
my_post = []
- if self.cur_year == int(now.year):
- break
else:
my_post.append(posts[i])
else:
diff --git a/generators/category.py b/generators/category.py
index c4ae369..0f2c739 100644
--- a/generators/category.py
+++ b/generators/category.py
@@ -60,7 +60,7 @@ class Category(Index):
self.dirname = '/category/' + category.name_slug
- self.generatePages(dom, posts, src, output, 'category', 'category')
+ self.generatePages(dom, posts, src, output, 'category')
if not self.somethingWrote:
self.addReport('Nothing changed')
diff --git a/generators/index.py b/generators/index.py
index 7a82610..6dacdbd 100644
--- a/generators/index.py
+++ b/generators/index.py
@@ -294,7 +294,7 @@ class Index(DynastieGenerator):
from dynastie.models import Post
tags_elem = self.createElement(dom, 'tags')
create_link = (node.getAttribute('link') == '1')
- if type(posts) == models.query.QuerySet:
+ if type(posts) == models.query.QuerySet or type(posts) == list:
if len(posts) > self.cur_post:
cur_post = posts[self.cur_post]
else:
@@ -386,7 +386,7 @@ class Index(DynastieGenerator):
return code
- def parseTemplate(self, blog, src, output, name, directory=None):
+ def parseTemplate(self, blog, src, output, name, directory=None, parsePostsTag=True):
self.blog = blog
if not os.path.exists(src + '/_%s.html' % name):
@@ -402,6 +402,8 @@ class Index(DynastieGenerator):
if not directory is None and not os.path.exists(output + '/' + directory):
os.mkdir(output + '/' + directory)
+ if not parsePostsTag: return dom
+
post_nodes = dom.getElementsByTagNameNS(self.URI, "posts")
if not post_nodes is None:
@@ -414,11 +416,11 @@ class Index(DynastieGenerator):
return dom
- def generatePages(self, dom, posts, src, output, name, directory=None):
+ def generatePages(self, dom, posts, src, output, name):
if len(posts) > self.posts_per_page:
self.nb_pages = self.computeNbPages(len(posts), self.posts_per_page)
- if not directory is None and not os.path.exists(output + self.dirname):
+ if not os.path.exists(output + self.dirname):
os.mkdir(output + self.dirname)
filename = self.dirname + '/' + self.filename + '.html'
diff --git a/generators/post.py b/generators/post.py
index 4b15893..7e84bbb 100644
--- a/generators/post.py
+++ b/generators/post.py
@@ -179,18 +179,8 @@ class Post(Index):
del self.hooks['recents']
del self.hooks['posts']
- self.blog = blog
- name = 'post'
-
- if not os.path.exists(src + '/_%s.html' % name):
- self.addError('No _%s.html found, exiting' % name)
- return self.report
-
- try:
- dom = parse(src + '/_%s.html' % name)
- except xml.dom.DOMException as e:
- self.addError('Error parsing _%s.html : ' + e)
- return self.report
+ dom = self.parseTemplate(blog, src, output, 'post', None, False)
+ if dom is None: return self.report
impl = xml.dom.getDOMImplementation()
for post in posts:
diff --git a/generators/tag.py b/generators/tag.py
index e4666fe..8236646 100644
--- a/generators/tag.py
+++ b/generators/tag.py
@@ -60,7 +60,7 @@ class Tag(Index):
self.dirname = '/tag/' + tag.name_slug
- self.generatePages(dom, posts, src, output, 'tag', 'tag')
+ self.generatePages(dom, posts, src, output, 'tag')
if not self.somethingWrote:
self.addReport('Nothing changed')
diff --git a/sites/blog.soutade.fr/_base.html b/sites/blog.soutade.fr/_base.html
index fe978b5..5f23ee3 100755
--- a/sites/blog.soutade.fr/_base.html
+++ b/sites/blog.soutade.fr/_base.html
@@ -83,7 +83,7 @@
diff --git a/sites/blog.soutade.fr/_base_post.html b/sites/blog.soutade.fr/_base_post.html
index bd2a1c9..b8d4b6e 100644
--- a/sites/blog.soutade.fr/_base_post.html
+++ b/sites/blog.soutade.fr/_base_post.html
@@ -85,7 +85,7 @@