chiark / gitweb /
m.images: properly support the image :target: option.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Sep 2017 15:17:57 +0000 (17:17 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 14 Sep 2017 22:11:11 +0000 (00:11 +0200)
pelican-plugins/m/images.py

index cd363ab42d701ebf0d8a80b64bce6f40e7b1ddc5..fe9d1c2837ceb101daeb3ad542ea8186767867e0 100644 (file)
@@ -1,7 +1,7 @@
 import os
 from docutils.parsers import rst
 from docutils.parsers.rst import Directive
-from docutils.parsers.rst import directives
+from docutils.parsers.rst import directives, states
 from docutils.nodes import fully_normalize_name, whitespace_normalize_name
 from docutils.parsers.rst.roles import set_classes
 from docutils import nodes
@@ -25,8 +25,11 @@ def configure(pelicanobj):
 class Image(Directive):
     """Image directive
 
-    Copy of docutils.parsers.rst.directives.Image with some default classes
-    added on top.
+    Copy of docutils.parsers.rst.directives.Image with:
+
+    -   the align, scale, width, height options removed (handled better by
+        m.css)
+    -   .m-image CSS class added
     """
 
     required_arguments = 1
@@ -34,7 +37,8 @@ class Image(Directive):
     final_argument_whitespace = True
     option_spec = {'alt': directives.unchanged,
                    'name': directives.unchanged,
-                   'class': directives.class_option}
+                   'class': directives.class_option,
+                   'target': directives.unchanged_required}
 
     def run(self):
         messages = []