Skip to content

Commit

Permalink
Getting rid of _force_source.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Sep 26, 2016
1 parent ceea3d0 commit e05e806
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions nikola/post.py
Expand Up @@ -762,26 +762,23 @@ def remaining_paragraph_count(self):
def source_link(self, lang=None):
"""Return absolute link to the post's source."""
ext = self.source_ext(True)
link = "/" + self.destination_path(lang=lang, extension=ext, sep='/', _force_source=True)
link = "/" + self.destination_path(lang=lang, extension=ext, sep='/')
link = utils.encodelink(link)
return link

def destination_path(self, lang=None, extension='.html', sep=os.sep, _force_source=False):
def destination_path(self, lang=None, extension='.html', sep=os.sep):
"""Destination path for this post, relative to output/.
If lang is not specified, it's the current language.
Extension is used in the path if specified.
"""
if lang is None:
lang = nikola.utils.LocaleBorg().current_lang
if _force_source:
folder = self.folder
else:
folder = self.meta[lang].get('path', self.folder_relative)
if isinstance(self.folder_base, (utils.bytes_str, utils.unicode_str)):
folder = os.path.normpath(os.path.join(self.folder_base, folder))
elif self.folder_base is not None:
folder = os.path.normpath(os.path.join(self.folder_base(lang), folder))
folder = self.meta[lang].get('path', self.folder_relative)
if isinstance(self.folder_base, (utils.bytes_str, utils.unicode_str)):
folder = os.path.normpath(os.path.join(self.folder_base, folder))
elif self.folder_base is not None:
folder = os.path.normpath(os.path.join(self.folder_base(lang), folder))
if self._has_pretty_url(lang):
path = os.path.join(self.translations[lang],
folder, self.meta[lang]['slug'], 'index' + extension)
Expand Down

0 comments on commit e05e806

Please sign in to comment.