diff options
| author | 2024-04-23 00:37:58 -0400 | |
|---|---|---|
| committer | 2024-04-23 00:37:58 -0400 | |
| commit | 9b0e86a8e74768c4fe848fb5ce8d754292db4e3e (patch) | |
| tree | cfd424be8ecb68357e6e572033f08bc534bf724f /nikola/plugins/task/listings.py | |
| parent | 393aa58f2c5afd51f92fd9bd4b6dfd0dc90cea41 (diff) | |
New upstream version 8.3.0.upstream/8.3.0upstream
Diffstat (limited to 'nikola/plugins/task/listings.py')
| -rw-r--r-- | nikola/plugins/task/listings.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nikola/plugins/task/listings.py b/nikola/plugins/task/listings.py index 510411a..dde1c69 100644 --- a/nikola/plugins/task/listings.py +++ b/nikola/plugins/task/listings.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2022 Roberto Alsina and others. +# Copyright © 2012-2024 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -107,12 +107,13 @@ class Listings(Task): """Render pretty code listings.""" # Things to ignore in listings ignored_extensions = (".pyc", ".pyo") + ignored_files = (".DS_Store",) def render_listing(in_name, out_name, input_folder, output_folder, folders=[], files=[]): needs_ipython_css = False if in_name and in_name.endswith('.ipynb'): # Special handling: render ipynbs in listings (Issue #1900) - ipynb_plugin = self.site.plugin_manager.getPluginByName("ipynb", "PageCompiler") + ipynb_plugin = self.site.plugin_manager.get_plugin_by_name("ipynb", "PageCompiler") if ipynb_plugin is None: msg = "To use .ipynb files as listings, you must set up the Jupyter compiler in COMPILERS and POSTS/PAGES." utils.LOGGER.error(msg) @@ -183,7 +184,9 @@ class Listings(Task): for input_folder, output_folder in self.kw['listings_folders'].items(): for root, dirs, files in os.walk(input_folder, followlinks=True): - files = [f for f in files if os.path.splitext(f)[-1] not in ignored_extensions] + files = [f for f in files + if os.path.splitext(f)[-1] not in ignored_extensions and + f not in ignored_files] uptodate = {'c': self.site.GLOBAL_CONTEXT} @@ -224,7 +227,7 @@ class Listings(Task): 'clean': True, }, self.kw["filters"]) for f in files: - if f == '.DS_Store': + if f in ignored_files: continue ext = os.path.splitext(f)[-1] if ext in ignored_extensions: |
