aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2024-04-23 00:37:58 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2024-04-23 00:37:58 -0400
commit9b0e86a8e74768c4fe848fb5ce8d754292db4e3e (patch)
treecfd424be8ecb68357e6e572033f08bc534bf724f /nikola/plugins
parent393aa58f2c5afd51f92fd9bd4b6dfd0dc90cea41 (diff)
New upstream version 8.3.0.upstream/8.3.0upstream
Diffstat (limited to 'nikola/plugins')
-rw-r--r--nikola/plugins/basic_import.py2
-rw-r--r--nikola/plugins/command/__init__.py2
-rw-r--r--nikola/plugins/command/auto/__init__.py46
-rw-r--r--nikola/plugins/command/check.py42
-rw-r--r--nikola/plugins/command/console.py2
-rw-r--r--nikola/plugins/command/default_config.py9
-rw-r--r--nikola/plugins/command/deploy.py2
-rw-r--r--nikola/plugins/command/github_deploy.py2
-rw-r--r--nikola/plugins/command/import_wordpress.py9
-rw-r--r--nikola/plugins/command/init.py2
-rw-r--r--nikola/plugins/command/new_page.py4
-rw-r--r--nikola/plugins/command/new_post.py8
-rw-r--r--nikola/plugins/command/orphans.py2
-rw-r--r--nikola/plugins/command/plugin.py2
-rw-r--r--nikola/plugins/command/rst2html/__init__.py4
-rw-r--r--nikola/plugins/command/serve.py2
-rw-r--r--nikola/plugins/command/status.py2
-rw-r--r--nikola/plugins/command/subtheme.py2
-rw-r--r--nikola/plugins/command/theme.py2
-rw-r--r--nikola/plugins/command/version.py2
-rw-r--r--nikola/plugins/compile/__init__.py2
-rw-r--r--nikola/plugins/compile/html.py2
-rw-r--r--nikola/plugins/compile/ipynb.py2
-rw-r--r--nikola/plugins/compile/markdown/__init__.py2
-rw-r--r--nikola/plugins/compile/markdown/mdx_nikola.py2
-rw-r--r--nikola/plugins/compile/markdown/mdx_podcast.py2
-rw-r--r--nikola/plugins/compile/pandoc.py6
-rw-r--r--nikola/plugins/compile/php.py2
-rw-r--r--nikola/plugins/compile/rest/__init__.py4
-rw-r--r--nikola/plugins/compile/rest/chart.py4
-rw-r--r--nikola/plugins/compile/rest/doc.py2
-rw-r--r--nikola/plugins/compile/rest/listing.py2
-rw-r--r--nikola/plugins/compile/rest/media.py2
-rw-r--r--nikola/plugins/compile/rest/post_list.py4
-rw-r--r--nikola/plugins/compile/rest/soundcloud.py2
-rw-r--r--nikola/plugins/compile/rest/thumbnail.py2
-rw-r--r--nikola/plugins/compile/rest/vimeo.py2
-rw-r--r--nikola/plugins/compile/rest/youtube.py2
-rw-r--r--nikola/plugins/misc/__init__.py2
-rw-r--r--nikola/plugins/misc/scan_posts.plugin2
-rw-r--r--nikola/plugins/misc/scan_posts.py2
-rw-r--r--nikola/plugins/misc/taxonomies_classifier.py2
-rw-r--r--nikola/plugins/shortcode/chart.plugin2
-rw-r--r--nikola/plugins/shortcode/chart.py2
-rw-r--r--nikola/plugins/shortcode/emoji.plugin2
-rw-r--r--nikola/plugins/shortcode/gist.plugin2
-rw-r--r--nikola/plugins/shortcode/listing.plugin2
-rw-r--r--nikola/plugins/shortcode/listing.py2
-rw-r--r--nikola/plugins/shortcode/post_list.plugin2
-rw-r--r--nikola/plugins/shortcode/post_list.py2
-rw-r--r--nikola/plugins/shortcode/thumbnail.plugin2
-rw-r--r--nikola/plugins/shortcode/thumbnail.py2
-rw-r--r--nikola/plugins/task/__init__.py2
-rw-r--r--nikola/plugins/task/archive.py2
-rw-r--r--nikola/plugins/task/authors.py2
-rw-r--r--nikola/plugins/task/bundles.plugin2
-rw-r--r--nikola/plugins/task/bundles.py2
-rw-r--r--nikola/plugins/task/categories.py2
-rw-r--r--nikola/plugins/task/copy_assets.py2
-rw-r--r--nikola/plugins/task/copy_files.py2
-rw-r--r--nikola/plugins/task/galleries.py15
-rw-r--r--nikola/plugins/task/gzip.plugin4
-rw-r--r--nikola/plugins/task/gzip.py10
-rw-r--r--nikola/plugins/task/indexes.py2
-rw-r--r--nikola/plugins/task/listings.py11
-rw-r--r--nikola/plugins/task/page_index.py4
-rw-r--r--nikola/plugins/task/pages.py2
-rw-r--r--nikola/plugins/task/posts.py4
-rw-r--r--nikola/plugins/task/redirect.py2
-rw-r--r--nikola/plugins/task/robots.plugin2
-rw-r--r--nikola/plugins/task/robots.py2
-rw-r--r--nikola/plugins/task/scale_images.py2
-rw-r--r--nikola/plugins/task/sitemap.plugin2
-rw-r--r--nikola/plugins/task/sitemap.py4
-rw-r--r--nikola/plugins/task/sources.py2
-rw-r--r--nikola/plugins/task/tags.py2
-rw-r--r--nikola/plugins/task/taxonomies.py2
-rw-r--r--nikola/plugins/template/__init__.py2
-rw-r--r--nikola/plugins/template/jinja.plugin2
-rw-r--r--nikola/plugins/template/jinja.py2
-rw-r--r--nikola/plugins/template/mako.plugin2
-rw-r--r--nikola/plugins/template/mako.py2
82 files changed, 186 insertions, 134 deletions
diff --git a/nikola/plugins/basic_import.py b/nikola/plugins/basic_import.py
index ca88cfb..ad53572 100644
--- a/nikola/plugins/basic_import.py
+++ b/nikola/plugins/basic_import.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
diff --git a/nikola/plugins/command/__init__.py b/nikola/plugins/command/__init__.py
index 6c8e81a..e5cd68a 100644
--- a/nikola/plugins/command/__init__.py
+++ b/nikola/plugins/command/__init__.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
diff --git a/nikola/plugins/command/auto/__init__.py b/nikola/plugins/command/auto/__init__.py
index b13b645..d272c23 100644
--- a/nikola/plugins/command/auto/__init__.py
+++ b/nikola/plugins/command/auto/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2022 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2024 Chris Warrick, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -35,6 +35,7 @@ import stat
import subprocess
import sys
import typing
+import urllib.parse
import webbrowser
import blinker
@@ -67,6 +68,17 @@ if sys.platform == 'win32':
asyncio.set_event_loop(asyncio.ProactorEventLoop())
+def base_path_from_siteuri(siteuri: str) -> str:
+ """Extract the path part from a URI such as site['SITE_URL'].
+
+ The path never ends with a "/". (If only "/" is intended, it is empty.)
+ """
+ path = urllib.parse.urlsplit(siteuri).path
+ if path.endswith("/"):
+ path = path[:-1]
+ return path
+
+
class CommandAuto(Command):
"""Automatic rebuilds for Nikola."""
@@ -239,8 +251,10 @@ class CommandAuto(Command):
# Server can be disabled (Issue #1883)
self.has_server = not options['no-server']
+ base_path = base_path_from_siteuri(self.site.config['SITE_URL'])
+
if self.has_server:
- loop.run_until_complete(self.set_up_server(host, port, out_folder))
+ loop.run_until_complete(self.set_up_server(host, port, base_path, out_folder))
# Run an initial build so we are up-to-date. The server is running, but we are not watching yet.
loop.run_until_complete(self.run_initial_rebuild())
@@ -293,9 +307,12 @@ class CommandAuto(Command):
if browser:
# Some browsers fail to load 0.0.0.0 (Issue #2755)
if host == '0.0.0.0':
- server_url = "http://127.0.0.1:{0}/".format(port)
- self.logger.info("Opening {0} in the default web browser...".format(server_url))
- webbrowser.open(server_url)
+ browser_url = "http://127.0.0.1:{0}/{1}".format(port, base_path.lstrip("/"))
+ else:
+ # server_url always ends with a "/":
+ browser_url = "{0}{1}".format(server_url, base_path.lstrip("/"))
+ self.logger.info("Opening {0} in the default web browser...".format(browser_url))
+ webbrowser.open(browser_url)
# Run the event loop forever and handle shutdowns.
try:
@@ -320,13 +337,13 @@ class CommandAuto(Command):
self.wd_observer.join()
loop.close()
- async def set_up_server(self, host: str, port: int, out_folder: str) -> None:
+ async def set_up_server(self, host: str, port: int, base_path: str, out_folder: str) -> None:
"""Set up aiohttp server and start it."""
webapp = web.Application()
webapp.router.add_get('/livereload.js', self.serve_livereload_js)
webapp.router.add_get('/robots.txt', self.serve_robots_txt)
webapp.router.add_route('*', '/livereload', self.websocket_handler)
- resource = IndexHtmlStaticResource(True, self.snippet, '', out_folder)
+ resource = IndexHtmlStaticResource(True, self.snippet, base_path, out_folder)
webapp.router.register_resource(resource)
webapp.on_shutdown.append(self.remove_websockets)
@@ -587,13 +604,11 @@ class NikolaEventHandler:
self.function = function
self.loop = loop
- async def on_any_event(self, event):
- """Handle all file events."""
- await self.function(event)
-
def dispatch(self, event):
"""Dispatch events to handler."""
- self.loop.call_soon_threadsafe(asyncio.ensure_future, self.on_any_event(event))
+ if event.event_type in {"opened", "closed"}:
+ return
+ self.loop.call_soon_threadsafe(asyncio.ensure_future, self.function(event))
class ConfigEventHandler(NikolaEventHandler):
@@ -601,11 +616,10 @@ class ConfigEventHandler(NikolaEventHandler):
def __init__(self, configuration_filename, function, loop):
"""Initialize the handler."""
+ super().__init__(function, loop)
self.configuration_filename = configuration_filename
- self.function = function
- self.loop = loop
- async def on_any_event(self, event):
+ def dispatch(self, event):
"""Handle file events if they concern the configuration file."""
if event._src_path == self.configuration_filename:
- await self.function(event)
+ super().dispatch(event)
diff --git a/nikola/plugins/command/check.py b/nikola/plugins/command/check.py
index f9b701b..5bcbced 100644
--- a/nikola/plugins/command/check.py
+++ b/nikola/plugins/command/check.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
@@ -148,6 +148,22 @@ class CommandCheck(Command):
'default': False,
'help': 'Check that remote links work.',
},
+ {
+ 'name': 'timeout',
+ 'long': 'timeout',
+ 'short': 't',
+ 'type': int,
+ 'default': 30,
+ 'help': 'Timeout (in seconds) for HTTP requests in remote checks.',
+ },
+ {
+ 'name': 'ignore_query_strings',
+ 'long': 'ignore-query-strings',
+ 'short': 'q',
+ 'type': bool,
+ 'default': False,
+ 'help': 'Ignore query strings for internal links.',
+ }
]
def _execute(self, options, args):
@@ -160,8 +176,9 @@ class CommandCheck(Command):
else:
self.logger.level = logging.WARNING
failure = False
+ self.timeout = options['timeout']
if options['links']:
- failure |= self.scan_links(options['find_sources'], options['remote'])
+ failure |= self.scan_links(options['find_sources'], options['remote'], options['ignore_query_strings'])
if options['files']:
failure |= self.scan_files()
if options['clean']:
@@ -171,9 +188,10 @@ class CommandCheck(Command):
existing_targets = set([])
checked_remote_targets = {}
+ timeout = None
cache = {}
- def analyze(self, fname, find_sources=False, check_remote=False):
+ def analyze(self, fname, find_sources=False, check_remote=False, ignore_query_strings=False):
"""Analyze links on a page."""
rv = False
self.whitelist = [re.compile(x) for x in self.site.config['LINK_CHECK_WHITELIST']]
@@ -279,19 +297,19 @@ class CommandCheck(Command):
# Check the remote link works
req_headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 (Nikola)'} # I’m a real boy!
- resp = requests.head(target, headers=req_headers, allow_redirects=False)
+ resp = requests.head(target, headers=req_headers, allow_redirects=False, timeout=self.timeout)
# Retry client errors (4xx) as GET requests because many servers are broken
if resp.status_code >= 400 and resp.status_code <= 499:
time.sleep(0.5)
- resp = requests.get(target, headers=req_headers, allow_redirects=False)
+ resp = requests.get(target, headers=req_headers, allow_redirects=False, timeout=self.timeout)
# Follow redirects and see where they lead, redirects to errors will be reported twice
if resp.status_code in [301, 302, 307, 308]:
redir_status_code = resp.status_code
time.sleep(0.5)
# Known redirects are retested using GET because IIS servers otherwise get HEADaches
- resp = requests.get(target, headers=req_headers, allow_redirects=True)
+ resp = requests.get(target, headers=req_headers, allow_redirects=True, timeout=self.timeout)
# Permanent redirects should be updated
if redir_status_code in [301, 308]:
self.logger.warning("Remote link moved PERMANENTLY to \"{0}\" and should be updated in {1}: {2} [HTTP: {3}]".format(resp.url, filename, target, redir_status_code))
@@ -353,6 +371,10 @@ class CommandCheck(Command):
else:
target_filename_str = target_filename.decode("utf-8", errors="surrogateescape")
+ if ignore_query_strings and "?" in target_filename_str:
+ target_filename, _, _ = target_filename.rpartition("?")
+ target_filename_str, _, _ = target_filename_str.rpartition("?")
+
if any(pattern.search(target_filename_str) for pattern in self.whitelist):
continue
@@ -371,7 +393,7 @@ class CommandCheck(Command):
self.logger.error(u"Error with: {0} {1}".format(filename, exc))
return rv
- def scan_links(self, find_sources=False, check_remote=False):
+ def scan_links(self, find_sources=False, check_remote=False, ignore_query_strings=False):
"""Check links on the site."""
self.logger.debug("Checking Links:")
self.logger.debug("===============\n")
@@ -387,13 +409,13 @@ class CommandCheck(Command):
for fname in _call_nikola_list(self.site, self.cache)[0]:
if fname.startswith(output_folder):
if '.html' == fname[-5:]:
- if self.analyze(fname, find_sources, check_remote):
+ if self.analyze(fname, find_sources, check_remote, ignore_query_strings):
failure = True
if atom_extension == fname[-len(atom_extension):]:
- if self.analyze(fname, find_sources, False):
+ if self.analyze(fname, find_sources, False, ignore_query_strings):
failure = True
if fname.endswith('sitemap.xml') or fname.endswith('sitemapindex.xml'):
- if self.analyze(fname, find_sources, False):
+ if self.analyze(fname, find_sources, False, ignore_query_strings):
failure = True
if not failure:
self.logger.debug("All links checked.")
diff --git a/nikola/plugins/command/console.py b/nikola/plugins/command/console.py
index 96fee3e..18428f3 100644
--- a/nikola/plugins/command/console.py
+++ b/nikola/plugins/command/console.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2022 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2024 Chris Warrick, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/command/default_config.py b/nikola/plugins/command/default_config.py
index fddda26..f14c4c8 100644
--- a/nikola/plugins/command/default_config.py
+++ b/nikola/plugins/command/default_config.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
@@ -48,7 +48,10 @@ class CommandShowConfig(Command):
def _execute(self, options=None, args=None):
"""Show the default configuration."""
+ init_plugin = self.site.plugin_manager.get_plugin_by_name("init", "Command").plugin_object
+ config = init_plugin.create_configuration_to_string()
+
try:
- print(nikola.plugins.command.init.CommandInit.create_configuration_to_string())
+ print(config)
except Exception:
- sys.stdout.buffer.write(nikola.plugins.command.init.CommandInit.create_configuration_to_string().encode('utf-8'))
+ sys.stdout.buffer.write(config.encode('utf-8'))
diff --git a/nikola/plugins/command/deploy.py b/nikola/plugins/command/deploy.py
index 1896a7a..ddb5a64 100644
--- a/nikola/plugins/command/deploy.py
+++ b/nikola/plugins/command/deploy.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
diff --git a/nikola/plugins/command/github_deploy.py b/nikola/plugins/command/github_deploy.py
index 1d3e9c0..aa2da74 100644
--- a/nikola/plugins/command/github_deploy.py
+++ b/nikola/plugins/command/github_deploy.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2022 Puneeth Chaganti and others.
+# Copyright © 2014-2024 Puneeth Chaganti and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
index f3feab1..e6ec45b 100644
--- a/nikola/plugins/command/import_wordpress.py
+++ b/nikola/plugins/command/import_wordpress.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
@@ -66,7 +66,7 @@ def install_plugin(site, plugin_name, output_dir=None, show_install_notes=False)
"""Install a Nikola plugin."""
LOGGER.info("Installing plugin '{0}'".format(plugin_name))
# Get hold of the 'plugin' plugin
- plugin_installer_info = site.plugin_manager.getPluginByName('plugin', 'Command')
+ plugin_installer_info = site.plugin_manager.get_plugin_by_name('plugin', 'Command')
if plugin_installer_info is None:
LOGGER.error('Internal error: cannot find the "plugin" plugin which is supposed to come with Nikola!')
return False
@@ -236,10 +236,9 @@ to
self._find_wordpress_compiler()
if self.wordpress_page_compiler is not None:
return self.wordpress_page_compiler
- plugin_info = self.site.plugin_manager.getPluginByName('markdown', 'PageCompiler')
+ plugin_info = self.site.plugin_manager.get_plugin_by_name('markdown', 'PageCompiler')
if plugin_info is not None:
if not plugin_info.is_activated:
- self.site.plugin_manager.activatePluginByName(plugin_info.name)
plugin_info.plugin_object.set_site(self.site)
return plugin_info.plugin_object
else:
@@ -249,7 +248,7 @@ to
"""Find WordPress compiler plugin."""
if self.wordpress_page_compiler is not None:
return
- plugin_info = self.site.plugin_manager.getPluginByName('wordpress', 'PageCompiler')
+ plugin_info = self.site.plugin_manager.get_plugin_by_name('wordpress', 'PageCompiler')
if plugin_info is not None:
if not plugin_info.is_activated:
self.site.plugin_manager.activatePluginByName(plugin_info.name)
diff --git a/nikola/plugins/command/init.py b/nikola/plugins/command/init.py
index 4607758..cf22a44 100644
--- a/nikola/plugins/command/init.py
+++ b/nikola/plugins/command/init.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
diff --git a/nikola/plugins/command/new_page.py b/nikola/plugins/command/new_page.py
index 94fbc51..6587d70 100644
--- a/nikola/plugins/command/new_page.py
+++ b/nikola/plugins/command/new_page.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2022 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2024 Roberto Alsina, Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -109,5 +109,5 @@ class CommandNewPage(Command):
options['date-path'] = False
# Even though stuff was split into `new_page`, it’s easier to do it
# there not to duplicate the code.
- p = self.site.plugin_manager.getPluginByName('new_post', 'Command').plugin_object
+ p = self.site.plugin_manager.get_plugin_by_name('new_post', 'Command').plugin_object
return p.execute(options, args)
diff --git a/nikola/plugins/command/new_post.py b/nikola/plugins/command/new_post.py
index f66a188..aa96625 100644
--- a/nikola/plugins/command/new_post.py
+++ b/nikola/plugins/command/new_post.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
@@ -216,9 +216,7 @@ class CommandNewPost(Command):
def _execute(self, options, args):
"""Create a new post or page."""
global LOGGER
- compiler_names = [p.name for p in
- self.site.plugin_manager.getPluginsOfCategory(
- "PageCompiler")]
+ compiler_names = [p.name for p in self.site.plugin_manager.get_plugins_of_category("PageCompiler")]
if len(args) > 1:
print(self.help())
@@ -298,7 +296,7 @@ class CommandNewPost(Command):
self.print_compilers()
return
- compiler_plugin = self.site.plugin_manager.getPluginByName(
+ compiler_plugin = self.site.plugin_manager.get_plugin_by_name(
content_format, "PageCompiler").plugin_object
# Guess where we should put this
diff --git a/nikola/plugins/command/orphans.py b/nikola/plugins/command/orphans.py
index 169cbba..bde8425 100644
--- a/nikola/plugins/command/orphans.py
+++ b/nikola/plugins/command/orphans.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2022 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2024 Roberto Alsina, Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/command/plugin.py b/nikola/plugins/command/plugin.py
index ae0dead..4fd8e8f 100644
--- a/nikola/plugins/command/plugin.py
+++ b/nikola/plugins/command/plugin.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
diff --git a/nikola/plugins/command/rst2html/__init__.py b/nikola/plugins/command/rst2html/__init__.py
index 2bf329a..4fdd36f 100644
--- a/nikola/plugins/command/rst2html/__init__.py
+++ b/nikola/plugins/command/rst2html/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2015-2022 Chris Warrick and others.
+# Copyright © 2015-2024 Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -44,7 +44,7 @@ class CommandRst2Html(Command):
def _execute(self, options, args):
"""Compile reStructuredText to standalone HTML files."""
- compiler = self.site.plugin_manager.getPluginByName('rest', 'PageCompiler').plugin_object
+ compiler = self.site.plugin_manager.get_plugin_by_name('rest', 'PageCompiler').plugin_object
if len(args) != 1:
print("This command takes only one argument (input file name).")
return 2
diff --git a/nikola/plugins/command/serve.py b/nikola/plugins/command/serve.py
index cbf628c..32cd46b 100644
--- a/nikola/plugins/command/serve.py
+++ b/nikola/plugins/command/serve.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
diff --git a/nikola/plugins/command/status.py b/nikola/plugins/command/status.py
index ab6fc1e..a22f173 100644
--- a/nikola/plugins/command/status.py
+++ b/nikola/plugins/command/status.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
diff --git a/nikola/plugins/command/subtheme.py b/nikola/plugins/command/subtheme.py
index b5c5aff..c322336 100644
--- a/nikola/plugins/command/subtheme.py
+++ b/nikola/plugins/command/subtheme.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
diff --git a/nikola/plugins/command/theme.py b/nikola/plugins/command/theme.py
index 2f99dd8..f7608b5 100644
--- a/nikola/plugins/command/theme.py
+++ b/nikola/plugins/command/theme.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2022 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2024 Roberto Alsina, Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/command/version.py b/nikola/plugins/command/version.py
index 4ec8a46..bdc1357 100644
--- a/nikola/plugins/command/version.py
+++ b/nikola/plugins/command/version.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
diff --git a/nikola/plugins/compile/__init__.py b/nikola/plugins/compile/__init__.py
index c3abcd4..4517b31 100644
--- a/nikola/plugins/compile/__init__.py
+++ b/nikola/plugins/compile/__init__.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
diff --git a/nikola/plugins/compile/html.py b/nikola/plugins/compile/html.py
index ff7d37f..9dbf96e 100644
--- a/nikola/plugins/compile/html.py
+++ b/nikola/plugins/compile/html.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
diff --git a/nikola/plugins/compile/ipynb.py b/nikola/plugins/compile/ipynb.py
index 7d6e528..df1b29a 100644
--- a/nikola/plugins/compile/ipynb.py
+++ b/nikola/plugins/compile/ipynb.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2022 Damián Avila, Chris Warrick and others.
+# Copyright © 2013-2024 Damián Avila, Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/compile/markdown/__init__.py b/nikola/plugins/compile/markdown/__init__.py
index 31a57d9..052413f 100644
--- a/nikola/plugins/compile/markdown/__init__.py
+++ b/nikola/plugins/compile/markdown/__init__.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
diff --git a/nikola/plugins/compile/markdown/mdx_nikola.py b/nikola/plugins/compile/markdown/mdx_nikola.py
index af30956..ba14319 100644
--- a/nikola/plugins/compile/markdown/mdx_nikola.py
+++ b/nikola/plugins/compile/markdown/mdx_nikola.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
diff --git a/nikola/plugins/compile/markdown/mdx_podcast.py b/nikola/plugins/compile/markdown/mdx_podcast.py
index e003f40..0be09a8 100644
--- a/nikola/plugins/compile/markdown/mdx_podcast.py
+++ b/nikola/plugins/compile/markdown/mdx_podcast.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright © 2013-2022 Michael Rabbitt, Roberto Alsina and others.
+# Copyright © 2013-2024 Michael Rabbitt, Roberto Alsina and others.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
diff --git a/nikola/plugins/compile/pandoc.py b/nikola/plugins/compile/pandoc.py
index a43c8b0..4082d1d 100644
--- a/nikola/plugins/compile/pandoc.py
+++ b/nikola/plugins/compile/pandoc.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
@@ -62,10 +62,10 @@ class CompilePandoc(PageCompiler):
try:
pandoc_options = list(config_options[ext])
except KeyError:
- self.logger.warn('Setting PANDOC_OPTIONS to [], because extension {} is not defined in PANDOC_OPTIONS: {}.'.format(ext, config_options))
+ self.logger.warning('Setting PANDOC_OPTIONS to [], because extension {} is not defined in PANDOC_OPTIONS: {}.'.format(ext, config_options))
pandoc_options = []
else:
- self.logger.warn('Setting PANDOC_OPTIONS to [], because PANDOC_OPTIONS is expected to be of type Union[List[str], Dict[str, List[str]]] but this is not: {}'.format(config_options))
+ self.logger.warning('Setting PANDOC_OPTIONS to [], because PANDOC_OPTIONS is expected to be of type Union[List[str], Dict[str, List[str]]] but this is not: {}'.format(config_options))
pandoc_options = []
return pandoc_options
diff --git a/nikola/plugins/compile/php.py b/nikola/plugins/compile/php.py
index d4c67dc..09f2e09 100644
--- a/nikola/plugins/compile/php.py
+++ b/nikola/plugins/compile/php.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
diff --git a/nikola/plugins/compile/rest/__init__.py b/nikola/plugins/compile/rest/__init__.py
index e5d3998..e252bae 100644
--- a/nikola/plugins/compile/rest/__init__.py
+++ b/nikola/plugins/compile/rest/__init__.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
@@ -77,7 +77,7 @@ class CompileRest(PageCompiler):
meta = {}
if 'title' in document:
meta['title'] = document['title']
- for docinfo in document.traverse(docutils.nodes.docinfo):
+ for docinfo in document.findall(docutils.nodes.docinfo):
for element in docinfo.children:
if element.tagname == 'field': # custom fields (e.g. summary)
name_elem, body_elem = element.children
diff --git a/nikola/plugins/compile/rest/chart.py b/nikola/plugins/compile/rest/chart.py
index 15ccee7..3f3c0dc 100644
--- a/nikola/plugins/compile/rest/chart.py
+++ b/nikola/plugins/compile/rest/chart.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
@@ -153,7 +153,7 @@ class Chart(Directive):
def run(self):
"""Run the directive."""
self.options['site'] = None
- html = _site.plugin_manager.getPluginByName(
+ html = _site.plugin_manager.get_plugin_by_name(
'chart', 'ShortcodePlugin').plugin_object.handler(
self.arguments[0],
data='\n'.join(self.content),
diff --git a/nikola/plugins/compile/rest/doc.py b/nikola/plugins/compile/rest/doc.py
index 1d88472..b884aaa 100644
--- a/nikola/plugins/compile/rest/doc.py
+++ b/nikola/plugins/compile/rest/doc.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
diff --git a/nikola/plugins/compile/rest/listing.py b/nikola/plugins/compile/rest/listing.py
index 48dbe4c..d1b64f0 100644
--- a/nikola/plugins/compile/rest/listing.py
+++ b/nikola/plugins/compile/rest/listing.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
diff --git a/nikola/plugins/compile/rest/media.py b/nikola/plugins/compile/rest/media.py
index 6d0436d..0611f6f 100644
--- a/nikola/plugins/compile/rest/media.py
+++ b/nikola/plugins/compile/rest/media.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
diff --git a/nikola/plugins/compile/rest/post_list.py b/nikola/plugins/compile/rest/post_list.py
index 1799790..8f2b446 100644
--- a/nikola/plugins/compile/rest/post_list.py
+++ b/nikola/plugins/compile/rest/post_list.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2022 Udo Spallek, Roberto Alsina and others.
+# Copyright © 2013-2024 Udo Spallek, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -88,7 +88,7 @@ class PostListDirective(Directive):
date = self.options.get('date')
filename = self.state.document.settings._nikola_source_path
- output, deps = self.site.plugin_manager.getPluginByName(
+ output, deps = self.site.plugin_manager.get_plugin_by_name(
'post_list', 'ShortcodePlugin').plugin_object.handler(
start,
stop,
diff --git a/nikola/plugins/compile/rest/soundcloud.py b/nikola/plugins/compile/rest/soundcloud.py
index 87b1483..71a82a1 100644
--- a/nikola/plugins/compile/rest/soundcloud.py
+++ b/nikola/plugins/compile/rest/soundcloud.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
diff --git a/nikola/plugins/compile/rest/thumbnail.py b/nikola/plugins/compile/rest/thumbnail.py
index 6f10a7f..af075bb 100644
--- a/nikola/plugins/compile/rest/thumbnail.py
+++ b/nikola/plugins/compile/rest/thumbnail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2022 Pelle Nilsson and others.
+# Copyright © 2014-2024 Pelle Nilsson and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/compile/rest/vimeo.py b/nikola/plugins/compile/rest/vimeo.py
index b4f89ff..7c5dd6f 100644
--- a/nikola/plugins/compile/rest/vimeo.py
+++ b/nikola/plugins/compile/rest/vimeo.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
diff --git a/nikola/plugins/compile/rest/youtube.py b/nikola/plugins/compile/rest/youtube.py
index de3f2fa..ef46822 100644
--- a/nikola/plugins/compile/rest/youtube.py
+++ b/nikola/plugins/compile/rest/youtube.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
diff --git a/nikola/plugins/misc/__init__.py b/nikola/plugins/misc/__init__.py
index 0572088..41c38f7 100644
--- a/nikola/plugins/misc/__init__.py
+++ b/nikola/plugins/misc/__init__.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
diff --git a/nikola/plugins/misc/scan_posts.plugin b/nikola/plugins/misc/scan_posts.plugin
index f4af811..0fb946c 100644
--- a/nikola/plugins/misc/scan_posts.plugin
+++ b/nikola/plugins/misc/scan_posts.plugin
@@ -8,3 +8,5 @@ Version = 1.0
Website = https://getnikola.com/
Description = Scan posts and create timeline
+[Nikola]
+PluginCategory = PostScanner
diff --git a/nikola/plugins/misc/scan_posts.py b/nikola/plugins/misc/scan_posts.py
index efa797e..bc63631 100644
--- a/nikola/plugins/misc/scan_posts.py
+++ b/nikola/plugins/misc/scan_posts.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
diff --git a/nikola/plugins/misc/taxonomies_classifier.py b/nikola/plugins/misc/taxonomies_classifier.py
index c6092b3..f53fe54 100644
--- a/nikola/plugins/misc/taxonomies_classifier.py
+++ b/nikola/plugins/misc/taxonomies_classifier.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
diff --git a/nikola/plugins/shortcode/chart.plugin b/nikola/plugins/shortcode/chart.plugin
index edcbc13..be1fbc6 100644
--- a/nikola/plugins/shortcode/chart.plugin
+++ b/nikola/plugins/shortcode/chart.plugin
@@ -3,7 +3,7 @@ name = chart
module = chart
[Nikola]
-PluginCategory = Shortcode
+PluginCategory = ShortcodePlugin
[Documentation]
author = Roberto Alsina
diff --git a/nikola/plugins/shortcode/chart.py b/nikola/plugins/shortcode/chart.py
index 2b88cfb..fb45245 100644
--- a/nikola/plugins/shortcode/chart.py
+++ b/nikola/plugins/shortcode/chart.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
diff --git a/nikola/plugins/shortcode/emoji.plugin b/nikola/plugins/shortcode/emoji.plugin
index c9a272c..4c09f03 100644
--- a/nikola/plugins/shortcode/emoji.plugin
+++ b/nikola/plugins/shortcode/emoji.plugin
@@ -3,7 +3,7 @@ name = emoji
module = emoji
[Nikola]
-PluginCategory = Shortcode
+PluginCategory = ShortcodePlugin
[Documentation]
author = Roberto Alsina
diff --git a/nikola/plugins/shortcode/gist.plugin b/nikola/plugins/shortcode/gist.plugin
index b610763..ee62c27 100644
--- a/nikola/plugins/shortcode/gist.plugin
+++ b/nikola/plugins/shortcode/gist.plugin
@@ -3,7 +3,7 @@ name = gist
module = gist
[Nikola]
-PluginCategory = Shortcode
+PluginCategory = ShortcodePlugin
[Documentation]
author = Roberto Alsina
diff --git a/nikola/plugins/shortcode/listing.plugin b/nikola/plugins/shortcode/listing.plugin
index 90fb6eb..70fa1cf 100644
--- a/nikola/plugins/shortcode/listing.plugin
+++ b/nikola/plugins/shortcode/listing.plugin
@@ -3,7 +3,7 @@ name = listing_shortcode
module = listing
[Nikola]
-PluginCategory = Shortcode
+PluginCategory = ShortcodePlugin
[Documentation]
author = Roberto Alsina
diff --git a/nikola/plugins/shortcode/listing.py b/nikola/plugins/shortcode/listing.py
index 3046655..33b0d44 100644
--- a/nikola/plugins/shortcode/listing.py
+++ b/nikola/plugins/shortcode/listing.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2017-2022 Roberto Alsina and others.
+# Copyright © 2017-2024 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/shortcode/post_list.plugin b/nikola/plugins/shortcode/post_list.plugin
index 494a1d8..9c39eb9 100644
--- a/nikola/plugins/shortcode/post_list.plugin
+++ b/nikola/plugins/shortcode/post_list.plugin
@@ -3,7 +3,7 @@ name = post_list
module = post_list
[Nikola]
-PluginCategory = Shortcode
+PluginCategory = ShortcodePlugin
[Documentation]
author = Udo Spallek
diff --git a/nikola/plugins/shortcode/post_list.py b/nikola/plugins/shortcode/post_list.py
index 5b24cc6..df2d022 100644
--- a/nikola/plugins/shortcode/post_list.py
+++ b/nikola/plugins/shortcode/post_list.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2022 Udo Spallek, Roberto Alsina and others.
+# Copyright © 2013-2024 Udo Spallek, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/shortcode/thumbnail.plugin b/nikola/plugins/shortcode/thumbnail.plugin
index e55d34f..bd36169 100644
--- a/nikola/plugins/shortcode/thumbnail.plugin
+++ b/nikola/plugins/shortcode/thumbnail.plugin
@@ -3,7 +3,7 @@ name = thumbnail
module = thumbnail
[Nikola]
-PluginCategory = Shortcode
+PluginCategory = ShortcodePlugin
[Documentation]
author = Chris Warrick
diff --git a/nikola/plugins/shortcode/thumbnail.py b/nikola/plugins/shortcode/thumbnail.py
index 7a05320..67b235c 100644
--- a/nikola/plugins/shortcode/thumbnail.py
+++ b/nikola/plugins/shortcode/thumbnail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2017-2022 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2017-2024 Roberto Alsina, Chris Warrick and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/task/__init__.py b/nikola/plugins/task/__init__.py
index 10c54d0..174d82e 100644
--- a/nikola/plugins/task/__init__.py
+++ b/nikola/plugins/task/__init__.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
diff --git a/nikola/plugins/task/archive.py b/nikola/plugins/task/archive.py
index f083394..44849fa 100644
--- a/nikola/plugins/task/archive.py
+++ b/nikola/plugins/task/archive.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
diff --git a/nikola/plugins/task/authors.py b/nikola/plugins/task/authors.py
index d966a4f..6a9ab81 100644
--- a/nikola/plugins/task/authors.py
+++ b/nikola/plugins/task/authors.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2015-2022 Juanjo Conti and others.
+# Copyright © 2015-2024 Juanjo Conti and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/task/bundles.plugin b/nikola/plugins/task/bundles.plugin
index 939065b..4afc3ec 100644
--- a/nikola/plugins/task/bundles.plugin
+++ b/nikola/plugins/task/bundles.plugin
@@ -9,5 +9,5 @@ website = https://getnikola.com/
description = Bundle assets
[Nikola]
-PluginCategory = Task
+PluginCategory = LateTask
diff --git a/nikola/plugins/task/bundles.py b/nikola/plugins/task/bundles.py
index c71c255..b0aeb42 100644
--- a/nikola/plugins/task/bundles.py
+++ b/nikola/plugins/task/bundles.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
diff --git a/nikola/plugins/task/categories.py b/nikola/plugins/task/categories.py
index 11a0407..51b7f6f 100644
--- a/nikola/plugins/task/categories.py
+++ b/nikola/plugins/task/categories.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
diff --git a/nikola/plugins/task/copy_assets.py b/nikola/plugins/task/copy_assets.py
index fd22e0d..519a552 100644
--- a/nikola/plugins/task/copy_assets.py
+++ b/nikola/plugins/task/copy_assets.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
diff --git a/nikola/plugins/task/copy_files.py b/nikola/plugins/task/copy_files.py
index 3818808..23ba5cd 100644
--- a/nikola/plugins/task/copy_files.py
+++ b/nikola/plugins/task/copy_files.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
diff --git a/nikola/plugins/task/galleries.py b/nikola/plugins/task/galleries.py
index a780d76..50a2877 100644
--- a/nikola/plugins/task/galleries.py
+++ b/nikola/plugins/task/galleries.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
@@ -32,6 +32,7 @@ import io
import json
import mimetypes
import os
+import pathlib
from collections import OrderedDict
from urllib.parse import urljoin
@@ -544,7 +545,7 @@ class Galleries(Task, ImageProcessor):
except IOError:
excluded_image_name_list = []
- excluded_image_list = ["{0}/{1}".format(gallery_path, i) for i in excluded_image_name_list]
+ excluded_image_list = [os.path.join(gallery_path, i) for i in excluded_image_name_list]
return excluded_image_list
def get_image_list(self, gallery_path):
@@ -737,6 +738,10 @@ class Galleries(Task, ImageProcessor):
else:
img_list, dest_img_list, img_titles = [], [], []
+ def forward_slashes(path):
+ """Given a path, convert directory separators to forward slash, on all platforms."""
+ return str(pathlib.PurePosixPath(*path.split(os.path.sep)))
+
items = []
for img, srcimg, title in list(zip(dest_img_list, img_list, img_titles))[:self.kw["feed_length"]]:
img_size = os.stat(
@@ -744,11 +749,11 @@ class Galleries(Task, ImageProcessor):
self.site.config['OUTPUT_FOLDER'], img)).st_size
args = {
'title': title,
- 'link': make_url(img),
- 'guid': rss.Guid(img, False),
+ 'link': make_url(forward_slashes(img)),
+ 'guid': rss.Guid(forward_slashes(img), False),
'pubDate': self.image_date(srcimg),
'enclosure': rss.Enclosure(
- make_url(img),
+ make_url(forward_slashes(img)),
img_size,
mimetypes.guess_type(img)[0]
),
diff --git a/nikola/plugins/task/gzip.plugin b/nikola/plugins/task/gzip.plugin
index cc078b7..b1aab25 100644
--- a/nikola/plugins/task/gzip.plugin
+++ b/nikola/plugins/task/gzip.plugin
@@ -4,10 +4,10 @@ module = gzip
[Documentation]
author = Roberto Alsina
-version = 1.0
+version = 1.1
website = https://getnikola.com/
description = Create gzipped copies of files
[Nikola]
-PluginCategory = Task
+PluginCategory = TaskMultiplier
diff --git a/nikola/plugins/task/gzip.py b/nikola/plugins/task/gzip.py
index 62523c7..9061807 100644
--- a/nikola/plugins/task/gzip.py
+++ b/nikola/plugins/task/gzip.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
@@ -30,6 +30,7 @@ import gzip
import os
import shlex
import subprocess
+import sys
from nikola.plugin_categories import TaskMultiplier
@@ -73,8 +74,11 @@ class GzipFiles(TaskMultiplier):
def create_gzipped_copy(in_path, out_path, command=None):
"""Create gzipped copy of in_path and save it as out_path."""
if command:
- subprocess.check_call(shlex.split(command.format(filename=in_path)))
+ if sys.platform == 'win32':
+ subprocess.check_call(command.format(filename=in_path))
+ else:
+ subprocess.check_call(shlex.split(command.format(filename=in_path)))
else:
- with gzip.GzipFile(out_path, 'wb+') as outf:
+ with gzip.GzipFile(out_path, 'wb+', mtime=0) as outf:
with open(in_path, 'rb') as inf:
outf.write(inf.read())
diff --git a/nikola/plugins/task/indexes.py b/nikola/plugins/task/indexes.py
index 93c119b..8af550d 100644
--- a/nikola/plugins/task/indexes.py
+++ b/nikola/plugins/task/indexes.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
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:
diff --git a/nikola/plugins/task/page_index.py b/nikola/plugins/task/page_index.py
index 4002e5c..9fb2a2d 100644
--- a/nikola/plugins/task/page_index.py
+++ b/nikola/plugins/task/page_index.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
@@ -106,6 +106,6 @@ class PageIndex(Taxonomy):
short_destination = dirname + '/' + self.site.config['INDEX_FILE']
for post in post_list:
# If there is an index.html pending to be created from a page, do not generate the page index.
- if post.destination_path(lang, sep='/') == short_destination:
+ if post.destination_path(lang, sep='/').lstrip('/') == short_destination.lstrip('/'):
return False
return True
diff --git a/nikola/plugins/task/pages.py b/nikola/plugins/task/pages.py
index d30cdd0..ae26735 100644
--- a/nikola/plugins/task/pages.py
+++ b/nikola/plugins/task/pages.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
diff --git a/nikola/plugins/task/posts.py b/nikola/plugins/task/posts.py
index 86c85ae..242ee76 100644
--- a/nikola/plugins/task/posts.py
+++ b/nikola/plugins/task/posts.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
@@ -26,6 +26,7 @@
"""Build HTML fragments from metadata and text."""
+import docutils
import os
from copy import copy
@@ -57,6 +58,7 @@ class RenderPosts(Task):
"default_lang": self.site.config["DEFAULT_LANG"],
"show_untranslated_posts": self.site.config['SHOW_UNTRANSLATED_POSTS'],
"demote_headers": self.site.config['DEMOTE_HEADERS'],
+ "docutils_version": docutils.__version__,
}
self.tl_changed = False
diff --git a/nikola/plugins/task/redirect.py b/nikola/plugins/task/redirect.py
index b1262a0..5861eba 100644
--- a/nikola/plugins/task/redirect.py
+++ b/nikola/plugins/task/redirect.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
diff --git a/nikola/plugins/task/robots.plugin b/nikola/plugins/task/robots.plugin
index 51f7781..81c4c9a 100644
--- a/nikola/plugins/task/robots.plugin
+++ b/nikola/plugins/task/robots.plugin
@@ -9,5 +9,5 @@ website = https://getnikola.com/
description = Generate /robots.txt exclusion file and promote sitemap.
[Nikola]
-PluginCategory = Task
+PluginCategory = LateTask
diff --git a/nikola/plugins/task/robots.py b/nikola/plugins/task/robots.py
index e1d8d00..ff7f67f 100644
--- a/nikola/plugins/task/robots.py
+++ b/nikola/plugins/task/robots.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
diff --git a/nikola/plugins/task/scale_images.py b/nikola/plugins/task/scale_images.py
index f317a3f..8f1262a 100644
--- a/nikola/plugins/task/scale_images.py
+++ b/nikola/plugins/task/scale_images.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2022 Pelle Nilsson and others.
+# Copyright © 2014-2024 Pelle Nilsson and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/task/sitemap.plugin b/nikola/plugins/task/sitemap.plugin
index c8aa832..8367d8e 100644
--- a/nikola/plugins/task/sitemap.plugin
+++ b/nikola/plugins/task/sitemap.plugin
@@ -9,5 +9,5 @@ website = https://getnikola.com/
description = Generate google sitemap.
[Nikola]
-PluginCategory = Task
+PluginCategory = LateTask
diff --git a/nikola/plugins/task/sitemap.py b/nikola/plugins/task/sitemap.py
index f99f2de..7d40fac 100644
--- a/nikola/plugins/task/sitemap.py
+++ b/nikola/plugins/task/sitemap.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
@@ -309,7 +309,7 @@ class Sitemap(LateTask):
# RFC 3339 (web ISO 8601 profile) represented in UTC with Zulu
# zone desgignator as recommeded for sitemaps. Second and
# microsecond precision is stripped for compatibility.
- lastmod = datetime.datetime.utcfromtimestamp(os.stat(p).st_mtime).replace(tzinfo=dateutil.tz.gettz('UTC'), second=0, microsecond=0).isoformat().replace('+00:00', 'Z')
+ lastmod = datetime.datetime.fromtimestamp(os.stat(p).st_mtime, dateutil.tz.tzutc()).replace(second=0, microsecond=0).isoformat().replace('+00:00', 'Z')
return lastmod
diff --git a/nikola/plugins/task/sources.py b/nikola/plugins/task/sources.py
index 107c8fb..4cf376c 100644
--- a/nikola/plugins/task/sources.py
+++ b/nikola/plugins/task/sources.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
diff --git a/nikola/plugins/task/tags.py b/nikola/plugins/task/tags.py
index 4b0cd8c..61bbd4d 100644
--- a/nikola/plugins/task/tags.py
+++ b/nikola/plugins/task/tags.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
diff --git a/nikola/plugins/task/taxonomies.py b/nikola/plugins/task/taxonomies.py
index 719cf46..55dfa36 100644
--- a/nikola/plugins/task/taxonomies.py
+++ b/nikola/plugins/task/taxonomies.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
diff --git a/nikola/plugins/template/__init__.py b/nikola/plugins/template/__init__.py
index 66f98f7..e989a15 100644
--- a/nikola/plugins/template/__init__.py
+++ b/nikola/plugins/template/__init__.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
diff --git a/nikola/plugins/template/jinja.plugin b/nikola/plugins/template/jinja.plugin
index 629b20e..45dd621 100644
--- a/nikola/plugins/template/jinja.plugin
+++ b/nikola/plugins/template/jinja.plugin
@@ -9,5 +9,5 @@ website = https://getnikola.com/
description = Support for Jinja2 templates.
[Nikola]
-PluginCategory = Template
+PluginCategory = TemplateSystem
diff --git a/nikola/plugins/template/jinja.py b/nikola/plugins/template/jinja.py
index 8aa32aa..e0ddf4a 100644
--- a/nikola/plugins/template/jinja.py
+++ b/nikola/plugins/template/jinja.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
diff --git a/nikola/plugins/template/mako.plugin b/nikola/plugins/template/mako.plugin
index 2d353bf..a465752 100644
--- a/nikola/plugins/template/mako.plugin
+++ b/nikola/plugins/template/mako.plugin
@@ -9,5 +9,5 @@ website = https://getnikola.com/
description = Support for Mako templates.
[Nikola]
-PluginCategory = Template
+PluginCategory = TemplateSystem
diff --git a/nikola/plugins/template/mako.py b/nikola/plugins/template/mako.py
index 5dc9fe5..9517b05 100644
--- a/nikola/plugins/template/mako.py
+++ b/nikola/plugins/template/mako.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