2 # -*- coding: utf-8 -*-
4 # rst — xml-rpc-based ikiwiki plugin to process RST files
6 # TODO: the top of this file should be converted to a python library for
9 # based a little bit on rst.pm by Sergio Talens-Oliag, but only a little bit. :)
11 # Copyright © martin f. krafft <madduck@madduck.net>
12 # Released under the terms of the GNU GPL version 2
15 __description__ = 'xml-rpc-based ikiwiki plugin to process RST files'
17 __author__ = 'martin f. krafft <madduck@madduck.net>'
18 __copyright__ = 'Copyright © ' + __author__
21 from docutils.core import publish_parts;
22 from proxy import IkiWikiProcedureProxy
24 def rst2html(*kwargs):
25 # FIXME arguments should be treated as a hash, the order could change
26 # at any time and break this.
27 parts = publish_parts(kwargs[3], writer_name='html',
28 settings_overrides = { 'halt_level': 6
29 , 'file_insertion_enabled': 0
32 return '\n'.join(parts['html_body'].splitlines()[1:-1])
36 sys.stderr.write(__name__ + ':DEBUG:%s' % s)
39 proxy = IkiWikiProcedureProxy(__name__, debug_fn=None)
40 proxy.register_hook('htmlize', rst2html)