mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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
|
|
@ -131,6 +131,18 @@ class TestUtils(LoggedTestCase):
|
|||
for value, expected in samples:
|
||||
self.assertEqual(utils.slugify(value, subs), expected)
|
||||
|
||||
def test_slugify_substitute_and_keeping_non_alphanum(self):
|
||||
|
||||
samples = (('Fedora QA', 'fedora.qa'),
|
||||
('C++ is used by Fedora QA', 'cpp is used by fedora.qa'),
|
||||
('C++ is based on C', 'cpp-is-based-on-c'),
|
||||
('C+++ test C+ test', 'cpp-test-c-test'),)
|
||||
|
||||
subs = (('Fedora QA', 'fedora.qa', True),
|
||||
('c++', 'cpp'),)
|
||||
for value, expected in samples:
|
||||
self.assertEqual(utils.slugify(value, subs), expected)
|
||||
|
||||
def test_get_relative_path(self):
|
||||
|
||||
samples = ((os.path.join('test', 'test.html'), os.pardir),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue