forked from github/pelican
merge with master
This commit is contained in:
parent
0fe1453c50
commit
8a842c0de7
2 changed files with 11 additions and 3 deletions
|
|
@ -303,10 +303,12 @@ class ArticlesGenerator(Generator):
|
|||
|
||||
# order the categories per name
|
||||
self.categories = list(self.categories.items())
|
||||
self.categories.sort(reverse=self.settings['REVERSE_CATEGORY_ORDER'])
|
||||
self.categories.sort(
|
||||
key=lambda item: item[0].name,
|
||||
reverse=self.settings['REVERSE_CATEGORY_ORDER'])
|
||||
|
||||
self.authors = list(self.authors.items())
|
||||
self.authors.sort()
|
||||
self.authors.sort(key=lambda item: item[0].name)
|
||||
|
||||
self._update_context(('articles', 'dates', 'tags', 'categories',
|
||||
'tag_cloud', 'authors'))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
from mock import MagicMock
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
from pelican.generators import ArticlesGenerator, LessCSSGenerator
|
||||
from pelican.settings import _DEFAULT_CONFIG
|
||||
|
|
@ -11,6 +10,7 @@ from .support import unittest, temporary_folder, skipIfNoExecutable
|
|||
|
||||
CUR_DIR = os.path.dirname(__file__)
|
||||
|
||||
|
||||
class TestArticlesGenerator(unittest.TestCase):
|
||||
|
||||
def test_generate_feeds(self):
|
||||
|
|
@ -48,6 +48,12 @@ class TestArticlesGenerator(unittest.TestCase):
|
|||
elif relfilepath == "article_without_category.rst":
|
||||
self.assertEquals(article.category.name, 'Default')
|
||||
|
||||
categories = [cat.name for cat, _ in generator.categories]
|
||||
# assert that the categories are ordered as expected
|
||||
self.assertEquals(
|
||||
categories, ['Default', 'TestCategory', 'Yeah', 'test',
|
||||
'yeah'])
|
||||
|
||||
|
||||
class TestLessCSSGenerator(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue