summaryrefslogtreecommitdiffstats
path: root/nikola
diff options
context:
space:
mode:
Diffstat (limited to 'nikola')
-rw-r--r--nikola/__init__.py4
-rw-r--r--nikola/__main__.py2
-rw-r--r--nikola/conf.py.in22
-rw-r--r--nikola/data/samplesite/galleries/demo/index.txt2
-rw-r--r--nikola/data/samplesite/pages/dr-nikolas-vendetta.rst6
-rw-r--r--nikola/data/samplesite/pages/quickref.rst86
-rw-r--r--nikola/data/samplesite/pages/quickstart.rst16
-rw-r--r--nikola/data/themes/base/assets/css/theme.css7
-rw-r--r--nikola/data/themes/bootblog4-jinja/templates/base_helper.tmpl2
-rw-r--r--nikola/data/themes/bootblog4/templates/base_helper.tmpl2
-rw-r--r--nikola/data/themes/bootstrap4-jinja/assets/css/theme.css5
-rw-r--r--nikola/data/themes/bootstrap4-jinja/templates/base_helper.tmpl2
-rw-r--r--nikola/data/themes/bootstrap4/assets/css/theme.css5
-rw-r--r--nikola/data/themes/bootstrap4/templates/base_helper.tmpl2
-rw-r--r--nikola/filters.py2
-rw-r--r--nikola/hierarchy_utils.py2
-rw-r--r--nikola/image_processing.py2
-rw-r--r--nikola/log.py2
-rw-r--r--nikola/metadata_extractors.py2
-rw-r--r--nikola/nikola.py5
-rw-r--r--nikola/packages/datecond/LICENSE2
-rw-r--r--nikola/packages/datecond/__init__.py2
-rw-r--r--nikola/packages/pygments_better_html/LICENSE2
-rw-r--r--nikola/packages/pygments_better_html/__init__.py2
-rw-r--r--nikola/packages/tzlocal/unix.py5
-rw-r--r--nikola/plugin_categories.py9
-rw-r--r--nikola/plugins/basic_import.py2
-rw-r--r--nikola/plugins/command/__init__.py2
-rw-r--r--nikola/plugins/command/auto/__init__.py3
-rw-r--r--nikola/plugins/command/check.py2
-rw-r--r--nikola/plugins/command/console.py2
-rw-r--r--nikola/plugins/command/default_config.py2
-rw-r--r--nikola/plugins/command/deploy.py6
-rw-r--r--nikola/plugins/command/github_deploy.py4
-rw-r--r--nikola/plugins/command/import_wordpress.py2
-rw-r--r--nikola/plugins/command/init.py2
-rw-r--r--nikola/plugins/command/new_page.py2
-rw-r--r--nikola/plugins/command/new_post.py2
-rw-r--r--nikola/plugins/command/orphans.py2
-rw-r--r--nikola/plugins/command/plugin.py2
-rw-r--r--nikola/plugins/command/rst2html/__init__.py2
-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.py24
-rw-r--r--nikola/plugins/compile/php.py2
-rw-r--r--nikola/plugins/compile/rest/__init__.py2
-rw-r--r--nikola/plugins/compile/rest/chart.py2
-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.py2
-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.py2
-rw-r--r--nikola/plugins/misc/taxonomies_classifier.py2
-rw-r--r--nikola/plugins/shortcode/chart.py2
-rw-r--r--nikola/plugins/shortcode/listing.py2
-rw-r--r--nikola/plugins/shortcode/post_list.py8
-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.plugin2
-rw-r--r--nikola/plugins/task/authors.py2
-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.py2
-rw-r--r--nikola/plugins/task/gzip.py2
-rw-r--r--nikola/plugins/task/indexes.py2
-rw-r--r--nikola/plugins/task/listings.py2
-rw-r--r--nikola/plugins/task/page_index.py2
-rw-r--r--nikola/plugins/task/pages.py2
-rw-r--r--nikola/plugins/task/posts.py2
-rw-r--r--nikola/plugins/task/redirect.py2
-rw-r--r--nikola/plugins/task/robots.py2
-rw-r--r--nikola/plugins/task/scale_images.py2
-rw-r--r--nikola/plugins/task/sitemap.py2
-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.py2
-rw-r--r--nikola/plugins/template/mako.py2
-rw-r--r--nikola/post.py26
-rw-r--r--nikola/shortcodes.py2
-rw-r--r--nikola/state.py2
-rw-r--r--nikola/utils.py46
-rw-r--r--nikola/winutils.py2
101 files changed, 266 insertions, 187 deletions
diff --git a/nikola/__init__.py b/nikola/__init__.py
index 4ead429..34396c9 100644
--- a/nikola/__init__.py
+++ b/nikola/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -29,7 +29,7 @@
import os
import sys
-__version__ = '8.1.2'
+__version__ = '8.1.3'
DEBUG = bool(os.getenv('NIKOLA_DEBUG'))
SHOW_TRACEBACKS = bool(os.getenv('NIKOLA_SHOW_TRACEBACKS'))
diff --git a/nikola/__main__.py b/nikola/__main__.py
index 8330e67..0035523 100644
--- a/nikola/__main__.py
+++ b/nikola/__main__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/conf.py.in b/nikola/conf.py.in
index 4546460..fcb2d28 100644
--- a/nikola/conf.py.in
+++ b/nikola/conf.py.in
@@ -195,7 +195,7 @@ TIMEZONE = ${TIMEZONE}
# FORCE_ISO8601 = False
# Date format used to display post dates. (translatable)
-# Used by babel.dates, CLDR style: http://cldr.unicode.org/translation/date-time
+# Used by babel.dates, CLDR style: http://cldr.unicode.org/translation/date-time-1/date-time
# You can also use 'full', 'long', 'medium', or 'short'
# DATE_FORMAT = 'yyyy-MM-dd HH:mm'
@@ -244,7 +244,7 @@ COMPILERS = ${COMPILERS}
# Enable reST directives that insert the contents of external files such
# as "include" and "raw." This maps directly to the docutils file_insertion_enabled
-# config. See: http://docutils.sourceforge.net/docs/user/config.html#file-insertion-enabled
+# config. See: https://docutils.sourceforge.io/docs/user/config.html#file-insertion-enabled
# REST_FILE_INSERTION_ENABLED = True
# Create by default posts in one file format?
@@ -288,6 +288,8 @@ COMPILERS = ${COMPILERS}
# If you want to hide the title of your website (for example, if your logo
# already contains the text), set this to False.
+# Note: if your logo is a SVG image, and you set SHOW_BLOG_TITLE = False,
+# you should explicitly set a height for #logo in CSS.
# SHOW_BLOG_TITLE = True
# Paths for different autogenerated bits. These are combined with the
@@ -981,7 +983,7 @@ PRETTY_URLS = ${PRETTY_URLS}
# DEPLOY_DRAFTS = True
# Allows scheduling of posts using the rule specified here (new_post -s)
-# Specify an iCal Recurrence Rule: http://www.kanzaki.com/docs/ical/rrule.html
+# Specify an iCal Recurrence Rule: https://www.kanzaki.com/docs/ical/rrule.html
# SCHEDULE_RULE = ''
# If True, use the scheduling rule to all posts (not pages!) by default
# SCHEDULE_ALL = False
@@ -1043,9 +1045,17 @@ MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.c
# MARKDOWN_EXTENSION_CONFIGS = {}
-# Extra options to pass to the pandoc command.
-# by default, it's empty, is a list of strings, for example
-# ['-F', 'pandoc-citeproc', '--bibliography=/Users/foo/references.bib']
+# Extra options to pass to the pandoc command, empty by default.
+# It can be a list of strings or a dict (keys are file extensions).
+# Example for a list of strings (used for all extensions):
+# PANDOC_OPTIONS = ['-F', 'pandoc-citeproc', '--bibliography=/Users/foo/references.bib']
+# Example for a dict, where the keys are the extensions in COMPILERS['pandoc']:
+# COMPILERS['pandoc'] = ['.rst', '.md', '.txt']
+# PANDOC_OPTIONS = {
+# '.rst': ['-t', 'rst'],
+# '.md': ['-t', 'markdown'],
+# '.txt': ['-t', 'markdown-raw_html'],
+# }
# Pandoc does not demote headers by default. To enable this, you can use, for example
# ['--base-header-level=2']
# PANDOC_OPTIONS = []
diff --git a/nikola/data/samplesite/galleries/demo/index.txt b/nikola/data/samplesite/galleries/demo/index.txt
index e29f66e..3cb1d02 100644
--- a/nikola/data/samplesite/galleries/demo/index.txt
+++ b/nikola/data/samplesite/galleries/demo/index.txt
@@ -1,4 +1,4 @@
.. title: Nikola Tesla
Some public domain pictures of Nikola Tesla
-(copied from `here <http://kerryr.net/pioneers/gallery/tesla.htm>`_)
+(copied from `here <https://kerryr.net/pioneers/gallery/tesla.htm>`_)
diff --git a/nikola/data/samplesite/pages/dr-nikolas-vendetta.rst b/nikola/data/samplesite/pages/dr-nikolas-vendetta.rst
index 9342f11..2006b63 100644
--- a/nikola/data/samplesite/pages/dr-nikolas-vendetta.rst
+++ b/nikola/data/samplesite/pages/dr-nikolas-vendetta.rst
@@ -5,7 +5,7 @@
.. class:: subtitle
-By `GUY BOOTHBY <http://www.gutenberg.org/ebooks/author/3587>`__
+By `GUY BOOTHBY <https://www.gutenberg.org/ebooks/author/3587>`__
Author of "Dr. Nikola," "The Beautiful White Devil," etc., etc.
@@ -23,14 +23,14 @@ Author of "Dr. Nikola," "The Beautiful White Devil," etc., etc.
Title: A Bid for Fortune
or Dr. Nikola's Vendetta
- Author: `Guy Boothby <http://www.gutenberg.org/ebooks/author/3587>`__
+ Author: `Guy Boothby <https://www.gutenberg.org/ebooks/author/3587>`__
Release Date: May 29, 2007 [EBook #21640]
Language: English
Produced by Marilynda Fraser-Cunliffe, Mary Meehan and the
- Online Distributed Proofreading Team at http://www.pgdp.net
+ Online Distributed Proofreading Team at https://www.pgdp.net
Originally published by:
diff --git a/nikola/data/samplesite/pages/quickref.rst b/nikola/data/samplesite/pages/quickref.rst
index 152fbd0..3768c73 100644
--- a/nikola/data/samplesite/pages/quickref.rst
+++ b/nikola/data/samplesite/pages/quickref.rst
@@ -58,22 +58,22 @@
<p>The full details of the markup may be found on the
- <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
+ <a href="https://docutils.sourceforge.io/rst.html">reStructuredText</a>
page. This document is just intended as a reminder.
<p>Links that look like "(<a href="#details">details</a>)" point
into the HTML version of the full <a
- href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html">reStructuredText
+ href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html">reStructuredText
specification</a> document. These are relative links; if they
don't work, please use the <a
- href="http://docutils.sourceforge.net/docs/user/rst/quickref.html"
+ href="https://docutils.sourceforge.io/docs/user/rst/quickref.html"
>master "Quick reStructuredText"</a> document.
<h2><a href="#contents" name="inline-markup" class="backref"
>Inline Markup</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-markup">details</a>)
<p>Inline markup allows words and phrases within text to have
character styles (like italics and boldface) and functionality
@@ -157,8 +157,8 @@
<td>See <a href="#citations">Citations</a>.
<tr valign="top">
- <td nowrap><samp>http://docutils.sf.net/</samp>
- <td><a href="http://docutils.sf.net/">http://docutils.sf.net/</a>
+ <td nowrap><samp>https://docutils.sourceforge.io/</samp>
+ <td><a href="https://docutils.sourceforge.io/">https://docutils.sourceforge.io/</a>
<td>A standalone hyperlink.
</table>
@@ -206,7 +206,7 @@
>Escaping with Backslashes</a></h2>
<p>(<a
- href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#escaping-mechanism">details</a>)
+ href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#escaping-mechanism">details</a>)
<p>reStructuredText uses backslashes ("\") to override the special
meaning given to markup characters and get the literal characters
@@ -254,7 +254,7 @@
<h2><a href="#contents" name="section-structure" class="backref"
>Section Structure</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#sections">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -300,7 +300,7 @@
<h2><a href="#contents" name="paragraphs" class="backref"
>Paragraphs</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#paragraphs">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#paragraphs">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -328,7 +328,7 @@
<h2><a href="#contents" name="bullet-lists" class="backref"
>Bullet Lists</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#bullet-lists">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#bullet-lists">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -366,7 +366,7 @@
<h2><a href="#contents" name="enumerated-lists" class="backref"
>Enumerated Lists</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#enumerated-lists">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#enumerated-lists">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -404,7 +404,7 @@
<h2><a href="#contents" name="definition-lists" class="backref"
>Definition Lists</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#definition-lists">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#definition-lists">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -445,7 +445,7 @@
<h2><a href="#contents" name="field-lists" class="backref"
>Field Lists</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#field-lists">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#field-lists">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -484,7 +484,7 @@
<h2><a href="#contents" name="option-lists" class="backref"
>Option Lists</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#option-lists">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#option-lists">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -532,7 +532,7 @@
<h2><a href="#contents" name="literal-blocks" class="backref"
>Literal Blocks</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#literal-blocks">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#literal-blocks">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -621,7 +621,7 @@
<h2><a href="#contents" name="line-blocks" class="backref"
>Line Blocks</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#line-blocks">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#line-blocks">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -663,7 +663,7 @@
<h2><a href="#contents" name="block-quotes" class="backref"
>Block Quotes</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#block-quotes">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#block-quotes">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -695,7 +695,7 @@
<h2><a href="#contents" name="doctest-blocks" class="backref"
>Doctest Blocks</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#doctest-blocks">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#doctest-blocks">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -723,7 +723,7 @@
</table>
<p>"The <a
- href="http://www.python.org/doc/current/lib/module-doctest.html">doctest</a>
+ href="https://docs.python.org/3/library/doctest.html">doctest</a>
module searches a module's docstrings for text that looks like an
interactive Python session, then executes all such sessions to
verify they still work exactly as shown." (From the doctest docs.)
@@ -731,7 +731,7 @@
<h2><a href="#contents" name="tables" class="backref"
>Tables</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#tables">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#tables">details</a>)
<p>There are two syntaxes for tables in reStructuredText. Grid
tables are complete but cumbersome to create. Simple tables are
@@ -848,7 +848,7 @@
<h2><a href="#contents" name="transitions" class="backref"
>Transitions</a></h2>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#transitions">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#transitions">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -898,7 +898,7 @@
<h3><a href="#contents" name="footnotes" class="backref"
>Footnotes</a></h3>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#footnotes">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#footnotes">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -991,7 +991,7 @@
<h3><a href="#contents" name="citations" class="backref"
>Citations</a></h3>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#citations">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#citations">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -1044,7 +1044,7 @@
<h3><a href="#contents" name="hyperlink-targets" class="backref"
>Hyperlink Targets</a></h3>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-targets">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#hyperlink-targets">details</a>)
<h4><a href="#contents" name="external-hyperlink-targets" class="backref"
>External Hyperlink Targets</a></h4>
@@ -1061,12 +1061,12 @@
<td rowspan="2">
<samp>External&nbsp;hyperlinks,&nbsp;like&nbsp;Python_.</samp>
- <p><samp>..&nbsp;_Python:&nbsp;http://www.python.org/</samp>
+ <p><samp>..&nbsp;_Python:&nbsp;https://www.python.org/</samp>
<td>
<table class="table" width="100%">
<tr bgcolor="#99CCFF"><td><em>Fold-in form</em>
<tr><td>External hyperlinks, like
- <a href="http://www.python.org/">Python</a>.
+ <a href="https://www.python.org/">Python</a>.
</table>
<tr valign="top">
<td>
@@ -1078,7 +1078,7 @@
<p><table class="table" >
<tr><td colspan="2"><hr>
<tr><td><a name="labPython"><i>Python:</i></a>
- <td> <a href="http://www.python.org/">http://www.python.org/</a>
+ <td> <a href="https://www.python.org/">https://www.python.org/</a>
</table>
</table>
</table>
@@ -1089,11 +1089,11 @@
printed documents, where the link needs to be presented explicitly, for
example as a footnote. You can force usage of the call-out form by
using the
- "<a href="http://docutils.sourceforge.net/docs/ref/rst/directives.html#target-notes">target-notes</a>"
+ "<a href="https://docutils.sourceforge.io/docs/ref/rst/directives.html#target-notes">target-notes</a>"
directive.
<p>reStructuredText also provides for <b>embedded URIs</b> (<a
- href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#embedded-uris">details</a>),
+ href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases">details</a>),
a convenience at the expense of readability. A hyperlink
reference may directly embed a target URI inline, within angle
brackets. The following is exactly equivalent to the example above:
@@ -1109,9 +1109,9 @@
<tr valign="top">
<td rowspan="2">
<samp>External&nbsp;hyperlinks,&nbsp;like&nbsp;`Python
- <br>&lt;http://www.python.org/&gt;`_.</samp>
+ <br>&lt;https://www.python.org/&gt;`_.</samp>
<td>External hyperlinks, like
- <a href="http://www.python.org/">Python</a>.
+ <a href="https://www.python.org/">Python</a>.
</table>
<h4><a href="#contents" name="internal-hyperlink-targets" class="backref"
@@ -1157,7 +1157,7 @@
<h4><a href="#contents" name="indirect-hyperlink-targets" class="backref"
>Indirect Hyperlink Targets</a></h4>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#indirect-hyperlink-targets">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indirect-hyperlink-targets">details</a>)
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
<thead>
@@ -1172,13 +1172,13 @@
<samp>Python_&nbsp;is&nbsp;`my&nbsp;favourite
<br>programming&nbsp;language`__.</samp>
- <p><samp>..&nbsp;_Python:&nbsp;http://www.python.org/</samp>
+ <p><samp>..&nbsp;_Python:&nbsp;https://www.python.org/</samp>
<p><samp>__&nbsp;Python_</samp>
<td>
- <p><a href="http://www.python.org/">Python</a> is
- <a href="http://www.python.org/">my favourite
+ <p><a href="https://www.python.org/">Python</a> is
+ <a href="https://www.python.org/">my favourite
programming language</a>.
</table>
@@ -1197,7 +1197,7 @@
<h4><a href="#contents" name="implicit-hyperlink-targets" class="backref"
>Implicit Hyperlink Targets</a></h4>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#implicit-hyperlink-targets">details</a>)
<p>Section titles, footnotes, and citations automatically generate
hyperlink targets (the title text or footnote/citation label is
@@ -1225,12 +1225,12 @@
<h3><a href="#contents" name="directives" class="backref"
>Directives</a></h3>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#directives">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#directives">details</a>)
<p>Directives are a general-purpose extension mechanism, a way of
adding support for new constructs without adding new syntax. For
a description of all standard directives, see <a
- href="http://docutils.sourceforge.net/docs/ref/rst/directives.html" >reStructuredText
+ href="https://docutils.sourceforge.io/docs/ref/rst/directives.html" >reStructuredText
Directives</a>.
<p><table class="table" border="1" width="100%" bgcolor="#ffffcc" cellpadding="3">
@@ -1253,7 +1253,7 @@
<h3><a href="#contents" name="substitution-references-and-definitions"
class="backref" >Substitution References and Definitions</a></h3>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#substitution-definitions">details</a>)
<p>Substitutions are like inline directives, allowing graphics and
arbitrary constructs within text.
@@ -1283,7 +1283,7 @@
<h3><a href="#contents" name="comments" class="backref"
>Comments</a></h3>
- <p>(<a href="http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#comments">details</a>)
+ <p>(<a href="https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#comments">details</a>)
<p>Any text which begins with an explicit markup start but doesn't
use the syntax of any of the constructs above, is a comment.
@@ -1332,15 +1332,15 @@
reStructuredText should <a
href="mailto:docutils-users@lists.sourceforge.net" >post a
message</a> to the <a
- href="http://lists.sourceforge.net/lists/listinfo/docutils-users"
+ href="https://sourceforge.net/projects/docutils/lists/docutils-users"
>Docutils-Users mailing list</a>. The <a
- href="http://docutils.sourceforge.net/" >Docutils project web
+ href="https://docutils.sourceforge.io/" >Docutils project web
site</a> has more information.
<p><hr>
<address>
<p>Authors:
- <a href="http://www.tibsnjoan.co.uk/">Tibs</a>
+ <a href="https://www.tibsnjoan.co.uk/">Tibs</a>
(<a href="mailto:tibs@tibsnjoan.co.uk"><tt>tibs@tibsnjoan.co.uk</tt></a>)
and David Goodger
(<a href="mailto:goodger@python.org">goodger@python.org</a>)
diff --git a/nikola/data/samplesite/pages/quickstart.rst b/nikola/data/samplesite/pages/quickstart.rst
index 28a452d..50e88a0 100644
--- a/nikola/data/samplesite/pages/quickstart.rst
+++ b/nikola/data/samplesite/pages/quickstart.rst
@@ -22,7 +22,7 @@ quick reference`_ document.
__
.. _Quick reStructuredText: ../quickref/
.. _master quick reference:
- http://docutils.sourceforge.net/docs/user/rst/quickref.html
+ https://docutils.sourceforge.io/docs/user/rst/quickref.html
.. Note:: This document is an informal introduction to
reStructuredText. The `What Next?`_ section below has links to
@@ -100,7 +100,7 @@ __ ../quickref/#escaping
middle of a word won't be recognized. See the `markup spec`__ for
full details.
-__ http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#inline-markup
+__ https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#inline-markup
Lists
@@ -385,8 +385,8 @@ you wish to supply additional information, you may::
See the full `image directive documentation`__ for more info.
-__ http://docutils.sourceforge.net/docs/ref/rst/directives.html
-__ http://docutils.sourceforge.net/docs/ref/rst/directives.html#images
+__ https://docutils.sourceforge.io/docs/ref/rst/directives.html
+__ https://docutils.sourceforge.io/docs/ref/rst/directives.html#images
What Next?
@@ -402,9 +402,9 @@ reStructuredText should post a message to the Docutils-users_ mailing
list.
.. [#] If that relative link doesn't work, try the master document:
- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html.
+ https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html.
.. _reStructuredText Markup Specification:
- http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
-.. _Docutils-users: http://docutils.sourceforge.net/docs/user/mailing-lists.html#docutils-users
-.. _Docutils project web site: http://docutils.sourceforge.net/
+ https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
+.. _Docutils-users: https://docutils.sourceforge.io/docs/user/mailing-lists.html#docutils-users
+.. _Docutils project web site: https://docutils.sourceforge.io/
diff --git a/nikola/data/themes/base/assets/css/theme.css b/nikola/data/themes/base/assets/css/theme.css
index 076351f..69b5fa7 100644
--- a/nikola/data/themes/base/assets/css/theme.css
+++ b/nikola/data/themes/base/assets/css/theme.css
@@ -1,7 +1,7 @@
@charset "UTF-8";
/*
- Copyright © 2014-2020 Daniel Aleksandersen and others.
+ Copyright © 2014-2021 Daniel Aleksandersen and others.
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
@@ -312,6 +312,11 @@ pre.code, code {
overflow: auto;
}
+/* Set a minimum logo height to ensure .svg are displayed if there is no brand text (#3493) */
+#logo {
+ min-height: 25px;
+}
+
/* SOURCE: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
@media print {
*,
diff --git a/nikola/data/themes/bootblog4-jinja/templates/base_helper.tmpl b/nikola/data/themes/bootblog4-jinja/templates/base_helper.tmpl
index 0b74696..7f1bcc8 100644
--- a/nikola/data/themes/bootblog4-jinja/templates/base_helper.tmpl
+++ b/nikola/data/themes/bootblog4-jinja/templates/base_helper.tmpl
@@ -64,7 +64,7 @@ lang="{{ lang }}">
{% macro late_load_js() %}
{% if use_cdn %}
- <script src="http://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
+ <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.js" integrity="sha256-ULQV01VS9LCI2ePpLsmka+W0mawFpEA0rtxnezUj4A4=" crossorigin="anonymous"></script>
diff --git a/nikola/data/themes/bootblog4/templates/base_helper.tmpl b/nikola/data/themes/bootblog4/templates/base_helper.tmpl
index 3c919b4..2259d4d 100644
--- a/nikola/data/themes/bootblog4/templates/base_helper.tmpl
+++ b/nikola/data/themes/bootblog4/templates/base_helper.tmpl
@@ -64,7 +64,7 @@ lang="${lang}">
<%def name="late_load_js()">
%if use_cdn:
- <script src="http://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
+ <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.js" integrity="sha256-ULQV01VS9LCI2ePpLsmka+W0mawFpEA0rtxnezUj4A4=" crossorigin="anonymous"></script>
diff --git a/nikola/data/themes/bootstrap4-jinja/assets/css/theme.css b/nikola/data/themes/bootstrap4-jinja/assets/css/theme.css
index 20eee8e..472f2e7 100644
--- a/nikola/data/themes/bootstrap4-jinja/assets/css/theme.css
+++ b/nikola/data/themes/bootstrap4-jinja/assets/css/theme.css
@@ -230,3 +230,8 @@ pre.code {
html[dir="rtl"] body {
text-align: right;
}
+
+/* Set a minimum logo height to ensure .svg are displayed if there is no brand text (#3493) */
+#logo {
+ min-height: 25px;
+}
diff --git a/nikola/data/themes/bootstrap4-jinja/templates/base_helper.tmpl b/nikola/data/themes/bootstrap4-jinja/templates/base_helper.tmpl
index b4bcf85..2d82147 100644
--- a/nikola/data/themes/bootstrap4-jinja/templates/base_helper.tmpl
+++ b/nikola/data/themes/bootstrap4-jinja/templates/base_helper.tmpl
@@ -64,7 +64,7 @@ lang="{{ lang }}">
{% macro late_load_js() %}
{% if use_cdn %}
- <script src="http://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
+ <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.js" integrity="sha256-ULQV01VS9LCI2ePpLsmka+W0mawFpEA0rtxnezUj4A4=" crossorigin="anonymous"></script>
diff --git a/nikola/data/themes/bootstrap4/assets/css/theme.css b/nikola/data/themes/bootstrap4/assets/css/theme.css
index 20eee8e..472f2e7 100644
--- a/nikola/data/themes/bootstrap4/assets/css/theme.css
+++ b/nikola/data/themes/bootstrap4/assets/css/theme.css
@@ -230,3 +230,8 @@ pre.code {
html[dir="rtl"] body {
text-align: right;
}
+
+/* Set a minimum logo height to ensure .svg are displayed if there is no brand text (#3493) */
+#logo {
+ min-height: 25px;
+}
diff --git a/nikola/data/themes/bootstrap4/templates/base_helper.tmpl b/nikola/data/themes/bootstrap4/templates/base_helper.tmpl
index f551116..80dd8f9 100644
--- a/nikola/data/themes/bootstrap4/templates/base_helper.tmpl
+++ b/nikola/data/themes/bootstrap4/templates/base_helper.tmpl
@@ -64,7 +64,7 @@ lang="${lang}">
<%def name="late_load_js()">
%if use_cdn:
- <script src="http://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
+ <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.11.1/baguetteBox.min.js" integrity="sha256-ULQV01VS9LCI2ePpLsmka+W0mawFpEA0rtxnezUj4A4=" crossorigin="anonymous"></script>
diff --git a/nikola/filters.py b/nikola/filters.py
index 9d7e492..5e7ca5e 100644
--- a/nikola/filters.py
+++ b/nikola/filters.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/hierarchy_utils.py b/nikola/hierarchy_utils.py
index 8993518..7e1fb1a 100644
--- a/nikola/hierarchy_utils.py
+++ b/nikola/hierarchy_utils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/image_processing.py b/nikola/image_processing.py
index 04d4e64..b1d58c2 100644
--- a/nikola/image_processing.py
+++ b/nikola/image_processing.py
@@ -66,7 +66,7 @@ class ImageProcessor(object):
self._fill_exif_tag_names()
exif = exif.copy() # Don't modify in-place, it's rude
for k in list(exif.keys()):
- if type(exif[k]) != dict:
+ if not isinstance(exif[k], dict):
pass # At least thumbnails have no fields
elif k not in whitelist:
exif.pop(k) # Not whitelisted, remove
diff --git a/nikola/log.py b/nikola/log.py
index 9960ba1..9d99e30 100644
--- a/nikola/log.py
+++ b/nikola/log.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/metadata_extractors.py b/nikola/metadata_extractors.py
index 2377dc2..150632e 100644
--- a/nikola/metadata_extractors.py
+++ b/nikola/metadata_extractors.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2021 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/nikola.py b/nikola/nikola.py
index 86d81e6..2ec8f2d 100644
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -414,6 +414,7 @@ class Nikola(object):
self.injected_deps = defaultdict(list)
self.shortcode_registry = {}
self.metadata_extractors_by = default_metadata_extractors_by()
+ self.registered_auto_watched_folders = set()
self.rst_transforms = []
self.template_hooks = {
@@ -799,7 +800,7 @@ class Nikola(object):
for val in self.config['DATE_FORMAT'].values.values():
if '%' in val:
utils.LOGGER.error('The DATE_FORMAT setting needs to be upgraded.')
- utils.LOGGER.warning("Nikola now uses CLDR-style date strings. http://cldr.unicode.org/translation/date-time")
+ utils.LOGGER.warning("Nikola now uses CLDR-style date strings. http://cldr.unicode.org/translation/date-time-1/date-time")
utils.LOGGER.warning("Example: %Y-%m-%d %H:%M ==> yyyy-MM-dd HH:mm")
utils.LOGGER.warning("(note it’s different to what moment.js uses!)")
sys.exit(1)
diff --git a/nikola/packages/datecond/LICENSE b/nikola/packages/datecond/LICENSE
index d9980a8..b6ccdf4 100644
--- a/nikola/packages/datecond/LICENSE
+++ b/nikola/packages/datecond/LICENSE
@@ -1,4 +1,4 @@
-Copyright © 2016-2020, Chris Warrick.
+Copyright © 2016-2021, Chris Warrick.
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/nikola/packages/datecond/__init__.py b/nikola/packages/datecond/__init__.py
index 92e7908..814e3a8 100644
--- a/nikola/packages/datecond/__init__.py
+++ b/nikola/packages/datecond/__init__.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Date Conditionals v0.1.7
-# Copyright © 2015-2020, Chris Warrick.
+# Copyright © 2015-2021, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/nikola/packages/pygments_better_html/LICENSE b/nikola/packages/pygments_better_html/LICENSE
index 196413e..2c07d1e 100644
--- a/nikola/packages/pygments_better_html/LICENSE
+++ b/nikola/packages/pygments_better_html/LICENSE
@@ -1,4 +1,4 @@
-Copyright © 2020, Chris Warrick.
+Copyright © 2020-2021, Chris Warrick.
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/nikola/packages/pygments_better_html/__init__.py b/nikola/packages/pygments_better_html/__init__.py
index ed6e004..3303abb 100644
--- a/nikola/packages/pygments_better_html/__init__.py
+++ b/nikola/packages/pygments_better_html/__init__.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Better HTML formatter for Pygments.
-Copyright © 2020, Chris Warrick.
+Copyright © 2020-2021, Chris Warrick.
License: 3-clause BSD.
Portions copyright © 2006-2019, the Pygments authors. (2-clause BSD).
"""
diff --git a/nikola/packages/tzlocal/unix.py b/nikola/packages/tzlocal/unix.py
index 086ab7c..ce3e852 100644
--- a/nikola/packages/tzlocal/unix.py
+++ b/nikola/packages/tzlocal/unix.py
@@ -116,8 +116,9 @@ def _get_localzone(_root="/"):
while start != 0:
tzpath = tzpath[start:]
try:
- dateutil.tz.gettz(tzpath)
- return tzpath
+ tested_tz = dateutil.tz.gettz(tzpath)
+ if tested_tz:
+ return tzpath
except Exception:
pass
start = tzpath.find("/") + 1
diff --git a/nikola/plugin_categories.py b/nikola/plugin_categories.py
index f6c1def..722e672 100644
--- a/nikola/plugin_categories.py
+++ b/nikola/plugin_categories.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -98,6 +98,9 @@ class BasePlugin(IPlugin):
"""Find the dependencies for a file."""
return []
+ def register_auto_watched_folder(self, folder: str) -> None:
+ self.site.registered_auto_watched_folders.add(folder)
+
class PostScanner(BasePlugin):
"""The scan method of these plugins is called by Nikola.scan_posts."""
@@ -119,7 +122,7 @@ class Command(BasePlugin, DoitCommand):
doc_purpose = "A short explanation."
doc_usage = ""
doc_description = None # None value will completely omit line from doc
- # see http://python-doit.sourceforge.net/cmd_run.html#parameters
+ # see https://pydoit.org/cmd_run.html#parameters
cmd_options = ()
needs_config = True
@@ -302,7 +305,7 @@ class PageCompiler(BasePlugin):
def create_lambda(lang: str) -> 'typing.Callable':
# We create a lambda like this so we can pass `lang` to it, because if we didn’t
# add that function, `lang` would always be the last language in TRANSLATIONS.
- # (See http://docs.python-guide.org/en/latest/writing/gotchas/#late-binding-closures)
+ # (See https://docs.python-guide.org/writing/gotchas/#late-binding-closures)
return lambda: self._read_extra_deps(post, lang)
for lang in self.site.config['TRANSLATIONS']:
diff --git a/nikola/plugins/basic_import.py b/nikola/plugins/basic_import.py
index 3e6e21e..8d14fbf 100644
--- a/nikola/plugins/basic_import.py
+++ b/nikola/plugins/basic_import.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 cdd1560..1b967fc 100644
--- a/nikola/plugins/command/__init__.py
+++ b/nikola/plugins/command/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 6bedcac..9de5622 100644
--- a/nikola/plugins/command/auto/__init__.py
+++ b/nikola/plugins/command/auto/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2021 Chris Warrick, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -184,6 +184,7 @@ class CommandAuto(Command):
watched.add(item)
for item in self.site._plugin_places:
watched.add(item)
+ watched |= self.site.registered_auto_watched_folders
# Nikola itself (useful for developers)
watched.add(pkg_resources.resource_filename('nikola', ''))
diff --git a/nikola/plugins/command/check.py b/nikola/plugins/command/check.py
index cac6000..3482316 100644
--- a/nikola/plugins/command/check.py
+++ b/nikola/plugins/command/check.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/console.py b/nikola/plugins/command/console.py
index b4342b4..a0c6811 100644
--- a/nikola/plugins/command/console.py
+++ b/nikola/plugins/command/console.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2021 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 036f4d1..bd9dc8a 100644
--- a/nikola/plugins/command/default_config.py
+++ b/nikola/plugins/command/default_config.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/deploy.py b/nikola/plugins/command/deploy.py
index 5273b58..64c1c9f 100644
--- a/nikola/plugins/command/deploy.py
+++ b/nikola/plugins/command/deploy.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -54,6 +54,8 @@ class CommandDeploy(Command):
if last_deploy is not None:
last_deploy = dateutil.parser.parse(last_deploy)
clean = False
+ else:
+ clean = True
if self.site.config['COMMENT_SYSTEM'] and self.site.config['COMMENT_SYSTEM_ID'] == 'nikolademo':
self.logger.warning("\nWARNING WARNING WARNING WARNING\n"
@@ -96,6 +98,8 @@ class CommandDeploy(Command):
self.logger.info("Successful deployment")
new_deploy = datetime.utcnow()
+ if last_deploy is None:
+ last_deploy = new_deploy
self._emit_deploy_event(last_deploy, new_deploy, clean, undeployed_posts)
# Store timestamp of successful deployment
diff --git a/nikola/plugins/command/github_deploy.py b/nikola/plugins/command/github_deploy.py
index d2c1f3f..843f56a 100644
--- a/nikola/plugins/command/github_deploy.py
+++ b/nikola/plugins/command/github_deploy.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2020 Puneeth Chaganti and others.
+# Copyright © 2014-2021 Puneeth Chaganti and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -50,7 +50,7 @@ def check_ghp_import_installed():
except OSError:
# req_missing defaults to `python=True` — and it’s meant to be like this.
# `ghp-import` is installed via pip, but the only way to use it is by executing the script it installs.
- req_missing(['ghp-import2'], 'deploy the site to GitHub Pages')
+ req_missing(['ghp-import'], 'deploy the site to GitHub Pages')
class DeployFailedException(Exception):
diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
index 5e2aee6..06e00a1 100644
--- a/nikola/plugins/command/import_wordpress.py
+++ b/nikola/plugins/command/import_wordpress.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 0026edc..4f3cd38 100644
--- a/nikola/plugins/command/init.py
+++ b/nikola/plugins/command/init.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 0f7996a..2f7f304 100644
--- a/nikola/plugins/command/new_page.py
+++ b/nikola/plugins/command/new_page.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2021 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/new_post.py b/nikola/plugins/command/new_post.py
index e6eabbd..4ae2427 100644
--- a/nikola/plugins/command/new_post.py
+++ b/nikola/plugins/command/new_post.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/orphans.py b/nikola/plugins/command/orphans.py
index 0cf2e63..1018d7e 100644
--- a/nikola/plugins/command/orphans.py
+++ b/nikola/plugins/command/orphans.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2021 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 33dee23..9df13b5 100644
--- a/nikola/plugins/command/plugin.py
+++ b/nikola/plugins/command/plugin.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 5576b35..0dea100 100644
--- a/nikola/plugins/command/rst2html/__init__.py
+++ b/nikola/plugins/command/rst2html/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2015-2020 Chris Warrick and others.
+# Copyright © 2015-2021 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/serve.py b/nikola/plugins/command/serve.py
index ede5179..06c7422 100644
--- a/nikola/plugins/command/serve.py
+++ b/nikola/plugins/command/serve.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 c96d13f..72d642c 100644
--- a/nikola/plugins/command/status.py
+++ b/nikola/plugins/command/status.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 554a241..32b0f22 100644
--- a/nikola/plugins/command/subtheme.py
+++ b/nikola/plugins/command/subtheme.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 6f4339a..0a80c29 100644
--- a/nikola/plugins/command/theme.py
+++ b/nikola/plugins/command/theme.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2021 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 9b81343..69ba4d1 100644
--- a/nikola/plugins/command/version.py
+++ b/nikola/plugins/command/version.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 db78fce..bea2e3d 100644
--- a/nikola/plugins/compile/__init__.py
+++ b/nikola/plugins/compile/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 80b6713..c69fd6b 100644
--- a/nikola/plugins/compile/html.py
+++ b/nikola/plugins/compile/html.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 039604b..d60f134 100644
--- a/nikola/plugins/compile/ipynb.py
+++ b/nikola/plugins/compile/ipynb.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2020 Damián Avila, Chris Warrick and others.
+# Copyright © 2013-2021 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 74e8c75..46b2e6e 100644
--- a/nikola/plugins/compile/markdown/__init__.py
+++ b/nikola/plugins/compile/markdown/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 06a6d9a..255ea86 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-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 5090407..647ee1f 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-2020 Michael Rabbitt, Roberto Alsina and others.
+# Copyright © 2013-2021 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 af14344..62d3e88 100644
--- a/nikola/plugins/compile/pandoc.py
+++ b/nikola/plugins/compile/pandoc.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -33,6 +33,8 @@ You will need, of course, to install pandoc
import io
import os
import subprocess
+from typing import List
+from pathlib import Path
from nikola.plugin_categories import PageCompiler
from nikola.utils import req_missing, makedirs, write_metadata
@@ -49,11 +51,29 @@ class CompilePandoc(PageCompiler):
self.config_dependencies = [str(site.config['PANDOC_OPTIONS'])]
super().set_site(site)
+ def _get_pandoc_options(self, source: str) -> List[str]:
+ """Obtain pandoc args from config depending on type and file extensions."""
+ # Union[List[str], Dict[str, List[str]]]
+ config_options = self.site.config['PANDOC_OPTIONS']
+ if isinstance(config_options, (list, tuple)):
+ pandoc_options = list(config_options)
+ elif isinstance(config_options, dict):
+ ext = Path(source).suffix
+ 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))
+ 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))
+ pandoc_options = []
+ return pandoc_options
+
def compile(self, source, dest, is_two_file=True, post=None, lang=None):
"""Compile the source file into HTML and save as dest."""
makedirs(os.path.dirname(dest))
try:
- subprocess.check_call(['pandoc', '-o', dest, source] + self.site.config['PANDOC_OPTIONS'])
+ subprocess.check_call(['pandoc', '-o', dest, source] + self._get_pandoc_options(source))
with open(dest, 'r', encoding='utf-8-sig') as inf:
output, shortcode_deps = self.site.apply_shortcodes(inf.read())
with open(dest, 'w', encoding='utf-8') as outf:
diff --git a/nikola/plugins/compile/php.py b/nikola/plugins/compile/php.py
index 818e10d..347f222 100644
--- a/nikola/plugins/compile/php.py
+++ b/nikola/plugins/compile/php.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 44da076..082cae0 100644
--- a/nikola/plugins/compile/rest/__init__.py
+++ b/nikola/plugins/compile/rest/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/chart.py b/nikola/plugins/compile/rest/chart.py
index 17363cb..a950292 100644
--- a/nikola/plugins/compile/rest/chart.py
+++ b/nikola/plugins/compile/rest/chart.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/doc.py b/nikola/plugins/compile/rest/doc.py
index 705c0bc..05b0ad2 100644
--- a/nikola/plugins/compile/rest/doc.py
+++ b/nikola/plugins/compile/rest/doc.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 e5a73fa..f669b16 100644
--- a/nikola/plugins/compile/rest/listing.py
+++ b/nikola/plugins/compile/rest/listing.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 d29d0a2..eb7a69e 100644
--- a/nikola/plugins/compile/rest/media.py
+++ b/nikola/plugins/compile/rest/media.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 f7e95ed..d953372 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-2020 Udo Spallek, Roberto Alsina and others.
+# Copyright © 2013-2021 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/compile/rest/soundcloud.py b/nikola/plugins/compile/rest/soundcloud.py
index 5dbcfc3..65d9e6b 100644
--- a/nikola/plugins/compile/rest/soundcloud.py
+++ b/nikola/plugins/compile/rest/soundcloud.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 06ca9e4..1cce086 100644
--- a/nikola/plugins/compile/rest/thumbnail.py
+++ b/nikola/plugins/compile/rest/thumbnail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2020 Pelle Nilsson and others.
+# Copyright © 2014-2021 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 7047b03..1b1dbcc 100644
--- a/nikola/plugins/compile/rest/vimeo.py
+++ b/nikola/plugins/compile/rest/vimeo.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 d52ec64..24220e5 100644
--- a/nikola/plugins/compile/rest/youtube.py
+++ b/nikola/plugins/compile/rest/youtube.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 1e7e6e1..71a3de4 100644
--- a/nikola/plugins/misc/__init__.py
+++ b/nikola/plugins/misc/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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.py b/nikola/plugins/misc/scan_posts.py
index 8812779..b001b3a 100644
--- a/nikola/plugins/misc/scan_posts.py
+++ b/nikola/plugins/misc/scan_posts.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 da8045b..946f57e 100644
--- a/nikola/plugins/misc/taxonomies_classifier.py
+++ b/nikola/plugins/misc/taxonomies_classifier.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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.py b/nikola/plugins/shortcode/chart.py
index 64341e8..d15dd0d 100644
--- a/nikola/plugins/shortcode/chart.py
+++ b/nikola/plugins/shortcode/chart.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/listing.py b/nikola/plugins/shortcode/listing.py
index b51365a..72136ea 100644
--- a/nikola/plugins/shortcode/listing.py
+++ b/nikola/plugins/shortcode/listing.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2017-2020 Roberto Alsina and others.
+# Copyright © 2017-2021 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.py b/nikola/plugins/shortcode/post_list.py
index 462984a..0206cf0 100644
--- a/nikola/plugins/shortcode/post_list.py
+++ b/nikola/plugins/shortcode/post_list.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2020 Udo Spallek, Roberto Alsina and others.
+# Copyright © 2013-2021 Udo Spallek, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -145,6 +145,7 @@ class PostListShortcode(ShortcodePlugin):
if self_post:
self_post.register_depfile("####MAGIC####TIMELINE", lang=lang)
+ self_post.register_depfile("####MAGIC####CONFIG:GLOBAL_CONTEXT", lang=lang)
# If we get strings for start/stop, make them integers
if start is not None:
@@ -227,7 +228,8 @@ class PostListShortcode(ShortcodePlugin):
for d in template_deps:
self_post.register_depfile(d, lang=lang)
- template_data = {
+ template_data = site.GLOBAL_CONTEXT.copy()
+ template_data.update({
'lang': lang,
'posts': posts,
# Need to provide str, not TranslatableSetting (Issue #2104)
@@ -235,7 +237,7 @@ class PostListShortcode(ShortcodePlugin):
'post_list_id': post_list_id,
'messages': site.MESSAGES,
'_link': site.link,
- }
+ })
output = site.template_system.render_template(
template, None, template_data)
return output, template_deps
diff --git a/nikola/plugins/shortcode/thumbnail.py b/nikola/plugins/shortcode/thumbnail.py
index feb731b..48f5384 100644
--- a/nikola/plugins/shortcode/thumbnail.py
+++ b/nikola/plugins/shortcode/thumbnail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2017-2020 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2017-2021 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 3e18cd5..36ca227 100644
--- a/nikola/plugins/task/__init__.py
+++ b/nikola/plugins/task/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 4cbf215..6f619e9 100644
--- a/nikola/plugins/task/archive.py
+++ b/nikola/plugins/task/archive.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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.plugin b/nikola/plugins/task/authors.plugin
index 19e687c..77444ad 100644
--- a/nikola/plugins/task/authors.plugin
+++ b/nikola/plugins/task/authors.plugin
@@ -5,7 +5,7 @@ Module = authors
[Documentation]
Author = Juanjo Conti
Version = 0.1
-Website = http://getnikola.com
+Website = https://getnikola.com
Description = Render the author pages and feeds.
[Nikola]
diff --git a/nikola/plugins/task/authors.py b/nikola/plugins/task/authors.py
index 24fe650..a62e9f2 100644
--- a/nikola/plugins/task/authors.py
+++ b/nikola/plugins/task/authors.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2015-2020 Juanjo Conti and others.
+# Copyright © 2015-2021 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.py b/nikola/plugins/task/bundles.py
index aa4ce78..f12b3a8 100644
--- a/nikola/plugins/task/bundles.py
+++ b/nikola/plugins/task/bundles.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 68f9caa..3c0ea6b 100644
--- a/nikola/plugins/task/categories.py
+++ b/nikola/plugins/task/categories.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 c6d32c7..960b16c 100644
--- a/nikola/plugins/task/copy_assets.py
+++ b/nikola/plugins/task/copy_assets.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 26364d4..7d07662 100644
--- a/nikola/plugins/task/copy_files.py
+++ b/nikola/plugins/task/copy_files.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 b8ac9ee..1c53cbd 100644
--- a/nikola/plugins/task/galleries.py
+++ b/nikola/plugins/task/galleries.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/gzip.py b/nikola/plugins/task/gzip.py
index ebd427f..04a78dd 100644
--- a/nikola/plugins/task/gzip.py
+++ b/nikola/plugins/task/gzip.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/indexes.py b/nikola/plugins/task/indexes.py
index 20491fb..1007c57 100644
--- a/nikola/plugins/task/indexes.py
+++ b/nikola/plugins/task/indexes.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 c946313..5f4fca9 100644
--- a/nikola/plugins/task/listings.py
+++ b/nikola/plugins/task/listings.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/page_index.py b/nikola/plugins/task/page_index.py
index e7b33cf..d18e150 100644
--- a/nikola/plugins/task/page_index.py
+++ b/nikola/plugins/task/page_index.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/pages.py b/nikola/plugins/task/pages.py
index 0c0bdd2..0c45f10 100644
--- a/nikola/plugins/task/pages.py
+++ b/nikola/plugins/task/pages.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 5f48165..7308d55 100644
--- a/nikola/plugins/task/posts.py
+++ b/nikola/plugins/task/posts.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/redirect.py b/nikola/plugins/task/redirect.py
index a89fbd0..9b4db8c 100644
--- a/nikola/plugins/task/redirect.py
+++ b/nikola/plugins/task/redirect.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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.py b/nikola/plugins/task/robots.py
index 627d436..05ceba3 100644
--- a/nikola/plugins/task/robots.py
+++ b/nikola/plugins/task/robots.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 fa3a67b..e5e8a55 100644
--- a/nikola/plugins/task/scale_images.py
+++ b/nikola/plugins/task/scale_images.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2020 Pelle Nilsson and others.
+# Copyright © 2014-2021 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.py b/nikola/plugins/task/sitemap.py
index 8bbaa63..17a180f 100644
--- a/nikola/plugins/task/sitemap.py
+++ b/nikola/plugins/task/sitemap.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/sources.py b/nikola/plugins/task/sources.py
index 1d36429..8d2a9d1 100644
--- a/nikola/plugins/task/sources.py
+++ b/nikola/plugins/task/sources.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 aecf8f5..a1a6b77 100644
--- a/nikola/plugins/task/tags.py
+++ b/nikola/plugins/task/tags.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 7dcf6ed..dee2550 100644
--- a/nikola/plugins/task/taxonomies.py
+++ b/nikola/plugins/task/taxonomies.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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 a530db4..5554e53 100644
--- a/nikola/plugins/template/__init__.py
+++ b/nikola/plugins/template/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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.py b/nikola/plugins/template/jinja.py
index 7795739..845f4d5 100644
--- a/nikola/plugins/template/jinja.py
+++ b/nikola/plugins/template/jinja.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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.py b/nikola/plugins/template/mako.py
index 30e2041..8066b96 100644
--- a/nikola/plugins/template/mako.py
+++ b/nikola/plugins/template/mako.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/post.py b/nikola/post.py
index 82d957d..795f9d6 100644
--- a/nikola/post.py
+++ b/nikola/post.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -54,7 +54,8 @@ from .utils import (
to_datetime,
demote_headers,
get_translation_candidate,
- map_metadata
+ map_metadata,
+ bool_from_meta,
)
try:
@@ -427,13 +428,14 @@ class Post(object):
def has_pretty_url(self, lang):
"""Check if this page has a pretty URL."""
- m = self.meta[lang].get('pretty_url', '')
- if m:
- # match is a non-empty string, overides anything
- return m.lower() == 'true' or m.lower() == 'yes'
- else:
+ meta_value = bool_from_meta(self.meta[lang], 'pretty_url')
+
+ if meta_value is None:
# use PRETTY_URLS, unless the slug is 'index'
return self.pretty_urls and self.meta[lang]['slug'] != 'index'
+ else:
+ # override with meta value
+ return meta_value
def _has_pretty_url(self, lang):
"""Check if this page has a pretty URL."""
@@ -450,13 +452,13 @@ class Post(object):
return True
lang = nikola.utils.LocaleBorg().current_lang
if self.is_translation_available(lang):
- if self.meta[lang].get('has_math') in ('true', 'True', 'yes', '1', 1, True):
+ if bool_from_meta(self.meta[lang], 'has_math'):
return True
if self.config['USE_TAG_METADATA']:
return 'mathjax' in self.tags_for_language(lang)
# If it has math in ANY other language, enable it. Better inefficient than broken.
for lang in self.translated_to:
- if self.meta[lang].get('has_math') in ('true', 'True', 'yes', '1', 1, True):
+ if bool_from_meta(self.meta[lang], 'has_math'):
return True
if self.config['USE_TAG_METADATA']:
return 'mathjax' in self.alltags
@@ -612,9 +614,9 @@ class Post(object):
if add not in {'fragment', 'page', 'both'}:
raise Exception("Add parameter is '{0}', but must be either 'fragment', 'page', or 'both'.".format(add))
if add == 'fragment' or add == 'both':
- self._dependency_file_fragment[lang].append((type(dependency) != str, dependency))
+ self._dependency_file_fragment[lang].append((not isinstance(dependency, str), dependency))
if add == 'page' or add == 'both':
- self._dependency_file_page[lang].append((type(dependency) != str, dependency))
+ self._dependency_file_page[lang].append((not isinstance(dependency, str), dependency))
def add_dependency_uptodate(self, dependency, is_callable=False, add='both', lang=None):
"""Add a dependency for task's ``uptodate`` for tasks using that post.
@@ -677,7 +679,7 @@ class Post(object):
# can add directly
result = dep[1]
# if result is a list, add its contents
- if type(result) == list:
+ if isinstance(result, list):
deps.extend(result)
else:
deps.append(result)
diff --git a/nikola/shortcodes.py b/nikola/shortcodes.py
index 6116b98..797c1ea 100644
--- a/nikola/shortcodes.py
+++ b/nikola/shortcodes.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/state.py b/nikola/state.py
index 4669d13..03f6280 100644
--- a/nikola/state.py
+++ b/nikola/state.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 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/utils.py b/nikola/utils.py
index d029b7f..54cd36f 100644
--- a/nikola/utils.py
+++ b/nikola/utils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -80,9 +80,9 @@ except ImportError:
YAML = None
try:
- import husl
+ import hsluv
except ImportError:
- husl = None
+ hsluv = None
__all__ = ('CustomEncoder', 'get_theme_path', 'get_theme_path_real',
'get_theme_chain', 'load_messages', 'copy_tree', 'copy_file',
@@ -97,7 +97,7 @@ __all__ = ('CustomEncoder', 'get_theme_path', 'get_theme_path_real',
'adjust_name_for_index_path', 'adjust_name_for_index_link',
'NikolaPygmentsHTML', 'create_redirect', 'clean_before_deployment',
'sort_posts', 'smartjoin', 'indent', 'load_data', 'html_unescape',
- 'rss_writer', 'map_metadata', 'req_missing',
+ 'rss_writer', 'map_metadata', 'req_missing', 'bool_from_meta',
# Deprecated, moved to hierarchy_utils:
'TreeNode', 'clone_treenode', 'flatten_tree_structure',
'sort_classifications', 'join_hierarchical_category_path',
@@ -792,7 +792,7 @@ def remove_file(source):
# slugify is adopted from
-# http://code.activestate.com/recipes/
+# https://code.activestate.com/recipes/
# 577257-slugify-make-a-string-usable-in-a-url-or-filename/
_slugify_strip_re = re.compile(r'[^+\w\s-]', re.UNICODE)
_slugify_hyphenate_re = re.compile(r'[-\s]+', re.UNICODE)
@@ -904,7 +904,9 @@ def extract_all(zipfile, path='themes'):
def to_datetime(value, tzinfo=None):
"""Convert string to datetime."""
try:
- if type(value) == datetime.date:
+ if type(value) is datetime.date:
+ # type() instead of isinstance() is expected here, since we don’t
+ # want to change datetime.datetime objects.
value = datetime.datetime.combine(value, datetime.time(0, 0))
if not isinstance(value, datetime.datetime):
# dateutil does bad things with TZs like UTC-03:00.
@@ -1495,6 +1497,24 @@ def write_metadata(data, metadata_format=None, comment_wrap=False, site=None, co
return DEFAULT_EXTRACTOR.write_metadata(data, comment_wrap)
+def bool_from_meta(meta, key, fallback=False, blank=None):
+ """Convert a boolean-ish meta value to a boolean."""
+ value = meta.get(key)
+ if isinstance(value, str):
+ value_lowercase = value.lower().strip()
+ if value_lowercase in {"true", "yes", "1"}:
+ return True
+ elif value_lowercase in {"false", "no", "0"}:
+ return False
+ elif not value_lowercase:
+ return blank
+ elif isinstance(value, int):
+ return bool(value)
+ elif value is None:
+ return blank
+ return fallback
+
+
def ask(query, default=None):
"""Ask a question."""
if default:
@@ -1752,7 +1772,7 @@ def colorize_str_from_base_color(string, base_color):
Make up to 16 attempts (number of bytes returned by hashing) at picking a
hue for our color at least 27 deg removed from the base color, leaving
- lightness and saturation untouched using HUSL colorspace.
+ lightness and saturation untouched using HSLuv colorspace.
"""
def hash_str(string, pos):
return hashlib.md5(string.encode('utf-8')).digest()[pos]
@@ -1760,17 +1780,17 @@ def colorize_str_from_base_color(string, base_color):
def degreediff(dega, degb):
return min(abs(dega - degb), abs((degb - dega) + 360))
- if husl is None:
- req_missing(['husl'], 'Use color mixing (section colors)',
+ if hsluv is None:
+ req_missing(['hsluv'], 'Use color mixing (section colors)',
optional=True)
return base_color
- h, s, l = husl.hex_to_husl(base_color)
+ h, s, l = hsluv.hex_to_hsluv(base_color)
old_h = h
idx = 0
while degreediff(old_h, h) < 27 and idx < 16:
h = 360.0 * (float(hash_str(string, idx)) / 255)
idx += 1
- return husl.husl_to_hex(h, s, l)
+ return hsluv.hsluv_to_hex((h, s, l))
def colorize_str(string: str, base_color: str, presets: dict):
@@ -1782,7 +1802,7 @@ def colorize_str(string: str, base_color: str, presets: dict):
def color_hsl_adjust_hex(hexstr, adjust_h=None, adjust_s=None, adjust_l=None):
"""Adjust a hex color using HSL arguments, adjustments in percentages 1.0 to -1.0. Returns a hex color."""
- h, s, l = husl.hex_to_husl(hexstr)
+ h, s, l = hsluv.hex_to_hsluv(hexstr)
if adjust_h:
h = h + (adjust_h * 360.0)
@@ -1793,7 +1813,7 @@ def color_hsl_adjust_hex(hexstr, adjust_h=None, adjust_s=None, adjust_l=None):
if adjust_l:
l = l + (adjust_l * 100.0)
- return husl.husl_to_hex(h, s, l)
+ return hsluv.hsluv_to_hex((h, s, l))
def dns_sd(port, inet6):
diff --git a/nikola/winutils.py b/nikola/winutils.py
index a6506e6..0a06c44 100644
--- a/nikola/winutils.py
+++ b/nikola/winutils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2020 Roberto Alsina and others.
+# Copyright © 2012-2021 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated