Skip to content

Commit

Permalink
Fix #1022
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Feb 5, 2014
1 parent a9fb0e6 commit 98604e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -10,6 +10,7 @@ Features
Bugfixes
--------

* If two tags generate the same slug, they are the same tag (Issue #1022)
* Support PRETTY_URLS for tag files (Issue #655)
* Remove conflicting CSS code from rst.css (Issue #913)
* Fix image URLs in galleries (Issue #986)
Expand Down
8 changes: 4 additions & 4 deletions nikola/nikola.py
Expand Up @@ -928,7 +928,7 @@ def scan_posts(self):
return
seen = set([])
print("Scanning posts", end='', file=sys.stderr)
lower_case_tags = set([])
slugged_tags = set([])
for wildcard, destination, template_name, use_in_feeds in \
self.config['post_pages']:
print(".", end='', file=sys.stderr)
Expand Down Expand Up @@ -977,16 +977,16 @@ def scan_posts(self):
self.posts_per_month[
'{0}/{1:02d}'.format(post.date.year, post.date.month)].append(post.source_path)
for tag in post.alltags:
if tag.lower() in lower_case_tags:
if utils.slugify(tag) in slugged_tags:
if tag not in self.posts_per_tag:
# Tags that differ only in case
other_tag = [k for k in self.posts_per_tag.keys() if k.lower() == tag.lower()][0]
utils.LOGGER.error('You have tags that differ only in upper/lower case: {0} and {1}'.format(tag, other_tag))
utils.LOGGER.error('You have tags that are too similar: {0} and {1}'.format(tag, other_tag))
utils.LOGGER.error('Tag {0} is used in: {1}'.format(tag, post.source_path))
utils.LOGGER.error('Tag {0} is used in: {1}'.format(other_tag, ', '.join(self.posts_per_tag[other_tag])))
sys.exit(1)
else:
lower_case_tags.add(tag.lower())
slugged_tags.add(utils.slugify(tag))
self.posts_per_tag[tag].append(post.source_path)
self.posts_per_category[post.meta('category')].append(post.source_path)
else:
Expand Down

0 comments on commit 98604e2

Please sign in to comment.