2 # -*- coding: utf-8 -*-
4 # rst — xml-rpc-based ikiwiki plugin to process RST files
6 # based a little bit on rst.pm by Sergio Talens-Oliag, but only a little bit. :)
8 # Copyright © martin f. krafft <madduck@madduck.net>
9 # Released under the terms of the GNU GPL version 2
12 __description__ = 'xml-rpc-based ikiwiki plugin to process RST files'
14 __author__ = 'martin f. krafft <madduck@madduck.net>'
15 __copyright__ = 'Copyright © ' + __author__
18 from docutils.core import publish_parts;
19 from proxy import IkiWikiProcedureProxy
21 def rst2html(proxy, *args):
22 kwargs = _to_dict(args)
23 parts = publish_parts(kwargs["content"],
25 settings_overrides = { 'halt_level': 6
26 , 'file_insertion_enabled': 0
29 return '\n'.join(parts['html_body'].splitlines()[1:-1])
32 # args is a list paired by key, value, so we turn it into a dict
33 return dict((k, v) for k, v in zip(*[iter(args)]*2))
35 def getsetup(proxy, *kwargs):
36 return 'plugin', { 'safe' : 1, 'rebuild' : 1, 'section' : 'format' }
40 sys.stderr.write(__name__ + ':DEBUG:%s\n' % s)
43 proxy = IkiWikiProcedureProxy(__name__, debug_fn=None)
44 proxy.hook('getsetup', getsetup)
45 proxy.hook('htmlize', rst2html)