Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2473 -- always copy source files for listings #2474

Merged
merged 1 commit into from
Aug 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Always copy source files for listings (Issue #2473)
* Detect dependencies in template strings (Issue #2455)
* RSS feeds for sections (Issue #2068)
* New ``data`` metadata that loads data from external files (Issue #2450)
Expand Down
28 changes: 14 additions & 14 deletions nikola/plugins/task/listings.py
Original file line number Diff line number Diff line change
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