示例#1
0
 def calc_tagcloud(self):
     tagcloud = merge(self.calc_tag_posts())
     for k, v in tagcloud.items():
         tag = NameSpace(
             name=k,
             count=len(v),
             size=100 + log(len(v) or 1) * 20,
         )
         yield tag
示例#2
0
 def calc_tagcloud(self):
     tagcloud = merge(self.calc_tag_posts())
     for k, v in tagcloud.iteritems():
         tag = NameSpace(
             name=k,
             count=len(v),
             size=100 + log(len(v) or 1) * 20,
         )
         yield tag
示例#3
0
 def run(self):
     _tpl = namespace.site.get('year_archive_template', None)
     for year, posts in merge(self.calc_year_posts()).iteritems():
         posts = sort_posts(posts)
         year = str(year)
         dest = os.path.join(year, 'index.html')
         params = {'title': year}
         if _tpl: params.update({'tpl': _tpl})
         self.write_pager(posts, dest, **params)
示例#4
0
 def run(self):
     _tpl = namespace.site.get('year_archive_template', None)
     for year, posts in merge(self.calc_year_posts()).iteritems():
         posts = sort_posts(posts)
         year = str(year)
         dest = os.path.join(year, 'index.html')
         params = {'title': year}
         if _tpl:
             params.update({'tpl': _tpl})
         self.write_pager(posts, dest, **params)
示例#5
0
    def run(self):
        self.write_tagcloud()

        tagcloud = merge(self.calc_tag_posts())
        _tpl = namespace.site.get('tag_archive_template', None)
        for tag, posts in tagcloud.items():
            posts = sort_posts(posts)
            dest = os.path.join('tag', tag, 'index.html')
            params = {'title': tag}
            if _tpl: params.update({'tpl': _tpl})
            self.write_pager(posts, dest, **params)
示例#6
0
    def run(self):
        self.write_tagcloud()

        tagcloud = merge(self.calc_tag_posts())
        _tpl = namespace.site.get('tag_archive_template', None)
        for tag, posts in tagcloud.items():
            posts = sort_posts(posts)
            dest = os.path.join('tag', tag, 'index.html')
            params = {'title': tag}
            if _tpl:
                params.update({'tpl': _tpl})
            self.write_pager(posts, dest, **params)
示例#7
0
 def run(self):
     key = namespace.site.get('category', 'category')
     _archive_tpl = namespace.site.get('category_archive_template', None)
     _feed_tpl = namespace.site.get('category_feed_template', None)
     for cat, posts in merge(self.calc_category_posts()).iteritems():
         posts = sort_posts(posts)
         dest = os.path.join(key, cat, 'index.html')
         params = {'title': cat}
         if _archive_tpl: params.update({'tpl': _archive_tpl})
         self.write_pager(posts, dest, **params)
         dest = os.path.join(key, cat, 'feed.xml')
         params = {'title': cat, 'folder':''}
         if _feed_tpl: params.update({'tpl': _feed_tpl})
         self.write_feed(posts, dest, **params)
示例#8
0
    def run(self):
        _archive_tpl = namespace.site.get('folder_archive_template', None)
        _feed_tpl = namespace.site.get('folder_feed_template', None)
        for folder, posts in merge(self.calc_folder_posts()).iteritems():
            posts = sort_posts(posts)
            dest = os.path.join(folder, 'index.html')
            params = {'title': folder, 'folder': folder}
            if _archive_tpl: params.update({'tpl': _archive_tpl})
            self.write_pager(posts, dest, **params)

            dest = os.path.join(folder, 'feed.xml')
            params = {'title': folder, 'folder': folder}
            if _feed_tpl: params.update({'tpl': _feed_tpl})
            self.write_feed(posts, dest, **params)
示例#9
0
 def run(self):
     key = namespace.site.get('category', 'category')
     _archive_tpl = namespace.site.get('category_archive_template', None)
     _feed_tpl = namespace.site.get('category_feed_template', None)
     for cat, posts in merge(self.calc_category_posts()).iteritems():
         posts = sort_posts(posts)
         dest = os.path.join(key, cat, 'index.html')
         params = {'title': cat}
         if _archive_tpl:
             params.update({'tpl': _archive_tpl})
         self.write_pager(posts, dest, **params)
         dest = os.path.join(key, cat, 'feed.xml')
         params = {'title': cat, 'folder': ''}
         if _feed_tpl:
             params.update({'tpl': _feed_tpl})
         self.write_feed(posts, dest, **params)
示例#10
0
    def run(self):
        _archive_tpl = namespace.site.get('folder_archive_template', None)
        _feed_tpl = namespace.site.get('folder_feed_template', None)
        for folder, posts in merge(self.calc_folder_posts()).iteritems():
            posts = sort_posts(posts)
            dest = os.path.join(folder, 'index.html')
            params = {'title': folder, 'folder': folder}
            if _archive_tpl:
                params.update({'tpl': _archive_tpl})
            self.write_pager(posts, dest, **params)

            dest = os.path.join(folder, 'feed.xml')
            params = {'title': folder, 'folder': folder}
            if _feed_tpl:
                params.update({'tpl': _feed_tpl})
            self.write_feed(posts, dest, **params)