From c522ce7fbcb37a8ca141c6b2604ba85bfef00125 Mon Sep 17 00:00:00 2001 From: Skami18 Date: Sun, 30 Oct 2011 14:14:10 +0100 Subject: [PATCH] New plugin that provides an ..html:: directive for reStructuredText --- pelican/plugins/html_rst_directive.py | 63 +++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pelican/plugins/html_rst_directive.py diff --git a/pelican/plugins/html_rst_directive.py b/pelican/plugins/html_rst_directive.py new file mode 100644 index 00000000..d14000a0 --- /dev/null +++ b/pelican/plugins/html_rst_directive.py @@ -0,0 +1,63 @@ +from docutils import nodes +from docutils.parsers.rst import directives, Directive +from pelican import log + +""" +HTML tags for reStructuredText +============================== + +Directives +---------- + +.. html:: + + (HTML code) + + +Example +------- + +A search engine: + +.. html:: +
+ + + +
+ + +A contact form: + +.. html:: + +
+

+ +
+ +
+ +

+
+ +""" + + +class RawHtml(Directive): + required_arguments = 0 + optional_arguments = 0 + final_argument_whitespace = True + has_content = True + + def run(self): + html = u' '.join(self.content) + node = nodes.raw('', html, format='html') + return [node] + + + +def register(): + directives.register_directive('html', RawHtml) +