diff options
Diffstat (limited to 'nikola/plugins/compile/rest')
| -rw-r--r-- | nikola/plugins/compile/rest/__init__.py | 114 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/chart.py | 2 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/doc.py | 2 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/gist.py | 20 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/listing.py | 112 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/media.py | 2 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/post_list.py | 20 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/slides.py | 2 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/thumbnail.plugin | 9 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/thumbnail.py | 69 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/vimeo.py | 12 | ||||
| -rw-r--r-- | nikola/plugins/compile/rest/youtube.py | 2 |
12 files changed, 263 insertions, 103 deletions
diff --git a/nikola/plugins/compile/rest/__init__.py b/nikola/plugins/compile/rest/__init__.py index 98c7151..d446fe8 100644 --- a/nikola/plugins/compile/rest/__init__.py +++ b/nikola/plugins/compile/rest/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -27,66 +27,78 @@ from __future__ import unicode_literals import io import os -import re - -try: - import docutils.core - import docutils.nodes - import docutils.utils - import docutils.io - import docutils.readers.standalone - import docutils.writers.html4css1 - has_docutils = True -except ImportError: - has_docutils = False + +import docutils.core +import docutils.nodes +import docutils.utils +import docutils.io +import docutils.readers.standalone +import docutils.writers.html4css1 from nikola.plugin_categories import PageCompiler -from nikola.utils import get_logger, makedirs, req_missing, write_metadata +from nikola.utils import unicode_str, get_logger, makedirs, write_metadata class CompileRest(PageCompiler): - """Compile reSt into HTML.""" + """Compile reStructuredText into HTML.""" name = "rest" + friendly_name = "reStructuredText" demote_headers = True logger = None - def compile_html(self, source, dest, is_two_file=True): - """Compile reSt into HTML.""" + def _read_extra_deps(self, post): + """Reads contents of .dep file and returns them as a list""" + dep_path = post.base_path + '.dep' + if os.path.isfile(dep_path): + with io.open(dep_path, 'r+', encoding='utf8') as depf: + deps = [l.strip() for l in depf.readlines()] + return deps + return [] + + def register_extra_dependencies(self, post): + """Adds dependency to post object to check .dep file.""" + post.add_dependency(lambda: self._read_extra_deps(post), 'fragment') + + def compile_html_string(self, data, source_path=None, is_two_file=True): + """Compile reSt into HTML strings.""" + # If errors occur, this will be added to the line number reported by + # docutils so the line number matches the actual line number (off by + # 7 with default metadata, could be more or less depending on the post). + add_ln = 0 + if not is_two_file: + m_data, data = self.split_metadata(data) + add_ln = len(m_data.splitlines()) + 1 + + default_template_path = os.path.join(os.path.dirname(__file__), 'template.txt') + output, error_level, deps = rst2html( + data, settings_overrides={ + 'initial_header_level': 1, + 'record_dependencies': True, + 'stylesheet_path': None, + 'link_stylesheet': True, + 'syntax_highlight': 'short', + 'math_output': 'mathjax', + 'template': default_template_path, + }, logger=self.logger, source_path=source_path, l_add_ln=add_ln, transforms=self.site.rst_transforms) + if not isinstance(output, unicode_str): + # To prevent some weird bugs here or there. + # Original issue: empty files. `output` became a bytestring. + output = output.decode('utf-8') + return output, error_level, deps - if not has_docutils: - req_missing(['docutils'], 'build this site (compile reStructuredText)') + def compile_html(self, source, dest, is_two_file=True): + """Compile reSt into HTML files.""" makedirs(os.path.dirname(dest)) error_level = 100 with io.open(dest, "w+", encoding="utf8") as out_file: with io.open(source, "r", encoding="utf8") as in_file: data = in_file.read() - add_ln = 0 - if not is_two_file: - spl = re.split('(\n\n|\r\n\r\n)', data, maxsplit=1) - data = spl[-1] - if len(spl) != 1: - # If errors occur, this will be added to the line - # number reported by docutils so the line number - # matches the actual line number (off by 7 with default - # metadata, could be more or less depending on the post - # author). - add_ln = len(spl[0].splitlines()) + 1 - - default_template_path = os.path.join(os.path.dirname(__file__), 'template.txt') - output, error_level, deps = rst2html( - data, settings_overrides={ - 'initial_header_level': 1, - 'record_dependencies': True, - 'stylesheet_path': None, - 'link_stylesheet': True, - 'syntax_highlight': 'short', - 'math_output': 'mathjax', - 'template': default_template_path, - }, logger=self.logger, source_path=source, l_add_ln=add_ln) + output, error_level, deps = self.compile_html_string(data, source, is_two_file) out_file.write(output) deps_path = dest + '.dep' if deps.list: + deps.list = [p for p in deps.list if p != dest] # Don't depend on yourself (#1671) with io.open(deps_path, "w+", encoding="utf8") as deps_file: deps_file.write('\n'.join(deps.list)) else: @@ -111,15 +123,18 @@ class CompileRest(PageCompiler): with io.open(path, "w+", encoding="utf8") as fd: if onefile: fd.write(write_metadata(metadata)) - fd.write('\n' + content) + fd.write('\n') + fd.write(content) def set_site(self, site): + self.config_dependencies = [] for plugin_info in site.plugin_manager.getPluginsOfCategory("RestExtension"): if plugin_info.name in site.config['DISABLED_PLUGINS']: site.plugin_manager.removePluginFromCategory(plugin_info, "RestExtension") continue site.plugin_manager.activatePluginByName(plugin_info.name) + self.config_dependencies.append(plugin_info.name) plugin_info.plugin_object.set_site(site) plugin_info.plugin_object.short_help = plugin_info.description @@ -160,6 +175,13 @@ def get_observer(settings): class NikolaReader(docutils.readers.standalone.Reader): + def __init__(self, *args, **kwargs): + self.transforms = kwargs.pop('transforms', []) + docutils.readers.standalone.Reader.__init__(self, *args, **kwargs) + + def get_transforms(self): + return docutils.readers.standalone.Reader(self).get_transforms() + self.transforms + def new_document(self): """Create and return a new empty document tree (root node).""" document = docutils.utils.new_document(self.source.source_path, self.settings) @@ -199,7 +221,7 @@ def add_node(node, visit_function=None, depart_function=None): def depart_Math(self, node): self.body.append('</math>') - For full example, you can refer to `Microdata plugin <http://plugins.getnikola.com/#microdata>`_ + For full example, you can refer to `Microdata plugin <https://plugins.getnikola.com/#microdata>`_ """ docutils.nodes._add_node_class_names([node.__name__]) if visit_function: @@ -213,7 +235,7 @@ def rst2html(source, source_path=None, source_class=docutils.io.StringInput, parser=None, parser_name='restructuredtext', writer=None, writer_name='html', settings=None, settings_spec=None, settings_overrides=None, config_section=None, - enable_exit_status=None, logger=None, l_add_ln=0): + enable_exit_status=None, logger=None, l_add_ln=0, transforms=None): """ Set up & run a `Publisher`, and return a dictionary of document parts. Dictionary keys are the names of parts, and values are Unicode strings; @@ -231,7 +253,7 @@ def rst2html(source, source_path=None, source_class=docutils.io.StringInput, reStructuredText syntax errors. """ if reader is None: - reader = NikolaReader() + reader = NikolaReader(transforms=transforms) # For our custom logging, we have special needs and special settings we # specify here. # logger a logger from Nikola diff --git a/nikola/plugins/compile/rest/chart.py b/nikola/plugins/compile/rest/chart.py index 55ddf5c..59b9dc7 100644 --- a/nikola/plugins/compile/rest/chart.py +++ b/nikola/plugins/compile/rest/chart.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 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 6143606..703c234 100644 --- a/nikola/plugins/compile/rest/doc.py +++ b/nikola/plugins/compile/rest/doc.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 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/gist.py b/nikola/plugins/compile/rest/gist.py index 65189b5..ab4d56d 100644 --- a/nikola/plugins/compile/rest/gist.py +++ b/nikola/plugins/compile/rest/gist.py @@ -1,16 +1,11 @@ # -*- coding: utf-8 -*- # This file is public domain according to its author, Brian Hsu +import requests from docutils.parsers.rst import Directive, directives from docutils import nodes -try: - import requests -except ImportError: - requests = None # NOQA - from nikola.plugin_categories import RestExtension -from nikola.utils import req_missing class Plugin(RestExtension): @@ -64,22 +59,15 @@ class GitHubGist(Directive): if 'file' in self.options: filename = self.options['file'] - if requests is not None: - rawGist = (self.get_raw_gist_with_filename(gistID, filename)) + rawGist = (self.get_raw_gist_with_filename(gistID, filename)) embedHTML = ('<script src="https://gist.github.com/{0}.js' '?file={1}"></script>').format(gistID, filename) else: - if requests is not None: - rawGist = (self.get_raw_gist(gistID)) + rawGist = (self.get_raw_gist(gistID)) embedHTML = ('<script src="https://gist.github.com/{0}.js">' '</script>').format(gistID) - if requests is None: - reqnode = nodes.raw( - '', req_missing('requests', 'have inline gist source', - optional=True), format='html') - else: - reqnode = nodes.literal_block('', rawGist) + reqnode = nodes.literal_block('', rawGist) return [nodes.raw('', embedHTML, format='html'), nodes.raw('', '<noscript>', format='html'), diff --git a/nikola/plugins/compile/rest/listing.py b/nikola/plugins/compile/rest/listing.py index 23ec254..b8340cf 100644 --- a/nikola/plugins/compile/rest/listing.py +++ b/nikola/plugins/compile/rest/listing.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -31,43 +31,95 @@ from __future__ import unicode_literals import io import os +import uuid try: from urlparse import urlunsplit except ImportError: from urllib.parse import urlunsplit # NOQA +import docutils.parsers.rst.directives.body +import docutils.parsers.rst.directives.misc from docutils import core from docutils import nodes from docutils.parsers.rst import Directive, directives +from docutils.parsers.rst.roles import set_classes from docutils.parsers.rst.directives.misc import Include -try: - from docutils.parsers.rst.directives.body import CodeBlock -except ImportError: # docutils < 0.9 (Debian Sid For The Loss) - class CodeBlock(Directive): - required_arguments = 1 - has_content = True - option_spec = {} - CODE = '<pre>{0}</pre>' - - def run(self): - """ Required by the Directive interface. Create docutils nodes """ - return [nodes.raw('', self.CODE.format('\n'.join(self.content)), format='html')] - directives.register_directive('code', CodeBlock) +from pygments.lexers import get_lexer_by_name +import pygments +import pygments.util +from nikola import utils from nikola.plugin_categories import RestExtension -# Add sphinx compatibility option -CodeBlock.option_spec['linenos'] = directives.unchanged - -class FlexibleCodeBlock(CodeBlock): +# A sanitized version of docutils.parsers.rst.directives.body.CodeBlock. +class CodeBlock(Directive): + """Parse and mark up content of a code block.""" + optional_arguments = 1 + option_spec = {'class': directives.class_option, + 'name': directives.unchanged, + 'number-lines': directives.unchanged, # integer or None + 'linenos': directives.unchanged, + 'tab-width': directives.nonnegative_int} + has_content = True def run(self): + self.assert_has_content() + if 'linenos' in self.options: self.options['number-lines'] = self.options['linenos'] - return super(FlexibleCodeBlock, self).run() -CodeBlock = FlexibleCodeBlock + if 'tab-width' in self.options: + self.content = [x.replace('\t', ' ' * self.options['tab-width']) for x in self.content] + + if self.arguments: + language = self.arguments[0] + else: + language = 'text' + set_classes(self.options) + classes = ['code'] + if language: + classes.append(language) + if 'classes' in self.options: + classes.extend(self.options['classes']) + + code = '\n'.join(self.content) + + try: + lexer = get_lexer_by_name(language) + except pygments.util.ClassNotFound: + raise self.error('Cannot find pygments lexer for language "{0}"'.format(language)) + + if 'number-lines' in self.options: + linenos = 'table' + # optional argument `startline`, defaults to 1 + try: + linenostart = int(self.options['number-lines'] or 1) + except ValueError: + raise self.error(':number-lines: with non-integer start value') + else: + linenos = False + linenostart = 1 # actually unused + + if self.site.invariant: # for testing purposes + anchor_ref = 'rest_code_' + 'fixedvaluethatisnotauuid' + else: + anchor_ref = 'rest_code_' + uuid.uuid4().hex + + formatter = utils.NikolaPygmentsHTML(anchor_ref=anchor_ref, classes=classes, linenos=linenos, linenostart=linenostart) + out = pygments.highlight(code, lexer, formatter) + node = nodes.raw('', out, format='html') + + self.add_name(node) + # if called from "include", set the source + if 'source' in self.options: + node.attributes['source'] = self.options['source'] + + return [node] + +# Monkey-patch: replace insane docutils CodeBlock with our implementation. +docutils.parsers.rst.directives.body.CodeBlock = CodeBlock +docutils.parsers.rst.directives.misc.CodeBlock = CodeBlock class Plugin(RestExtension): @@ -79,11 +131,15 @@ class Plugin(RestExtension): # Even though listings don't use CodeBlock anymore, I am # leaving these to make the code directive work with # docutils < 0.9 + CodeBlock.site = site + directives.register_directive('code', CodeBlock) directives.register_directive('code-block', CodeBlock) directives.register_directive('sourcecode', CodeBlock) directives.register_directive('listing', Listing) + Listing.folders = site.config['LISTINGS_FOLDERS'] return super(Plugin, self).set_site(site) + # Add sphinx compatibility option listing_spec = Include.option_spec listing_spec['linenos'] = directives.unchanged @@ -104,9 +160,17 @@ class Listing(Include): option_spec = listing_spec def run(self): - fname = self.arguments.pop(0) + _fname = self.arguments.pop(0) + fname = _fname.replace('/', os.sep) lang = self.arguments.pop(0) - fpath = os.path.join('listings', fname) + if len(self.folders) == 1: + listings_folder = next(iter(self.folders.keys())) + if fname.startswith(listings_folder): + fpath = os.path.join(fname) # new syntax: specify folder name + else: + fpath = os.path.join(listings_folder, fname) # old syntax: don't specify folder name + else: + fpath = os.path.join(fname) # must be new syntax: specify folder name self.arguments.insert(0, fpath) self.options['code'] = lang if 'linenos' in self.options: @@ -114,9 +178,9 @@ class Listing(Include): with io.open(fpath, 'r+', encoding='utf8') as fileobject: self.content = fileobject.read().splitlines() self.state.document.settings.record_dependencies.add(fpath) - target = urlunsplit(("link", 'listing', fname, '', '')) + target = urlunsplit(("link", 'listing', fpath.replace('\\', '/'), '', '')) generated_nodes = ( - [core.publish_doctree('`{0} <{1}>`_'.format(fname, target))[0]]) + [core.publish_doctree('`{0} <{1}>`_'.format(_fname, target))[0]]) generated_nodes += self.get_code_from_file(fileobject) return generated_nodes diff --git a/nikola/plugins/compile/rest/media.py b/nikola/plugins/compile/rest/media.py index ccda559..0363d28 100644 --- a/nikola/plugins/compile/rest/media.py +++ b/nikola/plugins/compile/rest/media.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 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 f719e31..ddbd82d 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-2014 Udo Spallek, Roberto Alsina and others. +# Copyright © 2013-2015 Udo Spallek, Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -25,7 +25,9 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. from __future__ import unicode_literals +import os import uuid +import natsort from docutils import nodes from docutils.parsers.rst import Directive, directives @@ -52,7 +54,7 @@ class PostList(Directive): Post List ========= :Directive Arguments: None. - :Directive Options: lang, start, stop, reverse, tags, template, id + :Directive Options: lang, start, stop, reverse, sort, tags, template, id :Directive Content: None. Provides a reStructuredText directive to create a list of posts. @@ -77,6 +79,10 @@ class PostList(Directive): Reverse the order of the post-list. Defaults is to not reverse the order of posts. + ``sort``: string + Sort post list by one of each post's attributes, usually ``title`` or a + custom ``priority``. Defaults to None (chronological sorting). + ``tags`` : string [, string...] Filter posts to show only posts having at least one of the ``tags``. Defaults to None. @@ -105,6 +111,7 @@ class PostList(Directive): 'start': int, 'stop': int, 'reverse': directives.flag, + 'sort': directives.unchanged, 'tags': directives.unchanged, 'slugs': directives.unchanged, 'all': directives.flag, @@ -124,6 +131,7 @@ class PostList(Directive): show_all = self.options.get('all', False) lang = self.options.get('lang', utils.LocaleBorg().current_lang) template = self.options.get('template', 'post_list_directive.tmpl') + sort = self.options.get('sort') if self.site.invariant: # for testing purposes post_list_id = self.options.get('id', 'post_list_' + 'fixedvaluethatisnotauuid') else: @@ -150,6 +158,9 @@ class PostList(Directive): filtered_timeline.append(post) + if sort: + filtered_timeline = natsort.natsorted(filtered_timeline, key=lambda post: post.meta[lang][sort], alg=natsort.ns.F | natsort.ns.IC) + for post in filtered_timeline[start:stop:step]: if slugs: cont = True @@ -160,10 +171,15 @@ class PostList(Directive): if cont: continue + bp = post.translated_base_path(lang) + if os.path.exists(bp): + self.state.document.settings.record_dependencies.add(bp) + posts += [post] if not posts: return [] + self.state.document.settings.record_dependencies.add("####MAGIC####TIMELINE") template_data = { 'lang': lang, diff --git a/nikola/plugins/compile/rest/slides.py b/nikola/plugins/compile/rest/slides.py index ea8e413..7826f6a 100644 --- a/nikola/plugins/compile/rest/slides.py +++ b/nikola/plugins/compile/rest/slides.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 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.plugin b/nikola/plugins/compile/rest/thumbnail.plugin new file mode 100644 index 0000000..3b73340 --- /dev/null +++ b/nikola/plugins/compile/rest/thumbnail.plugin @@ -0,0 +1,9 @@ +[Core] +Name = rest_thumbnail +Module = thumbnail + +[Documentation] +Author = Pelle Nilsson +Version = 0.1 +Website = http://getnikola.com +Description = reST directive to facilitate enlargeable images with thumbnails diff --git a/nikola/plugins/compile/rest/thumbnail.py b/nikola/plugins/compile/rest/thumbnail.py new file mode 100644 index 0000000..5388d8d --- /dev/null +++ b/nikola/plugins/compile/rest/thumbnail.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +# Copyright © 2014-2015 Pelle Nilsson and others. + +# Permission is hereby granted, free of charge, to any +# person obtaining a copy of this software and associated +# documentation files (the "Software"), to deal in the +# Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the +# Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice +# shall be included in all copies or substantial portions of +# the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +import os + +from docutils.parsers.rst import directives +from docutils.parsers.rst.directives.images import Image, Figure + +from nikola.plugin_categories import RestExtension + + +class Plugin(RestExtension): + + name = "rest_thumbnail" + + def set_site(self, site): + self.site = site + directives.register_directive('thumbnail', Thumbnail) + return super(Plugin, self).set_site(site) + + +class Thumbnail(Figure): + + def align(argument): + return directives.choice(argument, Image.align_values) + + def figwidth_value(argument): + if argument.lower() == 'image': + return 'image' + else: + return directives.length_or_percentage_or_unitless(argument, 'px') + + option_spec = Image.option_spec.copy() + option_spec['figwidth'] = figwidth_value + option_spec['figclass'] = directives.class_option + has_content = True + + def run(self): + uri = directives.uri(self.arguments[0]) + self.options['target'] = uri + self.arguments[0] = '.thumbnail'.join(os.path.splitext(uri)) + if self.content: + (node,) = Figure.run(self) + else: + (node,) = Image.run(self) + return [node] diff --git a/nikola/plugins/compile/rest/vimeo.py b/nikola/plugins/compile/rest/vimeo.py index 4b34dfe..bc44b0e 100644 --- a/nikola/plugins/compile/rest/vimeo.py +++ b/nikola/plugins/compile/rest/vimeo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated @@ -28,15 +28,11 @@ from docutils import nodes from docutils.parsers.rst import Directive, directives -try: - import requests -except ImportError: - requests = None # NOQA +import requests import json from nikola.plugin_categories import RestExtension -from nikola.utils import req_missing class Plugin(RestExtension): @@ -94,10 +90,6 @@ class Vimeo(Directive): return [nodes.raw('', CODE.format(**options), format='html')] def check_modules(self): - msg = None - if requests is None: - msg = req_missing(['requests'], 'use the vimeo directive', optional=True) - return [nodes.raw('', '<div class="text-error">{0}</div>'.format(msg), format='html')] return None def set_video_size(self): diff --git a/nikola/plugins/compile/rest/youtube.py b/nikola/plugins/compile/rest/youtube.py index b32e77a..7c6bba1 100644 --- a/nikola/plugins/compile/rest/youtube.py +++ b/nikola/plugins/compile/rest/youtube.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright © 2012-2014 Roberto Alsina and others. +# Copyright © 2012-2015 Roberto Alsina and others. # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and associated |
