Skip to content

Commit

Permalink
Fix #2473 -- always copy source files for listings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwpolska committed Aug 24, 2016
1 parent 248d271 commit 62410b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Always copy source files for listings (Issue #2473)
* RSS feeds for sections (Issue #2068)
* New ``data`` metadata that loads data from external files (Issue #2450)
* Shortcode to escape to the template language (Issue #1227)
Expand Down
28 changes: 14 additions & 14 deletions nikola/plugins/task/listings.py
Expand Up @@ -148,7 +148,7 @@ def render_listing(in_name, out_name, input_folder, output_folder, folders=[], f
os.path.join(
self.kw['output_folder'],
output_folder))))
if self.site.config['COPY_SOURCES'] and in_name:
if in_name:
source_link = permalink[:-5] # remove '.html'
else:
source_link = None
Expand Down Expand Up @@ -241,19 +241,19 @@ def render_listing(in_name, out_name, input_folder, output_folder, folders=[], f
'uptodate': [utils.config_changed(uptodate, 'nikola.plugins.task.listings:source')],
'clean': True,
}, self.kw["filters"])
if self.site.config['COPY_SOURCES']:
rel_name = os.path.join(rel_path, f)
rel_output_name = os.path.join(output_folder, rel_path, f)
self.register_output_name(input_folder, rel_name, rel_output_name)
out_name = os.path.join(self.kw['output_folder'], rel_output_name)
yield utils.apply_filters({
'basename': self.name,
'name': out_name,
'file_dep': [in_name],
'targets': [out_name],
'actions': [(utils.copy_file, [in_name, out_name])],
'clean': True,
}, self.kw["filters"])

rel_name = os.path.join(rel_path, f)
rel_output_name = os.path.join(output_folder, rel_path, f)
self.register_output_name(input_folder, rel_name, rel_output_name)
out_name = os.path.join(self.kw['output_folder'], rel_output_name)
yield utils.apply_filters({
'basename': self.name,
'name': out_name,
'file_dep': [in_name],
'targets': [out_name],
'actions': [(utils.copy_file, [in_name, out_name])],
'clean': True,
}, self.kw["filters"])

def listing_path(self, namep, lang):
"""A link to a listing.
Expand Down

0 comments on commit 62410b0

Please sign in to comment.