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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -762,26 +762,23 @@ def remaining_paragraph_count(self):
def source_link(self, lang=None): def source_link(self, lang=None):
"""Return absolute link to the post's source.""" """Return absolute link to the post's source."""
ext = self.source_ext(True) 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) link = utils.encodelink(link)
return 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/. """Destination path for this post, relative to output/.
If lang is not specified, it's the current language. If lang is not specified, it's the current language.
Extension is used in the path if specified. Extension is used in the path if specified.
""" """
if lang is None: if lang is None:
lang = nikola.utils.LocaleBorg().current_lang lang = nikola.utils.LocaleBorg().current_lang
if _force_source: folder = self.meta[lang].get('path', self.folder_relative)
folder = self.folder if isinstance(self.folder_base, (utils.bytes_str, utils.unicode_str)):
else: folder = os.path.normpath(os.path.join(self.folder_base, folder))
folder = self.meta[lang].get('path', self.folder_relative) elif self.folder_base is not None:
if isinstance(self.folder_base, (utils.bytes_str, utils.unicode_str)): folder = os.path.normpath(os.path.join(self.folder_base(lang), folder))
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): if self._has_pretty_url(lang):
path = os.path.join(self.translations[lang], path = os.path.join(self.translations[lang],
folder, self.meta[lang]['slug'], 'index' + extension) folder, self.meta[lang]['slug'], 'index' + extension)
Expand Down

0 comments on commit e05e806

Please sign in to comment.