diff --git a/pelican/settings.py b/pelican/settings.py index a4033001..a5cbc69f 100644 --- a/pelican/settings.py +++ b/pelican/settings.py @@ -144,7 +144,9 @@ DEFAULT_CONFIG = { 'TEMPLATE_EXTENSIONS': ['.html'], 'IGNORE_FILES': ['.#*'], 'SLUG_REGEX_SUBSTITUTIONS': [ - (r'[^\w\s-]', ''), # remove non-alphabetical/whitespace/'-' chars + # remove all characters except alphanumeric, whitespace, + # '_', '-', '+', '#' characters + (r'[^\w\s\-#\+]', ''), (r'(?u)\A\s*', ''), # strip leading whitespace (r'(?u)\s*\Z', ''), # strip trailing whitespace (r'[-\s]+', '-'), # reduce multiple whitespace or '-' to single '-' @@ -387,7 +389,7 @@ def handle_deprecated_settings(settings): if replace: regex_subs += [ - (r'[^\w\s-]', ''), + (r'[^\w\s\-#\+]', ''), (r'(?u)\A\s*', ''), (r'(?u)\s*\Z', ''), (r'[-\s]+', '-'), diff --git a/pelican/tests/test_utils.py b/pelican/tests/test_utils.py index ad90a78e..53346508 100644 --- a/pelican/tests/test_utils.py +++ b/pelican/tests/test_utils.py @@ -125,7 +125,7 @@ class TestUtils(LoggedTestCase): def test_slugify_substitute(self): samples = (('C++ is based on C', 'cpp-is-based-on-c'), - ('C+++ test C+ test', 'cpp-test-c-test'), + ('C+++ test C+ test', 'cpp+-test-c+-test'), ('c++, c#, C#, C++', 'cpp-c-sharp-c-sharp-cpp'), ('c++-streams', 'cpp-streams'),)