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:
parent
70665ea0fa
commit
648165b839
8 changed files with 123 additions and 8 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue