1
0
Fork 0
forked from github/pelican

More granular control of tags and categories slugs. Fixes #1873

- add TAG_SUBSTITUTIONS AND CATEGORY_SUBSTITURIONS settings
- make slugify keep non-alphanumeric characters if configured
This commit is contained in:
Mr. Senko 2016-03-14 00:16:58 +02:00
commit 648165b839
8 changed files with 123 additions and 8 deletions

View file

@ -56,3 +56,18 @@ class TestURLWrapper(unittest.TestCase):
cat_ascii = Category('指導書', settings={})
self.assertEqual(cat_ascii, u'zhi-dao-shu')
def test_slugify_with_substitutions_and_dots(self):
tag = Tag('Tag Dot',
settings={
'TAG_SUBSTITUTIONS': [('Tag Dot', 'tag.dot', True)]
})
cat = Category('Category Dot',
settings={
'CATEGORY_SUBSTITUTIONS': (('Category Dot',
'cat.dot',
True),)
})
self.assertEqual(tag.slug, 'tag.dot')
self.assertEqual(cat.slug, 'cat.dot')