blob: a63ee77202c2ccac614d57c9f8cffc2c153cc736 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import os
import render
class Feed(object):
def __init__(self, template, posts):
self.template = template
self.posts = Feed._remove_drafts(posts)
@staticmethod
def _remove_drafts(posts):
return list(filter(lambda x: x.metadata.status != "draft", posts))
def generate(self, basedir):
index = os.path.join(basedir, "index.html")
rendered = self.template.render(posts=self.posts)
render.write_file_content(index, rendered)
|