diff options
| author | 2022-08-05 01:00:19 -0400 | |
|---|---|---|
| committer | 2022-08-05 01:00:19 -0400 | |
| commit | 393aa58f2c5afd51f92fd9bd4b6dfd0dc90cea41 (patch) | |
| tree | a61de275324558358abc0c85f85827649a159512 /nikola/plugins | |
| parent | 942e313727d1ad886a1024c24fe4a9e8e2e0bb3e (diff) | |
New upstream version 8.2.3.upstream/8.2.3
Diffstat (limited to 'nikola/plugins')
70 files changed, 137 insertions, 84 deletions
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 |
