def render(self): # static page rendering for path, directories, files in walk("src/"): for filename in files: if filename.endswith(".html"): fname = "{}/{}".format(path.replace("src/", ""), filename) render("{}/{}".format(path, filename), fname)
def render(self): # static page rendering for path, directories, files in walk('src/'): for filename in files: if filename.endswith('.html'): fname = '{}/{}'.format(path.replace('src/', ''), filename) render('{}/{}'.format(path, filename), fname)
def test_render(self): # Workaround for Python < 3.4 if 'blog' not in jinja.globals: jinja.globals['blog'] = TestBlog() jinja.globals['now'] = datetime.utcnow() render('site.html', 'test.html') self.assertTrue(access('dst/test.html', F_OK))
def render(self): # render category pages for category in self.blog.categoryposts.keys(): thisposts = sorted(self.blog.categoryposts[category], key=attrgetter('date')) thisposts.reverse() render('category.html', 'category/{}/index.html'.format(category), category=category, posts=thisposts)
def render(self): # render category feeds for category in self.blog.categoryposts.keys(): feedposts = sorted(self.blog.categoryposts[category], key=attrgetter('date'))[-10:] feedposts.reverse() render('atom.html', 'category/{}/feed.atom'.format(category), posts=feedposts)
def render(self): # render archive pages timeposts = {} for post in self.blog.posts: if post.date.year not in timeposts: timeposts[post.date.year] = {} if post.date.month not in timeposts[post.date.year]: timeposts[post.date.year][post.date.month] = [] timeposts[post.date.year][post.date.month].append(post) for year in timeposts.keys(): for month in timeposts[year].keys(): archiveposts = sorted(timeposts[year][month], key=attrgetter('date')) archiveposts.reverse() render('archive-posts.html', 'archive/{}/{}/index.html'.format(year, month), year=year, month=month, posts=archiveposts) months = list(timeposts[year].keys()) months.sort() render('archive-annual.html', 'archive/{}/index.html'.format(year), months=months, year=year, yearposts=timeposts[year]) years = list(timeposts.keys()) years.sort() render('archive.html', 'archive/index.html', years=years)
def render(self): # render archive pages timeposts = {} for post in self.blog.posts: if post.date.year not in timeposts: timeposts[post.date.year] = {} if post.date.month not in timeposts[post.date.year]: timeposts[post.date.year][post.date.month] = [] timeposts[post.date.year][post.date.month].append(post) for year in timeposts.keys(): for month in timeposts[year].keys(): archiveposts = sorted(timeposts[year][month], key=attrgetter("date")) archiveposts.reverse() render( "archive-posts.html", "archive/{}/{}/index.html".format(year, month), year=year, month=month, posts=archiveposts, ) months = list(timeposts[year].keys()) months.sort() render( "archive-annual.html", "archive/{}/index.html".format(year), months=months, year=year, yearposts=timeposts[year], ) years = list(timeposts.keys()) years.sort() render("archive.html", "archive/index.html", years=years)
def render(self): # render category index categories = list(self.blog.categoryposts.keys()) categories.sort() render('categories.html', 'category/index.html', categories=categories)
def render(self): # render main feed feedposts = self.blog.posts[-10:] feedposts.reverse() render('atom.html', 'feed.atom', posts=feedposts)
def render(self): # render index page startposts = self.blog.posts[-5:] startposts.reverse() render('chronological.html', 'index.html', posts=startposts)
def render(self): blogurl = self.blog.config['blog']['url'] dirname = self.permalink.replace('{}/'.format(blogurl), '') render('article.html', '{}/index.html'.format(dirname), post=self)
def render(self): # render author index render('author-index.html', 'author/index.html', authors=self.blog.authors)
def render(self): # render author index render("author-index.html", "author/index.html", authors=self.blog.authors)
def render(self): # render author pages for author in self.blog.authors: render('author.html', 'author/{}/index.html'.format(author.nick), author=author)
def render(self): # render main feed feedposts = self.blog.posts[-10:] feedposts.reverse() render("atom.html", "feed.atom", posts=feedposts)