Skip to content

Commit

Permalink
merged master
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 19, 2015
1 parent ac2c766 commit 3b08b41
Showing 1 changed file with 0 additions and 87 deletions.
87 changes: 0 additions & 87 deletions nikola/nikola.py
Expand Up @@ -1432,7 +1432,6 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
self.timeline.extend(timeline)

quit = False
<<<<<<< HEAD
# Classify posts per year/tag/month/whatever
slugged_tags = set([])
for post in self.timeline:
Expand All @@ -1451,81 +1450,6 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
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([p.source_path for p in self.posts_per_tag[other_tag]])))
quit = True
=======
for wildcard, destination, template_name, use_in_feeds in \
self.config['post_pages']:
if not self.quiet and not quiet:
print(".", end='', file=sys.stderr)
dirname = os.path.dirname(wildcard)
for dirpath, _, _ in os.walk(dirname, followlinks=True):
dest_dir = os.path.normpath(os.path.join(destination,
os.path.relpath(dirpath, dirname))) # output/destination/foo/
# Get all the untranslated paths
dir_glob = os.path.join(dirpath, os.path.basename(wildcard)) # posts/foo/*.rst
untranslated = glob.glob(dir_glob)
# And now get all the translated paths
translated = set([])
for lang in self.config['TRANSLATIONS'].keys():
if lang == self.config['DEFAULT_LANG']:
continue
lang_glob = utils.get_translation_candidate(self.config, dir_glob, lang) # posts/foo/*.LANG.rst
translated = translated.union(set(glob.glob(lang_glob)))
# untranslated globs like *.rst often match translated paths too, so remove them
# and ensure x.rst is not in the translated set
untranslated = set(untranslated) - translated

# also remove from translated paths that are translations of
# paths in untranslated_list, so x.es.rst is not in the untranslated set
for p in untranslated:
translated = translated - set([utils.get_translation_candidate(self.config, p, l) for l in self.config['TRANSLATIONS'].keys()])

full_list = list(translated) + list(untranslated)
# We eliminate from the list the files inside any .ipynb folder
full_list = [p for p in full_list
if not any([x.startswith('.')
for x in p.split(os.sep)])]

for base_path in full_list:
if base_path in seen:
continue
else:
seen.add(base_path)
post = Post(
base_path,
self.config,
dest_dir,
use_in_feeds,
self.MESSAGES,
template_name,
self.get_compiler(base_path)
)
self.timeline.append(post)
self.global_data[post.source_path] = post
if post.use_in_feeds:
self.posts.append(post)
self.posts_per_year[
str(post.date.year)].append(post)
self.posts_per_month[
'{0}/{1:02d}'.format(post.date.year, post.date.month)].append(post)
for tag in post.alltags:
_tag_slugified = utils.slugify(tag)
if _tag_slugified in slugged_tags:
if tag not in self.posts_per_tag:
# Tags that differ only in case
other_tag = [existing for existing in self.posts_per_tag.keys() if utils.slugify(existing) == _tag_slugified][0]
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([p.source_path for p in self.posts_per_tag[other_tag]])))
quit = True
else:
slugged_tags.add(utils.slugify(tag, force=True))
self.posts_per_tag[tag].append(post)
self._add_post_to_category(post, post.meta('category'))

if post.is_post:
# unpublished posts
self.all_posts.append(post)
>>>>>>> master
else:
slugged_tags.add(utils.slugify(tag, force=True))
self.posts_per_tag[tag].append(post)
Expand All @@ -1542,22 +1466,11 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
self.post_per_file[post.destination_path(lang=lang, extension=post.source_ext())] = post

# Sort everything.
<<<<<<< HEAD

for thing in self.timeline, self.posts, self.all_posts, self.pages:
thing.sort(key=lambda p: p.date)
thing.reverse()
=======
self.timeline.sort(key=lambda p: p.date)
self.timeline.reverse()
self.posts.sort(key=lambda p: p.date)
self.posts.reverse()
self.all_posts.sort(key=lambda p: p.date)
self.all_posts.reverse()
self.pages.sort(key=lambda p: p.date)
self.pages.reverse()
self._sort_category_hierarchy()
>>>>>>> master

for i, p in enumerate(self.posts[1:]):
p.next_post = self.posts[i]
Expand Down

0 comments on commit 3b08b41

Please sign in to comment.