summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/task
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/task
parent393aa58f2c5afd51f92fd9bd4b6dfd0dc90cea41 (diff)
New upstream version 8.3.0.upstream/8.3.0upstream
Diffstat (limited to 'nikola/plugins/task')
-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
25 files changed, 51 insertions, 37 deletions
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