Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 374fd3c

Browse files
committedMay 12, 2015
Improved category slug collision test.
Fixed error message for unknown escape sequences.
1 parent 18296cf commit 374fd3c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

Diff for: ‎nikola/nikola.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ def parse_category_name(self, category_name):
13771377
sys.exit(1)
13781378
esc_ch = category_name[next_backslash + 1]
13791379
if esc_ch not in {'/', '\\'}:
1380-
utils.LOGGER.error("Unknown escape sequence '\\{0}' in '{1}' at last position!".format(esc_ch, category_name))
1380+
utils.LOGGER.error("Unknown escape sequence '\\{0}' in '{1}'!".format(esc_ch, category_name))
13811381
sys.exit(1)
13821382
current += category_name[index:next_backslash] + esc_ch
13831383
index = next_backslash + 2

Diff for: ‎nikola/plugins/task/tags.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,16 @@ def gen_tasks(self):
107107
categories = {}
108108
for category in self.site.posts_per_category.keys():
109109
slug = tuple(self.slugify_category_name(category))
110+
for part in slug:
111+
if len(part) == 0:
112+
utils.LOGGER.error("Category '{0}' yields invalid slug '{1}'!".format(category, '/'.join(slug)))
113+
sys.exit(1)
110114
if slug in categories:
111115
other_category = categories[slug]
112116
utils.LOGGER.error('You have categories that are too similar: {0} and {1}'.format(category, other_category))
113117
utils.LOGGER.error('Category {0} is used in: {1}'.format(category, ', '.join([p.source_path for p in self.posts_per_category[category]])))
114118
utils.LOGGER.error('Category {0} is used in: {1}'.format(other_category, ', '.join([p.source_path for p in self.posts_per_category[other_category]])))
115-
pass
119+
sys.exit(1)
116120
categories[slug] = category
117121

118122
tag_list = list(self.site.posts_per_tag.items())

0 commit comments

Comments
 (0)
Please sign in to comment.