From 540f49bc903927c04625188342c928cd40559d56 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sat, 5 Nov 2011 00:17:47 +0100 Subject: [PATCH] Pass all tags to the template when rendering the index --- configure | 7 ++++++- core.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 917bf18..e2b3699 100755 --- a/configure +++ b/configure @@ -76,13 +76,18 @@ with open('Makefile', 'w') as makefh: + ' '.join(tags[tag]) + '\n\t$(QUIET_BUILD)./build ' + tag + '.rss ' + ' '.join(map(lambda f: f[:-4], tags[tag])) + '\n') + tagnames = tags.keys() + tagnames.sort() + with open('tags', 'w') as tagsfh: + tagsfh.write(', '.join(tagnames)) # Phony test and clean targets makefh.write("test:\n\tnosetests\n") makefh.write("clean:\n\t$(RM) " + os.path.join(outdir, "*.html") + " " + os.path.join(outdir, "*.rss") + " " - + os.path.join(outdir, tagprefix, "*.html")) + + os.path.join(outdir, tagprefix, "*.html") + " " + + "tags") # vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/core.py b/core.py index 8149ea4..d494bcf 100644 --- a/core.py +++ b/core.py @@ -186,6 +186,11 @@ class JIndex: taglen = int(self.config.get('taglen', 0)) if self.name == 'index' and indexlen > 0: context['entries'] = entries[:indexlen] + if os.path.exists('tags'): + with open('tags') as tagsfh: + context['tags'] = tagsfh.read() + else: + context['tags'] = '' elif self.name.endswith('.rss') and rsslen > 0: context['entries'] = entries[:rsslen] elif (not (self.name.endswith('.rss') or self.name == 'archive')) and taglen > 0: -- 1.7.6