summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-10-15 16:33:02 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-10-15 16:33:02 +0000
commit65dca9f89d82cc512f1c10ac8cf70696243e650a (patch)
tree53e0c9e87da2fcd86f23a557ac2132c92b700bb6 /IkiWiki/Plugin
parent68c77ef01fff197c65678f6f23a12cea66f635db (diff)
* Rewritten rst plugin by madduck is a python program that communicates with
ikiwiki via XML RPC. This should be much faster than the old plugin that had to fork python for every rst page render. Note that if you use the rst plugin, you now need to have the RPC::XML perl module installed.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/rst.pm69
1 files changed, 0 insertions, 69 deletions
diff --git a/IkiWiki/Plugin/rst.pm b/IkiWiki/Plugin/rst.pm
deleted file mode 100644
index 30f5d16d8..000000000
--- a/IkiWiki/Plugin/rst.pm
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/perl
-# Very simple reStructuredText processor.
-#
-# This plugin calls python and requires python-docutils to transform the text
-# into html.
-#
-# Its main problem is that it does not support ikiwiki's WikiLinks nor
-# Preprocessor Directives.
-#
-# 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 <sto@debian.org>
-
-package IkiWiki::Plugin::rst;
-
-use warnings;
-use strict;
-use IkiWiki 2.00;
-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': 1 }
-);
-print html[html.find('<body>')+6:html.find('</body>')].strip();
-";
-
-sub import { #{{{
- hook(type => "htmlize", id => "rst", call => \&htmlize);
-} # }}}
-
-sub htmlize (@) { #{{{
- my %params=@_;
- my $content=$params{content};
-
- my $pid;
- my $sigpipe=0;
- $SIG{PIPE}=sub { $sigpipe=1 };
- $pid=open2(*IN, *OUT, "python", "-c", $pyCmnd);
-
- # open2 doesn't respect "use open ':utf8'"
- binmode (IN, ':utf8');
- binmode (OUT, ':utf8');
-
- print OUT $content;
- close OUT;
-
- local $/ = undef;
- my $ret=<IN>;
- close IN;
- waitpid $pid, 0;
-
- return $content if $sigpipe;
- $SIG{PIPE}="DEFAULT";
-
- return $ret;
-} # }}}
-
-1