From 63edea27bc71c3bdf1837f994fb7effdd93fb2dd Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 19 Aug 2006 05:05:02 +0000 Subject: * Add first draft at a Restructured Text (rst) plugin, by Sergio Talens-Oliag. Note that this has many known issues -- see the caveats on the plugin's page. * Credit everyone who wrote a plugin on the plugins' wiki pages. --- doc/patchqueue/rst.mdwn | 66 ------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 doc/patchqueue/rst.mdwn (limited to 'doc/patchqueue') diff --git a/doc/patchqueue/rst.mdwn b/doc/patchqueue/rst.mdwn deleted file mode 100644 index c2790990e..000000000 --- a/doc/patchqueue/rst.mdwn +++ /dev/null @@ -1,66 +0,0 @@ -This is a whole lot better than nothing, but it's a shame it forks python -every page. Anyone want to get [this](http://search.cpan.org/~nodine/Text-Restructured-0.003016/) into Debian and use it instead? ---[[Joey]] - -Actually, if someone adds support for it to ikiwiki, I would be glad to get -the package into Debian myself --[[Joey]] - - #!/usr/bin/perl - # Very simple reStructuredText processor. - # - # This plugin calls python and requires python-docutils to transform the text - # into html. - # - # It's main problem is that it does not support ikiwiki's WikiLinks nor - # Preprocessor Directives (in fact the same problem applies to the current - # Wikitext processor, although in that case the output looks less worse ;) - # - # Probably Wikilinks and Preprocessor Directives should support a list of - # extensions to process (i.e. the linkify function could be transformed into - # reStructuredText instead of HTML using a hook on rst.py instead of the - # current linkify function) - # - # by Sergio Talens-Oliag - - package IkiWiki::Plugin::rst; - - use warnings; - use strict; - use IkiWiki; - use IPC::Open2; - - # Simple python script, maybe it should be implemented using an external script. - # The settings_overrides are given to avoid potential security risks when - # reading external files or if raw html is included on rst pages. - my $pyCmnd = " - from docutils.core import publish_string; - from sys import stdin; - html = publish_string(stdin.read(), writer_name='html', - settings_overrides = { 'halt_level': 6, - 'file_insertion_enabled': 0, - 'raw_enabled': 0 } - ); - print html[html.find('')+6:html.find('')].strip(); - "; - - sub import { #{{{ - IkiWiki::hook(type => "htmlize", id => "rst", call => \&htmlize); - } # }}} - - sub htmlize ($) { #{{{ - my $content = shift; - - # Try to call python and run our command - open2(*IN, *OUT, "python", "-c", "$pyCmnd") or return $content; - - # open2 doesn't respect "use open ':utf8'" - binmode (IN, ':utf8'); - binmode (OUT, ':utf8'); - - print OUT $content; - close OUT; - local $/ = undef; - return ; - } # }}} - - 1 -- cgit v1.2.3