Merge pull request #1760 from jml/export-hidden-pages

Export hidden pages in context
This commit is contained in:
Justin Mayer 2015-06-27 08:58:37 -07:00
commit 3f69a1fb62
3 changed files with 10 additions and 2 deletions

View file

@ -77,11 +77,13 @@ articles The list of articles, ordered descending by date.
in the `all_articles` variable. in the `all_articles` variable.
dates The same list of articles, but ordered by date, dates The same list of articles, but ordered by date,
ascending. ascending.
drafts The list of draft articles
tags A list of (tag, articles) tuples, containing all tags A list of (tag, articles) tuples, containing all
the tags. the tags.
categories A list of (category, articles) tuples, containing categories A list of (category, articles) tuples, containing
all the categories and corresponding articles (values) all the categories and corresponding articles (values)
pages The list of pages pages The list of pages
hidden_pages The list of hidden pages
============= =================================================== ============= ===================================================

View file

@ -577,7 +577,7 @@ class ArticlesGenerator(CachingGenerator):
self.authors.sort() self.authors.sort()
self._update_context(('articles', 'dates', 'tags', 'categories', self._update_context(('articles', 'dates', 'tags', 'categories',
'authors', 'related_posts')) 'authors', 'related_posts', 'drafts'))
self.save_cache() self.save_cache()
self.readers.save_cache() self.readers.save_cache()
signals.article_generator_finalized.send(self) signals.article_generator_finalized.send(self)
@ -643,7 +643,7 @@ class PagesGenerator(CachingGenerator):
self.hidden_pages, self.hidden_translations = ( self.hidden_pages, self.hidden_translations = (
process_translations(hidden_pages)) process_translations(hidden_pages))
self._update_context(('pages', )) self._update_context(('pages', 'hidden_pages'))
self.context['PAGES'] = self.pages self.context['PAGES'] = self.pages
self.save_cache() self.save_cache()

View file

@ -491,7 +491,13 @@ class TestPageGenerator(unittest.TestCase):
] ]
self.assertEqual(sorted(pages_expected), sorted(pages)) self.assertEqual(sorted(pages_expected), sorted(pages))
self.assertEqual(
sorted(pages_expected),
sorted(self.distill_pages(generator.context['pages'])))
self.assertEqual(sorted(hidden_pages_expected), sorted(hidden_pages)) self.assertEqual(sorted(hidden_pages_expected), sorted(hidden_pages))
self.assertEqual(
sorted(hidden_pages_expected),
sorted(self.distill_pages(generator.context['hidden_pages'])))
def test_generate_sorted(self): def test_generate_sorted(self):
settings = get_settings(filenames={}) settings = get_settings(filenames={})