Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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))
Пример #5
0
 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)
Пример #6
0
 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))
Пример #7
0
 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)
Пример #8
0
 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)
Пример #9
0
 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)
Пример #10
0
 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)
Пример #11
0
 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)
Пример #12
0
 def render(self):
     # render category index
     categories = list(self.blog.categoryposts.keys())
     categories.sort()
     render('categories.html', 'category/index.html', categories=categories)
Пример #13
0
 def render(self):
     # render main feed
     feedposts = self.blog.posts[-10:]
     feedposts.reverse()
     render('atom.html', 'feed.atom', posts=feedposts)
Пример #14
0
 def render(self):
     # render index page
     startposts = self.blog.posts[-5:]
     startposts.reverse()
     render('chronological.html', 'index.html', posts=startposts)
Пример #15
0
 def render(self):
     blogurl = self.blog.config['blog']['url']
     dirname = self.permalink.replace('{}/'.format(blogurl), '')
     render('article.html', '{}/index.html'.format(dirname), post=self)
Пример #16
0
 def render(self):
     # render index page
     startposts = self.blog.posts[-5:]
     startposts.reverse()
     render('chronological.html', 'index.html', posts=startposts)
Пример #17
0
 def render(self):
     # render author index
     render('author-index.html', 'author/index.html', authors=self.blog.authors)
Пример #18
0
 def render(self):
     # render category index
     categories = list(self.blog.categoryposts.keys())
     categories.sort()
     render('categories.html', 'category/index.html', categories=categories)
Пример #19
0
 def render(self):
     # render main feed
     feedposts = self.blog.posts[-10:]
     feedposts.reverse()
     render('atom.html', 'feed.atom', posts=feedposts)
Пример #20
0
 def render(self):
     # render author index
     render('author-index.html',
            'author/index.html',
            authors=self.blog.authors)
Пример #21
0
 def render(self):
     # render author index
     render("author-index.html", "author/index.html", authors=self.blog.authors)
Пример #22
0
 def render(self):
     # render author pages
     for author in self.blog.authors:
         render('author.html', 'author/{}/index.html'.format(author.nick), author=author)
Пример #23
0
 def render(self):
     # render author pages
     for author in self.blog.authors:
         render('author.html',
                'author/{}/index.html'.format(author.nick),
                author=author)
Пример #24
0
 def render(self):
     blogurl = self.blog.config['blog']['url']
     dirname = self.permalink.replace('{}/'.format(blogurl), '')
     render('article.html', '{}/index.html'.format(dirname), post=self)
Пример #25
0
 def render(self):
     # render main feed
     feedposts = self.blog.posts[-10:]
     feedposts.reverse()
     render("atom.html", "feed.atom", posts=feedposts)