aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml12
-rw-r--r--AUTHORS.txt1
-rw-r--r--CHANGES.txt37
-rw-r--r--LICENSE.txt2
-rw-r--r--docs/extending.rst2
-rw-r--r--docs/man/nikola.1.gzbin1783 -> 1787 bytes
-rw-r--r--docs/man/nikola.rst2
-rw-r--r--docs/manual.rst29
-rw-r--r--docs/social_buttons.rst2
-rw-r--r--docs/sphinx/conf.py6
-rw-r--r--docs/support.rst2
-rw-r--r--docs/template-variables.rst27
-rw-r--r--docs/theming.rst56
-rw-r--r--nikola/__init__.py4
-rw-r--r--nikola/__main__.py37
-rw-r--r--nikola/data/themes/base/assets/css/rst_base.css64
-rw-r--r--nikola/data/themes/base/assets/css/theme.css2
-rw-r--r--nikola/filters.py2
-rw-r--r--nikola/hierarchy_utils.py2
-rw-r--r--nikola/log.py2
-rw-r--r--nikola/metadata_extractors.py2
-rw-r--r--nikola/nikola.py2
-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/plugin_categories.py2
-rw-r--r--nikola/plugins/basic_import.py2
-rw-r--r--nikola/plugins/command/__init__.py2
-rw-r--r--nikola/plugins/command/auto/__init__.py2
-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.py2
-rw-r--r--nikola/plugins/command/github_deploy.py2
-rw-r--r--nikola/plugins/command/import_wordpress.py4
-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__.py11
-rw-r--r--nikola/plugins/compile/markdown/mdx_gist.py15
-rw-r--r--nikola/plugins/compile/markdown/mdx_nikola.py2
-rw-r--r--nikola/plugins/compile/markdown/mdx_podcast.py5
-rw-r--r--nikola/plugins/compile/pandoc.py2
-rw-r--r--nikola/plugins/compile/php.py2
-rw-r--r--nikola/plugins/compile/rest/__init__.py4
-rw-r--r--nikola/plugins/compile/rest/chart.py2
-rw-r--r--nikola/plugins/compile/rest/doc.py2
-rw-r--r--nikola/plugins/compile/rest/listing.py33
-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.py15
-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.py2
-rw-r--r--nikola/plugins/shortcode/thumbnail.py2
-rw-r--r--nikola/plugins/task/__init__.py2
-rw-r--r--nikola/plugins/task/archive.py2
-rw-r--r--nikola/plugins/task/authors.py2
-rw-r--r--nikola/plugins/task/bundles.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.py10
-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.py3
-rw-r--r--nikola/shortcodes.py2
-rw-r--r--nikola/state.py2
-rw-r--r--nikola/utils.py46
-rw-r--r--nikola/winutils.py2
-rw-r--r--scripts/debug_rebuilds/README.md2
-rwxr-xr-xscripts/release2
-rwxr-xr-xsetup.py12
-rw-r--r--snapcraft.yaml2
-rw-r--r--tests/test_compile_markdown.py10
-rw-r--r--tests/test_rst_compiler.py23
-rw-r--r--tests/test_utils.py26
109 files changed, 459 insertions, 199 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 81efafa..aeef23d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,13 +12,13 @@ jobs:
strategy:
fail-fast: false
matrix:
- python: [3.5, 3.6, 3.7, 3.8, 3.9]
+ python: ['3.7', '3.8', '3.9', '3.10']
image:
- ubuntu-latest
include:
- - python: 3.9
+ - python: '3.10'
image: macos-latest
- - python: 3.9
+ - python: '3.10'
image: windows-latest
runs-on: '${{ matrix.image }}'
steps:
@@ -52,7 +52,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- python: [3.9]
+ python: ['3.10']
image:
- ubuntu-latest
runs-on: '${{ matrix.image }}'
@@ -81,7 +81,7 @@ jobs:
strategy:
matrix:
python:
- - 3.9
+ - '3.10'
runs-on: ubuntu-latest
steps:
- name: Check out code
@@ -108,7 +108,7 @@ jobs:
strategy:
matrix:
python:
- - 3.9
+ - '3.10'
runs-on: ubuntu-latest
steps:
- name: Check out code
diff --git a/AUTHORS.txt b/AUTHORS.txt
index 68a925b..efdcdf1 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -117,6 +117,7 @@
* `Roman Faizullin <https://github.com/faizrr>`_
* `Roman Imankulov <https://github.com/imankulov>`_
* `Santiago Pestarini <https://github.com/quijot>`_
+* `Santiago Fraire Willemoes <https://github.com/Woile>`_
* `Sean Pue <https://github.com/seanpue>`_
* `Simon van der Veldt <https://github.com/simonvanderveldt>`_
* `Stefan Näwe <https://github.com/snaewe>`_
diff --git a/CHANGES.txt b/CHANGES.txt
index bc71d3d..a5b5e32 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,40 @@
+New in v8.2.3
+=============
+
+Bugfixes
+--------
+
+* Compatibility with Markdown 3.4.0 (Issue #3635)
+* Find substring in string instead of using `contains` in utils
+* Don't add semicolon in docinfo fields via CSS (caused duplicated
+ semicolons)
+
+Nikola now requires Python 3.7 or newer.
+
+New in v8.2.2
+=============
+
+* Compatibility with Pygments 2.12.0 (Issue #3617, #3618)
+
+New in v8.2.1
+=============
+
+Features
+--------
+
+* Add ``emphasize_lines`` directive to code blocks (Issue #3607)
+* Gallery index pages support the ``status`` flag (Issue #3598)
+* Add ``start_at`` option to youtube directive (Issue #3603)
+
+Bugfixes
+--------
+
+* Add data files to dependency file (Issue #3608)
+* Compatibility with doit 0.36.0 (Issue #3612)
+
+Note: ``nikola doit_auto`` is not available if using ``doit>=0.36.0``.
+You can still use ``nikola auto``.
+
New in v8.2.0
=============
diff --git a/LICENSE.txt b/LICENSE.txt
index 8dc948b..b59416a 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright © 2012-2021 Roberto Alsina and others.
+Copyright © 2012-2022 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/docs/extending.rst b/docs/extending.rst
index 395d839..eead796 100644
--- a/docs/extending.rst
+++ b/docs/extending.rst
@@ -6,7 +6,7 @@
.. description:
.. author: The Nikola Team
-:Version: 8.2.0
+:Version: 8.2.3
:Author: Roberto Alsina <ralsina@netmanagers.com.ar>
.. class:: alert alert-primary float-md-right
diff --git a/docs/man/nikola.1.gz b/docs/man/nikola.1.gz
index c6b9ec8..c850b70 100644
--- a/docs/man/nikola.1.gz
+++ b/docs/man/nikola.1.gz
Binary files differ
diff --git a/docs/man/nikola.rst b/docs/man/nikola.rst
index 470fe48..7290887 100644
--- a/docs/man/nikola.rst
+++ b/docs/man/nikola.rst
@@ -6,7 +6,7 @@ Nikola
A Static Site and Blog Generator
--------------------------------
-:Version: Nikola 8.2.0
+:Version: Nikola 8.2.3
:Manual section: 1
:Manual group: User Commands
diff --git a/docs/manual.rst b/docs/manual.rst
index f4ab0f0..1ca7a72 100644
--- a/docs/manual.rst
+++ b/docs/manual.rst
@@ -7,7 +7,7 @@
.. has_math: true
.. author: The Nikola Team
-:Version: 8.2.0
+:Version: 8.2.3
.. class:: alert alert-primary float-md-right
@@ -134,7 +134,7 @@ Obsolescence
You may say those are long term issues, or that they won't matter for years. Well,
I believe things should work forever, or as close to it as we can make them.
Nikola's static output and its input files will work as long as you can install
- Python 3.5 or newer under Linux, Windows, or macOS and can find a server
+ Python 3.7 or newer under Linux, Windows, or macOS and can find a server
that sends files over HTTP. That's probably 10 or 15 years at least.
Also, static sites are easily handled by the Internet Archive.
@@ -2089,8 +2089,11 @@ The ``conf.py`` options affecting images and gallery pages are these:
If you add a reST file in ``galleries/gallery_name/index.txt`` its contents will be
converted to HTML and inserted above the images in the gallery page. The
-format is the same as for posts. You can use the ``title`` and ``previewimage``
-metadata fields to change how the gallery is shown.
+format is the same as for posts. You can use the ``title``, ``previewimage``, and
+``status`` metadata fields to change how the gallery is shown.
+
+If the ``status`` is ``private``, ``draft``, or ``publish_later``, the
+gallery will not appear in the index, the RSS feeds, nor in the sitemap.
If you add some image filenames in ``galleries/gallery_name/exclude.meta``, they
will be excluded in the gallery page.
@@ -2619,13 +2622,14 @@ Once you have that, all you need to do is:
.. youtube:: 8N_tupPBtWQ
-Supported options: ``height``, ``width``, ``align`` (one of ``left``,
+Supported options: ``height``, ``width``, ``start_at``, ``align`` (one of ``left``,
``center``, ``right``) — all are optional. Example:
.. code:: restructuredtext
.. youtube:: 8N_tupPBtWQ
:align: center
+ :start_at: 4
Vimeo
~~~~~
@@ -2690,6 +2694,21 @@ for ``code`` directive are provided: ``code-block`` and ``sourcecode``:
print("Our virtues and our failings are inseparable")
+Certain lines might be highlighted via the ``emphasize-lines`` directive:
+
+.. code:: restructuredtext
+
+ .. code-block:: python
+ :emphasize-lines: 3,5
+
+ def some_function():
+ interesting = False
+ print('This line is highlighted.')
+ print('This one is not...')
+ print('...but this one is.')
+
+Line ranges are also supported, such as ``:emphasize-lines: 1-3,5-9,15``.
+
Listing
~~~~~~~
diff --git a/docs/social_buttons.rst b/docs/social_buttons.rst
index f1bfc08..f093a70 100644
--- a/docs/social_buttons.rst
+++ b/docs/social_buttons.rst
@@ -6,7 +6,7 @@
.. description:
.. author: The Nikola Team
-:Version: 8.2.0
+:Version: 8.2.3
.. class:: alert alert-primary float-md-right
diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py
index 15c1ac0..51b3483 100644
--- a/docs/sphinx/conf.py
+++ b/docs/sphinx/conf.py
@@ -48,16 +48,16 @@ master_doc = 'index'
# General information about the project.
project = 'Nikola'
-copyright = '2012-2021, The Nikola Contributors'
+copyright = '2012-2022, The Nikola Contributors'
# The version info for the project yo're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '8.2.0'
+version = '8.2.3'
# The full version, including alpha/beta/rc tags.
-release = '8.2.0'
+release = '8.2.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/docs/support.rst b/docs/support.rst
index d25a4d4..e895bac 100644
--- a/docs/support.rst
+++ b/docs/support.rst
@@ -4,7 +4,7 @@
.. description: Get help using Nikola, or contact us.
.. author: The Nikola Team
-:Version: 8.2.0
+:Version: 8.2.3
.. class:: alert alert-primary float-md-right
diff --git a/docs/template-variables.rst b/docs/template-variables.rst
index aeb254a..63210c1 100644
--- a/docs/template-variables.rst
+++ b/docs/template-variables.rst
@@ -3,7 +3,7 @@
.. date: 2017-04-13 12:00:00
.. author: The Nikola Team
-:Version: 8.2.0
+:Version: 8.2.3
:Author: Chris Warrick <chris@getnikola.com>
Variables available in templates are listed below.
@@ -84,14 +84,6 @@ Name Type Descript
``navigation_links`` TranslatableSetting ``NAVIGATION_LINKS`` setting
``navigation_alt_links`` TranslatableSetting ``NAVIGATION_ALT_LINKS`` setting
``needs_ipython_css`` bool whether or not Jupyter CSS is needed by this site
-``posts_sections`` bool ``POSTS_SECTIONS`` setting
-``posts_section_are_indexes`` bool ``POSTS_SECTIONS_ARE_INDEXES`` setting
-``posts_sections_are_indexes`` bool ``POSTS_SECTIONS_ARE_INDEXES`` setting
-``posts_section_colors`` TranslatableSetting ``POSTS_SECTION_COLORS`` setting
-``posts_section_descriptions`` Tss ``POSTS_SECTION_DESCRIPTIONS`` setting
-``posts_section_from_meta`` bool ``POSTS_SECTION_FROM_META`` setting
-``posts_section_name`` TranslatableSetting[str] ``POSTS_SECTION_NAME`` setting
-``posts_section_title`` TranslatableSetting[str] ``POSTS_SECTION_TITLE`` setting
``rel_link`` function ``Nikola.rel_link`` function
``rss_link`` str ``RSS_LINK`` setting
``search_form`` TranslatableSetting[str] ``SEARCH_FORM`` setting
@@ -205,7 +197,6 @@ Taxonomy Variable Value
``category`` ``overview_page_hierarchy_variable_name`` ``cat_hierarchy``
``index`` ``overview_page_variable_name`` unavailable (None)
``page_index_folder`` ``overview_page_variable_name`` ``page_folder``
-``section_index`` ``overview_page_variable_name`` ``sections``
``tag`` ``overview_page_variable_name`` ``tags``
``tag`` ``overview_page_items_variable_name`` ``items``
====================== ========================================== ===================
@@ -224,7 +215,6 @@ Taxonomy Has hierarchy List (one classification) template
``category`` yes tag.tmpl tagindex.tmpl tags.tmpl (with tags) n/a ``CATEGORY_PAGES_ARE_INDEXES`` n/a
``index`` no n/a index.tmpl n/a n/a yes no
``page_index_folder`` yes list.tmpl n/a n/a n/a no no
-``section_index`` no list.tmpl sectionindex.tmpl n/a n/a ``POSTS_SECTIONS_ARE_INDEXES`` no
``tag`` no tag.tmpl tagindex.tmpl tags.tmpl (with categories) n/a ``TAG_PAGES_ARE_INDEXES`` no
====================== ================== ================================== ====================================== ============================================== ====================================== ============================== ==============================
@@ -391,19 +381,6 @@ Name Type Description
``source_link`` str Link to the source file
================== ========== ========================================
-Variables available in sections
--------------------------------
-
-.. class:: table table-bordered table-striped
-
-=================== =========== ===========================================================================
-Name Type Description
-=================== =========== ===========================================================================
-``section`` str Section name (internal)
-``kind`` str Always ``"section"``
-``other_languages`` list[tuple] List of tuples ``(lang, section, name)`` of same section in other languages
-=================== =========== ===========================================================================
-
Variables available in tag pages
--------------------------------
@@ -477,7 +454,7 @@ Post object attributes
This list only includes variables that make sense for templates. Some function signatures have been shortened to save space, ``?`` means the argument has default value.
-More docs: `nikola.post.Post on ReadTheDocs <https://nikola.readthedocs.io/en/latest/nikola/#nikola.post.Post>`_. Check out the source of the Post class as well.
+More docs: `nikola.post.Post on ReadTheDocs <https://nikola.readthedocs.io/en/latest/nikola.html#nikola.post.Post>`_. Check out the source of the Post class as well.
=================================================================== ========== =============================================================
Name Type Description
diff --git a/docs/theming.rst b/docs/theming.rst
index 957e68e..ff10d28 100644
--- a/docs/theming.rst
+++ b/docs/theming.rst
@@ -6,7 +6,7 @@
.. description:
.. author: The Nikola Team
-:Version: 8.2.0
+:Version: 8.2.3
:Author: Roberto Alsina <ralsina@netmanagers.com.ar>
.. class:: alert alert-primary float-md-right
@@ -284,10 +284,6 @@ These are the templates that come with the included themes:
``post_list_directive.tmpl``
Template used by the ``post_list`` reStructuredText directive.
-``sectionindex.tmpl``
- Used to display section indexes, if ``POST_SECTIONS_ARE_INDEXES`` is True.
- By default, it just inherits ``index.tmpl``, with added feeds.
-
``page.tmpl``
Used for pages that are not part of a blog, usually a cleaner, less
intrusive layout than ``post.tmpl``, but same parameters.
@@ -309,20 +305,50 @@ Variables available in templates
The full, complete list of variables available in templates is maintained in a separate
document: `Template variables <https://getnikola.com/template-variables.html>`_
-Customizing themes to user color preference and section colors
---------------------------------------------------------------
+Customizing themes to user color preference, colorizing category names
+----------------------------------------------------------------------
The user’s preference for theme color is exposed in templates as
``theme_color`` set in the ``THEME_COLOR`` option.
-Each section has an assigned color that is either set by the user or auto
-selected by adjusting the hue of the user’s ``THEME_COLOR``. The color is
-exposed in templates through ``post.section_color(lang)``. The function that
-generates the colors from strings and any given color (by section name and
-theme color for sections) is exposed through the
-``colorize_str_from_base_color(string, hex_color)`` function
+This theme color is exposed to the browser in default themes — some browsers
+might use this color in the user interface (eg. Chrome on Android in light mode
+displays the toolbar in this color).
+
+Nikola also comes with support for auto-generating colors similar to a base
+color. This can be used with ``theme_color`` and eg. category names. This
+feature is exposed to templates as two functions: ``colorize_str(string,
+hex_color, presets)`` and ``colorize_str_from_base_color(string, hex_color)``.
+If you want to display the category name in the color, first define a list of
+overrides in your ``conf.py`` file:
+
+.. code:: python
+
+ # end of conf.py
+ GLOBAL_CONTEXT = {
+ "category_colors": {
+ "Blue": "#0000FF"
+ }
+ }
+
+With that definition, you can now use ``colorize_str`` in your templates like this:
+
+.. code:: html+mako
+
+ <!-- Mako -->
+ <span style="background-color: ${colorize_str(post.meta('category'), theme_color, category_colors)}">${post.meta('category')}</span>
+
+.. code:: html+jinja
+
+ <!-- Jinja2 -->
+ <span style="background-color: {{ colorize_str(post.meta('category'), theme_color, category_colors) }}">{{ post.meta('category') }}</span>
+
+Note that the category named “Blue” will be displyed in #0000FF due to the
+override specified in your config; other categories will have an auto-generated
+color visually similar to your theme color.
+
-Hex color values, like that returned by the theme or section color can be
+Hex color values, like that returned by the theme or string colorization can be
altered in the HSL colorspace through the function
``color_hsl_adjust_hex(hex_string, adjust_h, adjust_s, adjust_l)``.
Adjustments are given in values between 1.0 and -1.0. For example, the theme
@@ -427,12 +453,10 @@ List of page kinds provided by default plugins:
* index, archive_page
* index, author_page
* index, main_index
-* index, section_page
* index, tag_page
* list
* list, archive_page
* list, author_page
-* list, section_page
* list, tag_page
* list, tags_page
* post_page
diff --git a/nikola/__init__.py b/nikola/__init__.py
index e085f91..200d23d 100644
--- a/nikola/__init__.py
+++ b/nikola/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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.2.0'
+__version__ = '8.2.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 0035523..03c7a51 100644
--- a/nikola/__main__.py
+++ b/nikola/__main__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -36,8 +36,7 @@ import doit.cmd_base
from collections import defaultdict
from blinker import signal
-from doit.cmd_auto import Auto as DoitAuto
-from doit.cmd_base import TaskLoader, _wrap
+from doit.cmd_base import TaskLoader2, _wrap
from doit.cmd_clean import Clean as DoitClean
from doit.cmd_completion import TabCompletion
from doit.cmd_help import Help as DoitHelp
@@ -247,31 +246,41 @@ class Clean(DoitClean):
# Nikola has its own "auto" commands that uses livereload.
# Expose original doit "auto" command as "doit_auto".
-DoitAuto.name = 'doit_auto'
+# doit_auto is not available with doit>=0.36.0.
+try:
+ from doit.cmd_auto import Auto as DoitAuto
+ DoitAuto.name = 'doit_auto'
+except ImportError:
+ DoitAuto = None
-class NikolaTaskLoader(TaskLoader):
+class NikolaTaskLoader(TaskLoader2):
"""Nikola-specific task loader."""
def __init__(self, nikola, quiet=False):
"""Initialize the loader."""
+ super().__init__()
self.nikola = nikola
self.quiet = quiet
- def load_tasks(self, cmd, opt_values, pos_args):
- """Load Nikola tasks."""
+ def load_doit_config(self):
+ """Load doit configuration."""
if self.quiet:
- DOIT_CONFIG = {
+ doit_config = {
'verbosity': 0,
'reporter': 'zero',
}
else:
- DOIT_CONFIG = {
+ doit_config = {
'reporter': ExecutedOnlyReporter,
'outfile': sys.stderr,
}
- DOIT_CONFIG['default_tasks'] = ['render_site', 'post_render']
- DOIT_CONFIG.update(self.nikola._doit_config)
+ doit_config['default_tasks'] = ['render_site', 'post_render']
+ doit_config.update(self.nikola._doit_config)
+ return doit_config
+
+ def load_tasks(self, cmd, pos_args):
+ """Load Nikola tasks."""
try:
tasks = generate_tasks(
'render_site',
@@ -286,15 +295,17 @@ class NikolaTaskLoader(TaskLoader):
raise
_print_exception()
sys.exit(3)
- return tasks + latetasks, DOIT_CONFIG
+ return tasks + latetasks
class DoitNikola(DoitMain):
"""Nikola-specific implementation of DoitMain."""
# overwite help command
- DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean, DoitAuto]
+ DOIT_CMDS = list(DoitMain.DOIT_CMDS) + [Help, Build, Clean]
TASK_LOADER = NikolaTaskLoader
+ if DoitAuto is not None:
+ DOIT_CMDS.append(DoitAuto)
def __init__(self, nikola, quiet=False):
"""Initialzie DoitNikola."""
diff --git a/nikola/data/themes/base/assets/css/rst_base.css b/nikola/data/themes/base/assets/css/rst_base.css
index 51f92b4..fcd7318 100644
--- a/nikola/data/themes/base/assets/css/rst_base.css
+++ b/nikola/data/themes/base/assets/css/rst_base.css
@@ -123,11 +123,6 @@ dl.option-list > dd > *:first-child
width: 100%;
margin: 0;
}
-/* field names followed by a colon */
-dl.field-list > dt:after,
-dl.docinfo > dt:after {
- content: ":";
-}
/* Bibliographic Fields (docinfo) */
dl.docinfo pre.address {
@@ -140,13 +135,62 @@ dl.docinfo > dd.authors > p { margin: 0; }
dl.option-list > dt { font-weight: normal; }
span.option { white-space: nowrap; }
+
/* Footnotes and Citations */
+
+.footnote, .citation { margin: 1em 0; } /* default paragraph skip (Firefox) */
+/* hanging indent */
+.citation { padding-left: 2em; }
+.footnote { padding-left: 1.7em; }
+.footnote.superscript { padding-left: 1.0em; }
+.citation > .label { margin-left: -2em; }
+.footnote > .label { margin-left: -1.7em; }
+.footnote.superscript > .label { margin-left: -1.0em; }
+
+.footnote > .label + *,
+.citation > .label + * {
+ display: inline-block;
+ margin-top: 0;
+ vertical-align: top;
+}
+.footnote > .backrefs + *,
+.citation > .backrefs + * {
+ margin-top: 0;
+}
+.footnote > .label + p, .footnote > .backrefs + p,
+.citation > .label + p, .citation > .backrefs + p {
+ display: inline;
+ vertical-align: inherit;
+}
+
+.backrefs { user-select: none; }
+.backrefs > a { font-style: italic; }
+
+/* superscript footnotes */
+a[role="doc-noteref"].superscript,
+.footnote.superscript > .label,
+.footnote.superscript > .backrefs {
+ vertical-align: super;
+ font-size: smaller;
+ line-height: 1;
+}
+a[role="doc-noteref"].superscript > .fn-bracket,
+.footnote.superscript > .label > .fn-bracket {
+ /* hide brackets in display but leave for copy/paste */
+ display: inline-block;
+ width: 0;
+ overflow: hidden;
+}
+[role="doc-noteref"].superscript + [role="doc-noteref"].superscript {
+ padding-left: 0.15em; /* separate consecutive footnote references */
+ /* TODO: unfortunately, "+" also selects with text between the references. */
+}
+
+/* Legacy Footnotes and Citations */
dl.footnote.superscript > dd { margin-left: 1em; }
dl.footnote.brackets > dd { margin-left: 2em; }
dl.footnote > dt { font-weight: normal; }
-a.footnote-reference.brackets:before,
dt.label > span.brackets:before { content: "["; }
-a.footnote-reference.brackets:after,
dt.label > span.brackets:after { content: "]"; }
a.footnote-reference.superscript,
dl.footnote.superscript > dt.label {
@@ -363,6 +407,12 @@ table.numbered > caption:before {
/* ----------------------- */
/* line on the left */
+.footnote-list {
+ border-left: solid thin;
+ padding-left: 0.25em;
+}
+
+/* same thing for old docutils versions */
dl.footnote {
padding-left: 1ex;
border-left: solid;
diff --git a/nikola/data/themes/base/assets/css/theme.css b/nikola/data/themes/base/assets/css/theme.css
index 69b5fa7..b198c2c 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-2021 Daniel Aleksandersen and others.
+ Copyright © 2014-2022 Daniel Aleksandersen and others.
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
diff --git a/nikola/filters.py b/nikola/filters.py
index c2b10e2..8deeb89 100644
--- a/nikola/filters.py
+++ b/nikola/filters.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 7e1fb1a..7e8d9b8 100644
--- a/nikola/hierarchy_utils.py
+++ b/nikola/hierarchy_utils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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/log.py b/nikola/log.py
index 9d99e30..eedee72 100644
--- a/nikola/log.py
+++ b/nikola/log.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 150632e..4e0ae10 100644
--- a/nikola/metadata_extractors.py
+++ b/nikola/metadata_extractors.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2022 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 ca8291b..41eeac6 100644
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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/packages/datecond/LICENSE b/nikola/packages/datecond/LICENSE
index b6ccdf4..fcc5730 100644
--- a/nikola/packages/datecond/LICENSE
+++ b/nikola/packages/datecond/LICENSE
@@ -1,4 +1,4 @@
-Copyright © 2016-2021, Chris Warrick.
+Copyright © 2016-2022, 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 814e3a8..4e9566c 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-2021, Chris Warrick.
+# Copyright © 2015-2022, 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 2c07d1e..8312fb8 100644
--- a/nikola/packages/pygments_better_html/LICENSE
+++ b/nikola/packages/pygments_better_html/LICENSE
@@ -1,4 +1,4 @@
-Copyright © 2020-2021, Chris Warrick.
+Copyright © 2020-2022, 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 3303abb..565dcb4 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-2021, Chris Warrick.
+Copyright © 2020-2022, Chris Warrick.
License: 3-clause BSD.
Portions copyright © 2006-2019, the Pygments authors. (2-clause BSD).
"""
diff --git a/nikola/plugin_categories.py b/nikola/plugin_categories.py
index 0ba5991..14760df 100644
--- a/nikola/plugin_categories.py
+++ b/nikola/plugin_categories.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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/basic_import.py b/nikola/plugins/basic_import.py
index 8d14fbf..ca88cfb 100644
--- a/nikola/plugins/basic_import.py
+++ b/nikola/plugins/basic_import.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 1b967fc..6c8e81a 100644
--- a/nikola/plugins/command/__init__.py
+++ b/nikola/plugins/command/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 2c6d0e7..b13b645 100644
--- a/nikola/plugins/command/auto/__init__.py
+++ b/nikola/plugins/command/auto/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2022 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/check.py b/nikola/plugins/command/check.py
index 3482316..f9b701b 100644
--- a/nikola/plugins/command/check.py
+++ b/nikola/plugins/command/check.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 a0c6811..96fee3e 100644
--- a/nikola/plugins/command/console.py
+++ b/nikola/plugins/command/console.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Chris Warrick, Roberto Alsina and others.
+# Copyright © 2012-2022 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 bd9dc8a..fddda26 100644
--- a/nikola/plugins/command/default_config.py
+++ b/nikola/plugins/command/default_config.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 64c1c9f..1896a7a 100644
--- a/nikola/plugins/command/deploy.py
+++ b/nikola/plugins/command/deploy.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/command/github_deploy.py b/nikola/plugins/command/github_deploy.py
index 843f56a..1d3e9c0 100644
--- a/nikola/plugins/command/github_deploy.py
+++ b/nikola/plugins/command/github_deploy.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2021 Puneeth Chaganti and others.
+# Copyright © 2014-2022 Puneeth Chaganti and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
index f513e1c..f3feab1 100644
--- a/nikola/plugins/command/import_wordpress.py
+++ b/nikola/plugins/command/import_wordpress.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -1189,7 +1189,7 @@ def separate_qtranslate_tagged_langs(text):
if not c.strip():
continue
elif c[2:qt_end_with_lang_len].startswith(qt_end):
- # a language specific section (with language code at the begining)
+ # a language specific section (with language code at the beginning)
lang = c[:2]
c = c[qt_end_with_lang_len:]
else:
diff --git a/nikola/plugins/command/init.py b/nikola/plugins/command/init.py
index 4f3cd38..4607758 100644
--- a/nikola/plugins/command/init.py
+++ b/nikola/plugins/command/init.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 2f7f304..94fbc51 100644
--- a/nikola/plugins/command/new_page.py
+++ b/nikola/plugins/command/new_page.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2022 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 4ae2427..f66a188 100644
--- a/nikola/plugins/command/new_post.py
+++ b/nikola/plugins/command/new_post.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 1018d7e..169cbba 100644
--- a/nikola/plugins/command/orphans.py
+++ b/nikola/plugins/command/orphans.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2022 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 9df13b5..ae0dead 100644
--- a/nikola/plugins/command/plugin.py
+++ b/nikola/plugins/command/plugin.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 0dea100..2bf329a 100644
--- a/nikola/plugins/command/rst2html/__init__.py
+++ b/nikola/plugins/command/rst2html/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2015-2021 Chris Warrick and others.
+# Copyright © 2015-2022 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 06c7422..cbf628c 100644
--- a/nikola/plugins/command/serve.py
+++ b/nikola/plugins/command/serve.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 72d642c..ab6fc1e 100644
--- a/nikola/plugins/command/status.py
+++ b/nikola/plugins/command/status.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 32b0f22..b5c5aff 100644
--- a/nikola/plugins/command/subtheme.py
+++ b/nikola/plugins/command/subtheme.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 0a80c29..2f99dd8 100644
--- a/nikola/plugins/command/theme.py
+++ b/nikola/plugins/command/theme.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2012-2022 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 69ba4d1..4ec8a46 100644
--- a/nikola/plugins/command/version.py
+++ b/nikola/plugins/command/version.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 bea2e3d..c3abcd4 100644
--- a/nikola/plugins/compile/__init__.py
+++ b/nikola/plugins/compile/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 c69fd6b..ff7d37f 100644
--- a/nikola/plugins/compile/html.py
+++ b/nikola/plugins/compile/html.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 d60f134..7d6e528 100644
--- a/nikola/plugins/compile/ipynb.py
+++ b/nikola/plugins/compile/ipynb.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2021 Damián Avila, Chris Warrick and others.
+# Copyright © 2013-2022 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 46b2e6e..31a57d9 100644
--- a/nikola/plugins/compile/markdown/__init__.py
+++ b/nikola/plugins/compile/markdown/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -33,13 +33,20 @@ import threading
from nikola import shortcodes as sc
from nikola.plugin_categories import PageCompiler
-from nikola.utils import makedirs, req_missing, write_metadata, LocaleBorg, map_metadata
+from nikola.utils import makedirs, req_missing, write_metadata, LocaleBorg, map_metadata, NikolaPygmentsHTML
try:
from markdown import Markdown
except ImportError:
Markdown = None
+# Override Pygments formatter for Markdown.
+try:
+ import markdown.extensions.codehilite
+ markdown.extensions.codehilite.get_formatter_by_name = lambda _, **args: NikolaPygmentsHTML(**args)
+except ImportError:
+ pass
+
class ThreadLocalMarkdown(threading.local):
"""Convert Markdown to HTML using per-thread Markdown objects.
diff --git a/nikola/plugins/compile/markdown/mdx_gist.py b/nikola/plugins/compile/markdown/mdx_gist.py
index f6ce20a..fc24d34 100644
--- a/nikola/plugins/compile/markdown/mdx_gist.py
+++ b/nikola/plugins/compile/markdown/mdx_gist.py
@@ -76,19 +76,19 @@ Error Case: non-existent file:
"""
import requests
+import xml.etree.ElementTree as etree
from nikola.plugin_categories import MarkdownExtension
from nikola.utils import get_logger
try:
from markdown.extensions import Extension
- from markdown.inlinepatterns import Pattern
+ from markdown.inlinepatterns import InlineProcessor
from markdown.util import AtomicString
- from markdown.util import etree
except ImportError:
# No need to catch this, if you try to use this without Markdown,
# the markdown compiler will fail first
- Extension = Pattern = object
+ Extension = InlineProcessor = AtomicString = object
LOGGER = get_logger('compile_markdown.mdx_gist')
@@ -112,12 +112,12 @@ class GistFetchException(Exception):
status_code, url)
-class GistPattern(Pattern):
+class GistPattern(InlineProcessor):
"""InlinePattern for footnote markers in a document's body text."""
def __init__(self, pattern, configs):
"""Initialize the pattern."""
- Pattern.__init__(self, pattern)
+ InlineProcessor.__init__(self, pattern)
def get_raw_gist_with_filename(self, gist_id, filename):
"""Get raw gist text for a filename."""
@@ -139,8 +139,9 @@ class GistPattern(Pattern):
return resp.text
- def handleMatch(self, m):
+ def handleMatch(self, m, _):
"""Handle pattern match."""
+ # The third arg is "data", wider context around the match; we don't need it.
gist_id = m.group('gist_id')
gist_file = m.group('filename')
@@ -170,7 +171,7 @@ class GistPattern(Pattern):
warning_comment = etree.Comment(' WARNING: {0} '.format(e.message))
noscript_elem.append(warning_comment)
- return gist_elem
+ return (gist_elem, m.start(0), m.end(0))
class GistExtension(MarkdownExtension, Extension):
diff --git a/nikola/plugins/compile/markdown/mdx_nikola.py b/nikola/plugins/compile/markdown/mdx_nikola.py
index 255ea86..af30956 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-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 647ee1f..e003f40 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-2021 Michael Rabbitt, Roberto Alsina and others.
+# Copyright © 2013-2022 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
@@ -36,11 +36,12 @@ Basic Example:
<p><audio controls=""><source src="https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3" type="audio/mpeg"></source></audio></p>
"""
+import xml.etree.ElementTree as etree
+
from nikola.plugin_categories import MarkdownExtension
try:
from markdown.extensions import Extension
from markdown.inlinepatterns import Pattern
- from markdown.util import etree
except ImportError:
# No need to catch this, if you try to use this without Markdown,
# the markdown compiler will fail first
diff --git a/nikola/plugins/compile/pandoc.py b/nikola/plugins/compile/pandoc.py
index 62d3e88..a43c8b0 100644
--- a/nikola/plugins/compile/pandoc.py
+++ b/nikola/plugins/compile/pandoc.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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/php.py b/nikola/plugins/compile/php.py
index 347f222..d4c67dc 100644
--- a/nikola/plugins/compile/php.py
+++ b/nikola/plugins/compile/php.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 082cae0..e5d3998 100644
--- a/nikola/plugins/compile/rest/__init__.py
+++ b/nikola/plugins/compile/rest/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -264,7 +264,7 @@ def add_node(node, visit_function=None, depart_function=None):
"""Register a Docutils node class.
This function is completely optional. It is a same concept as
- `Sphinx add_node function <http://sphinx-doc.org/extdev/appapi.html#sphinx.application.Sphinx.add_node>`_.
+ `Sphinx add_node function <https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_node>`_.
For example::
diff --git a/nikola/plugins/compile/rest/chart.py b/nikola/plugins/compile/rest/chart.py
index a950292..15ccee7 100644
--- a/nikola/plugins/compile/rest/chart.py
+++ b/nikola/plugins/compile/rest/chart.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 05b0ad2..1d88472 100644
--- a/nikola/plugins/compile/rest/doc.py
+++ b/nikola/plugins/compile/rest/doc.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 f669b16..48dbe4c 100644
--- a/nikola/plugins/compile/rest/listing.py
+++ b/nikola/plugins/compile/rest/listing.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -57,7 +57,8 @@ class CodeBlock(Directive):
'name': directives.unchanged,
'number-lines': directives.unchanged, # integer or None
'linenos': directives.unchanged,
- 'tab-width': directives.nonnegative_int}
+ 'tab-width': directives.nonnegative_int,
+ 'emphasize-lines': directives.unchanged_required}
has_content = True
def run(self):
@@ -103,7 +104,33 @@ class CodeBlock(Directive):
else:
anchor_ref = 'rest_code_' + uuid.uuid4().hex
- formatter = utils.NikolaPygmentsHTML(anchor_ref=anchor_ref, classes=classes, linenos=linenos, linenostart=linenostart)
+ linespec = self.options.get('emphasize-lines')
+ if linespec:
+ try:
+ nlines = len(self.content)
+ hl_lines = utils.parselinenos(linespec, nlines)
+ if any(i >= nlines for i in hl_lines):
+ raise self.error(
+ 'line number spec is out of range(1-%d): %r' %
+ (nlines, self.options['emphasize-lines'])
+ )
+ hl_lines = [x + 1 for x in hl_lines if x < nlines]
+ except ValueError as err:
+ raise self.error(err)
+ else:
+ hl_lines = None
+
+ extra_kwargs = {}
+ if hl_lines is not None:
+ extra_kwargs['hl_lines'] = hl_lines
+
+ formatter = utils.NikolaPygmentsHTML(
+ anchor_ref=anchor_ref,
+ classes=classes,
+ linenos=linenos,
+ linenostart=linenostart,
+ **extra_kwargs
+ )
out = pygments.highlight(code, lexer, formatter)
node = nodes.raw('', out, format='html')
diff --git a/nikola/plugins/compile/rest/media.py b/nikola/plugins/compile/rest/media.py
index eb7a69e..6d0436d 100644
--- a/nikola/plugins/compile/rest/media.py
+++ b/nikola/plugins/compile/rest/media.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 d953372..1799790 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-2021 Udo Spallek, Roberto Alsina and others.
+# Copyright © 2013-2022 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 65d9e6b..87b1483 100644
--- a/nikola/plugins/compile/rest/soundcloud.py
+++ b/nikola/plugins/compile/rest/soundcloud.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 1cce086..6f10a7f 100644
--- a/nikola/plugins/compile/rest/thumbnail.py
+++ b/nikola/plugins/compile/rest/thumbnail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2021 Pelle Nilsson and others.
+# Copyright © 2014-2022 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 1b1dbcc..b4f89ff 100644
--- a/nikola/plugins/compile/rest/vimeo.py
+++ b/nikola/plugins/compile/rest/vimeo.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 24220e5..de3f2fa 100644
--- a/nikola/plugins/compile/rest/youtube.py
+++ b/nikola/plugins/compile/rest/youtube.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -48,7 +48,7 @@ class Plugin(RestExtension):
CODE = """\
<div class="youtube-video{align}">
<iframe width="{width}" height="{height}"
-src="https://www.youtube-nocookie.com/embed/{yid}?rel=0&wmode=transparent"
+src="https://www.youtube-nocookie.com/embed/{yid}?rel=0&wmode=transparent{start_at}"
frameborder="0" allow="encrypted-media" allowfullscreen
></iframe>
</div>"""
@@ -69,7 +69,8 @@ class Youtube(Directive):
option_spec = {
"width": directives.unchanged,
"height": directives.unchanged,
- "align": _align_choice
+ "align": _align_choice,
+ "start_at": directives.unchanged
}
def run(self):
@@ -85,6 +86,14 @@ class Youtube(Directive):
options['align'] = ' align-' + self.options['align']
else:
options['align'] = ''
+
+ start_at = options.get('start_at')
+
+ if start_at:
+ options['start_at'] = '&start=' + start_at
+ else:
+ options['start_at'] = ''
+
return [nodes.raw('', CODE.format(**options), format='html')]
def check_content(self):
diff --git a/nikola/plugins/misc/__init__.py b/nikola/plugins/misc/__init__.py
index 71a3de4..0572088 100644
--- a/nikola/plugins/misc/__init__.py
+++ b/nikola/plugins/misc/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 b001b3a..efa797e 100644
--- a/nikola/plugins/misc/scan_posts.py
+++ b/nikola/plugins/misc/scan_posts.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 946f57e..c6092b3 100644
--- a/nikola/plugins/misc/taxonomies_classifier.py
+++ b/nikola/plugins/misc/taxonomies_classifier.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 d15dd0d..2b88cfb 100644
--- a/nikola/plugins/shortcode/chart.py
+++ b/nikola/plugins/shortcode/chart.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 72136ea..3046655 100644
--- a/nikola/plugins/shortcode/listing.py
+++ b/nikola/plugins/shortcode/listing.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2017-2021 Roberto Alsina and others.
+# Copyright © 2017-2022 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 2d8d170..5b24cc6 100644
--- a/nikola/plugins/shortcode/post_list.py
+++ b/nikola/plugins/shortcode/post_list.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2013-2021 Udo Spallek, Roberto Alsina and others.
+# Copyright © 2013-2022 Udo Spallek, Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
diff --git a/nikola/plugins/shortcode/thumbnail.py b/nikola/plugins/shortcode/thumbnail.py
index 48f5384..7a05320 100644
--- a/nikola/plugins/shortcode/thumbnail.py
+++ b/nikola/plugins/shortcode/thumbnail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2017-2021 Roberto Alsina, Chris Warrick and others.
+# Copyright © 2017-2022 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 36ca227..10c54d0 100644
--- a/nikola/plugins/task/__init__.py
+++ b/nikola/plugins/task/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 6f619e9..f083394 100644
--- a/nikola/plugins/task/archive.py
+++ b/nikola/plugins/task/archive.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 a62e9f2..d966a4f 100644
--- a/nikola/plugins/task/authors.py
+++ b/nikola/plugins/task/authors.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2015-2021 Juanjo Conti and others.
+# Copyright © 2015-2022 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 f12b3a8..c71c255 100644
--- a/nikola/plugins/task/bundles.py
+++ b/nikola/plugins/task/bundles.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 b140101..11a0407 100644
--- a/nikola/plugins/task/categories.py
+++ b/nikola/plugins/task/categories.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 960b16c..fd22e0d 100644
--- a/nikola/plugins/task/copy_assets.py
+++ b/nikola/plugins/task/copy_assets.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 7d07662..3818808 100644
--- a/nikola/plugins/task/copy_files.py
+++ b/nikola/plugins/task/copy_files.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 c9b1915..a780d76 100644
--- a/nikola/plugins/task/galleries.py
+++ b/nikola/plugins/task/galleries.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -85,6 +85,7 @@ class Galleries(Task, ImageProcessor):
'exif_whitelist': site.config['EXIF_WHITELIST'],
'preserve_icc_profiles': site.config['PRESERVE_ICC_PROFILES'],
'index_path': site.config['INDEX_PATH'],
+ 'index_file': site.config['INDEX_FILE'],
'disable_indexes': site.config['DISABLE_INDEXES'],
'galleries_use_thumbnail': site.config['GALLERIES_USE_THUMBNAIL'],
'galleries_default_thumbnail': site.config['GALLERIES_DEFAULT_THUMBNAIL'],
@@ -270,6 +271,10 @@ class Galleries(Task, ImageProcessor):
for path, folder in folder_list:
fpost = self.parse_index(path, input_folder, output_folder)
if fpost:
+ # do not add galleries to the folders that are either
+ # of these states (#3598)
+ if fpost.is_draft or fpost.is_private or fpost.publish_later:
+ continue
ft = fpost.title(lang) or folder
else:
ft = folder
@@ -522,6 +527,9 @@ class Galleries(Task, ImageProcessor):
post.meta[lang]['title'] = os.path.split(gallery)[1]
# Register the post (via #2417)
self.site.post_per_input_file[index_path] = post
+ # Register post for the sitemap, too (#3598)
+ index_output = os.path.join(gallery, self.kw['index_file'])
+ self.site.post_per_file[index_output] = post
else:
post = None
return post
diff --git a/nikola/plugins/task/gzip.py b/nikola/plugins/task/gzip.py
index 04a78dd..62523c7 100644
--- a/nikola/plugins/task/gzip.py
+++ b/nikola/plugins/task/gzip.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 1007c57..93c119b 100644
--- a/nikola/plugins/task/indexes.py
+++ b/nikola/plugins/task/indexes.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 d52ddb2..510411a 100644
--- a/nikola/plugins/task/listings.py
+++ b/nikola/plugins/task/listings.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 d18e150..4002e5c 100644
--- a/nikola/plugins/task/page_index.py
+++ b/nikola/plugins/task/page_index.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 0c45f10..d30cdd0 100644
--- a/nikola/plugins/task/pages.py
+++ b/nikola/plugins/task/pages.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 7308d55..86c85ae 100644
--- a/nikola/plugins/task/posts.py
+++ b/nikola/plugins/task/posts.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 9b4db8c..b1262a0 100644
--- a/nikola/plugins/task/redirect.py
+++ b/nikola/plugins/task/redirect.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 05ceba3..e1d8d00 100644
--- a/nikola/plugins/task/robots.py
+++ b/nikola/plugins/task/robots.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 e5e8a55..f317a3f 100644
--- a/nikola/plugins/task/scale_images.py
+++ b/nikola/plugins/task/scale_images.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2014-2021 Pelle Nilsson and others.
+# Copyright © 2014-2022 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 17a180f..f99f2de 100644
--- a/nikola/plugins/task/sitemap.py
+++ b/nikola/plugins/task/sitemap.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 8d2a9d1..107c8fb 100644
--- a/nikola/plugins/task/sources.py
+++ b/nikola/plugins/task/sources.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 cc2ced8..4b0cd8c 100644
--- a/nikola/plugins/task/tags.py
+++ b/nikola/plugins/task/tags.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 dee2550..719cf46 100644
--- a/nikola/plugins/task/taxonomies.py
+++ b/nikola/plugins/task/taxonomies.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 5554e53..66f98f7 100644
--- a/nikola/plugins/template/__init__.py
+++ b/nikola/plugins/template/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 aec6063..8aa32aa 100644
--- a/nikola/plugins/template/jinja.py
+++ b/nikola/plugins/template/jinja.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 8197518..5dc9fe5 100644
--- a/nikola/plugins/template/mako.py
+++ b/nikola/plugins/template/mako.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 06de222..42df0eb 100644
--- a/nikola/post.py
+++ b/nikola/post.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -324,6 +324,7 @@ class Post(object):
for lang in self.translations:
if self.meta[lang].get('data') is not None:
self.data[lang] = utils.load_data(self.meta[lang]['data'])
+ self.register_depfile(self.meta[lang]['data'], lang=lang)
def _load_translated_metadata(self, default_metadata):
"""Load metadata from all translation sources."""
diff --git a/nikola/shortcodes.py b/nikola/shortcodes.py
index 797c1ea..cccea2d 100644
--- a/nikola/shortcodes.py
+++ b/nikola/shortcodes.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 03f6280..a054d69 100644
--- a/nikola/state.py
+++ b/nikola/state.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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 363ab40..7157afb 100644
--- a/nikola/utils.py
+++ b/nikola/utils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -62,6 +62,7 @@ from doit import tools
from doit.cmdparse import CmdParse
from pkg_resources import resource_filename
from nikola.packages.pygments_better_html import BetterHtmlFormatter
+from typing import List
from unidecode import unidecode
# Renames
@@ -727,7 +728,7 @@ def load_messages(themes, translations, default_lang, themes_dirs):
for k, v in translation.MESSAGES.items():
if v:
messages[lang][k] = v
- del(translation)
+ del translation
except ImportError as orig:
last_exception = orig
del(english)
@@ -1689,7 +1690,7 @@ class NikolaPygmentsHTML(BetterHtmlFormatter):
kwargs['nowrap'] = False
super().__init__(**kwargs)
- def wrap(self, source, outfile):
+ def wrap(self, source, *args):
"""Wrap the ``source``, which is a generator yielding individual lines, in custom generators."""
style = []
if self.prestyles:
@@ -1707,6 +1708,18 @@ class NikolaPygmentsHTML(BetterHtmlFormatter):
# For consistency, override the default formatter.
pygments.formatters._formatter_cache['HTML'] = NikolaPygmentsHTML
+pygments.formatters._formatter_cache['html'] = NikolaPygmentsHTML
+_original_find_formatter_class = pygments.formatters.find_formatter_class
+
+
+def nikola_find_formatter_class(alias):
+ """Nikola-specific version of find_formatter_class."""
+ if "html" in alias.lower():
+ return NikolaPygmentsHTML
+ return _original_find_formatter_class(alias)
+
+
+pygments.formatters.find_formatter_class = nikola_find_formatter_class
def get_displayed_page_number(i, num_pages, site):
@@ -2007,6 +2020,33 @@ def map_metadata(meta, key, config):
meta[meta_key] = hook(meta[meta_key])
+def parselinenos(spec: str, total: int) -> List[int]:
+ """Parse a line number spec.
+
+ Example: "1,2,4-6" -> [0, 1, 3, 4, 5]
+ """
+ items = list()
+ parts = spec.split(',')
+ for part in parts:
+ try:
+ begend = part.strip().split('-')
+ if ['', ''] == begend:
+ raise ValueError
+ elif len(begend) == 1:
+ items.append(int(begend[0]) - 1)
+ elif len(begend) == 2:
+ start = int(begend[0] or 1) # left half open (cf. -10)
+ end = int(begend[1] or max(start, total)) # right half open (cf. 10-)
+ if start > end: # invalid range (cf. 10-1)
+ raise ValueError
+ items.extend(range(start - 1, end))
+ else:
+ raise ValueError
+ except Exception as exc:
+ raise ValueError('invalid line number spec: %r' % spec) from exc
+ return items
+
+
class ClassificationTranslationManager(object):
"""Keeps track of which classifications could be translated as which others.
diff --git a/nikola/winutils.py b/nikola/winutils.py
index 0a06c44..b5b8ffa 100644
--- a/nikola/winutils.py
+++ b/nikola/winutils.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2021 Roberto Alsina and others.
+# Copyright © 2012-2022 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/scripts/debug_rebuilds/README.md b/scripts/debug_rebuilds/README.md
index 58e89db..58b1219 100644
--- a/scripts/debug_rebuilds/README.md
+++ b/scripts/debug_rebuilds/README.md
@@ -6,6 +6,6 @@ To debug unexpected Nikola rebuilds:
4. Run `python step2_analyze_py_files.py | tee analysis.txt`. It will compare the two .py files, using `cc_debug.sqlite3` and `{first,second}_dump.py`.
5. Compare the produced dictionaries. Note that you will probably need a character-level diff tool, <https://prettydiff.com/> is pretty good as long as you change CSS for `li.replace` to `word-break: break-all; white-space: pre-wrap;`
-Copyright © 2019-2021, Chris Warrick.
+Copyright © 2019-2022, Chris Warrick.
Portions Copyright © Eduardo Nafuel Schettino and Doit Contributors.
License of .py files is MIT (same as Nikola)
diff --git a/scripts/release b/scripts/release
index 852fa30..b50d06f 100755
--- a/scripts/release
+++ b/scripts/release
@@ -1,7 +1,7 @@
#!/usr/bin/env zsh
# The Release Script
# Based on Python Project Template by Chris Warrick
-# Copyright © 2013-2021, Chris Warrick.
+# Copyright © 2013-2022, Chris Warrick.
# All rights reserved.
# Permission is hereby granted, free of charge, to any
diff --git a/setup.py b/setup.py
index bcdc32c..4558f8d 100755
--- a/setup.py
+++ b/setup.py
@@ -24,8 +24,8 @@ with open('requirements-tests.txt', 'r') as fh:
# ########## platform specific stuff #############
if sys.version_info[0] == 2:
raise Exception('Python 2 is not supported')
-elif sys.version_info[0] == 3 and sys.version_info[1] < 5:
- raise Exception('Python 3 version < 3.5 is not supported')
+elif sys.version_info[0] == 3 and sys.version_info[1] < 7:
+ raise Exception('Python 3 version < 3.7 is not supported')
##################################################
@@ -106,7 +106,7 @@ class nikola_build_py(build_py):
setup(name='Nikola',
- version='8.2.0',
+ version='8.2.3',
description='A modular, fast, simple, static website and blog generator',
long_description=long_description,
author='Roberto Alsina and others',
@@ -128,17 +128,17 @@ setup(name='Nikola',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'Topic :: Internet',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Text Processing :: Markup'],
install_requires=dependencies,
extras_require=extras,
include_package_data=True,
- python_requires='>=3.5',
+ python_requires='>=3.7',
cmdclass={'install': nikola_install, 'build_py': nikola_build_py},
data_files=[
('share/doc/nikola', [
diff --git a/snapcraft.yaml b/snapcraft.yaml
index 5882d1a..b131cf5 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,5 +1,5 @@
name: nikola
-version: 8.2.0
+version: 8.2.3
summary: A static website generator
description: A static website generator
confinement: strict
diff --git a/tests/test_compile_markdown.py b/tests/test_compile_markdown.py
index 0e805ba..a902347 100644
--- a/tests/test_compile_markdown.py
+++ b/tests/test_compile_markdown.py
@@ -28,12 +28,10 @@ from .helper import FakeSite
from this
""",
"""\
-<table class="codehilitetable"><tr><td class="linenos">\
-<div class="linenodiv"><pre><span class="normal">1</span></pre></div>\
-</td><td class="code"><pre class="code literal-block"><span></span>\
-<code><span class="kn">from</span> <span class="nn">this</span>
-</code></pre>
-</td></tr></table>
+<div class="code"><table class="codetable"><tr><td class="linenos linenodiv">\
+<a href="#-1"><code data-line-number="1"></code></a></td>\
+<td class="code"><code><span class="kn">from</span> <span class="nn">this</span>
+</code></td></tr></table></div>
""",
id="hilite",
),
diff --git a/tests/test_rst_compiler.py b/tests/test_rst_compiler.py
index 803fd79..88638f7 100644
--- a/tests/test_rst_compiler.py
+++ b/tests/test_rst_compiler.py
@@ -87,6 +87,29 @@ def test_youtube_iframe():
)
+def test_youtube_iframe_start_at():
+ """Test Youtube iframe tag generation with start_at attribute"""
+
+ sample = ".. youtube:: YID\n :height: 400\n :width: 600\n :start_at: 60"
+ html = get_html_from_rst(sample)
+ assert_html_contains(
+ html,
+ "iframe",
+ attributes={
+ "src": (
+ "https://www.youtube-nocookie.com"
+ "/embed/YID?rel=0&"
+ "wmode=transparent&start=60"
+ ),
+ "height": "400",
+ "width": "600",
+ "frameborder": "0",
+ "allowfullscreen": "",
+ "allow": "encrypted-media",
+ },
+ )
+
+
def test_vimeo(disable_vimeo_api_query):
"""Test Vimeo iframe tag generation"""
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 1996679..764eec2 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -14,13 +14,16 @@ from nikola.post import get_meta
from nikola.utils import (
TemplateHookRegistry,
TranslatableSetting,
+ NikolaPygmentsHTML,
demote_headers,
get_asset_path,
get_crumbs,
get_theme_chain,
get_translation_candidate,
+ nikola_find_formatter_class,
write_metadata,
bool_from_meta,
+ parselinenos
)
@@ -619,3 +622,26 @@ class FakePost:
def __init__(self):
metadata_extractors.load_defaults(self, self.metadata_extractors_by)
+
+
+def test_parselinenos():
+ assert parselinenos('1,2,3', 10) == [0, 1, 2]
+ assert parselinenos('4, 5, 6', 10) == [3, 4, 5]
+ assert parselinenos('-4', 10) == [0, 1, 2, 3]
+ assert parselinenos('7-9', 10) == [6, 7, 8]
+ assert parselinenos('7-', 10) == [6, 7, 8, 9]
+ assert parselinenos('1,7-', 10) == [0, 6, 7, 8, 9]
+ assert parselinenos('7-7', 10) == [6]
+ assert parselinenos('11-', 10) == [10]
+ with pytest.raises(ValueError):
+ parselinenos('1-2-3', 10)
+ with pytest.raises(ValueError):
+ parselinenos('abc-def', 10)
+ with pytest.raises(ValueError):
+ parselinenos('-', 10)
+ with pytest.raises(ValueError):
+ parselinenos('3-1', 10)
+
+
+def test_nikola_find_formatter_class_returns_pygments_class():
+ assert NikolaPygmentsHTML == nikola_find_formatter_class("html")