Skip to content

Commit

Permalink
Fix #2080
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Sep 14, 2015
1 parent 86d786c commit 256e410
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -19,6 +19,7 @@ Features
Bugfixes
--------

* Remove bogus ambiguity on listing links (Issue #2080)
* Unix-slash caused conflict in windows (Issue #2079)
* Locale is now threadsafe, avoid races in threaded builds (Issue #2071)
* Make typogrify filter work when applied from metadata (Issue #2064)
Expand Down
1 change: 0 additions & 1 deletion nikola/nikola.py
Expand Up @@ -1362,7 +1362,6 @@ def path(self, kind, name, lang=None, is_link=False):
platform's separator.
(ex: "archive\index.html")
"""
import pdb; pdb.set_trace()
if lang is None:
lang = utils.LocaleBorg().current_lang

Expand Down
9 changes: 4 additions & 5 deletions nikola/plugins/task/listings.py
Expand Up @@ -28,6 +28,7 @@

from __future__ import unicode_literals, print_function

from collections import defaultdict
import sys
import os
import lxml.html
Expand All @@ -48,9 +49,7 @@ class Listings(Task):

def register_output_name(self, input_folder, rel_name, rel_output_name):
"""Register proper and improper file mappings."""
if rel_name not in self.improper_input_file_mapping:
self.improper_input_file_mapping[rel_name] = []
self.improper_input_file_mapping[rel_name].append(rel_output_name)
self.improper_input_file_mapping[rel_name].add(rel_output_name)
self.proper_input_file_mapping[os.path.join(input_folder, rel_name)] = rel_output_name
self.proper_input_file_mapping[rel_output_name] = rel_output_name

Expand Down Expand Up @@ -85,7 +84,7 @@ def set_site(self, site):
# a list is needed. This is needed for compatibility to previous Nikola
# versions, where there was no need to specify the input directory name
# when asking for a link via site.link('listing', ...).
self.improper_input_file_mapping = {}
self.improper_input_file_mapping = defaultdict(set)

# proper_input_file_mapping maps relative input file (relative to CWD)
# to a generated output file. Since we don't allow an input directory
Expand Down Expand Up @@ -280,7 +279,7 @@ def listing_path(self, namep, lang):
sys.exit(1)
if len(self.site.config['LISTINGS_FOLDERS']) > 1:
utils.LOGGER.notice("Using listings names in site.link() without input directory prefix while configuration's LISTINGS_FOLDERS has more than one entry.")
name = self.improper_input_file_mapping[name][0]
name = list(self.improper_input_file_mapping[name])[0]
break
else:
utils.LOGGER.error("Unknown listing name {0}!".format(namep))
Expand Down

0 comments on commit 256e410

Please sign in to comment.