list is Multi now which enables us to implement item access
[tiramisu.git] / report / build / rst2html.py
1 #!/usr/bin/python
2 # unproudly borrowed from David Goodger's rst2html.py
3
4 """ A minimal front end to the Docutils Publisher, producing HTML with a 
5 `config` role 
6 """
7
8 try:
9     import locale
10     locale.setlocale(locale.LC_ALL, '')
11 except:
12     pass
13
14 from docutils.core import publish_cmdline, default_description
15 # ____________________________________________________________
16 from docutils import nodes, utils
17 from docutils.parsers.rst import roles
18
19 # ____________________________________________________________
20 #register a :config: ReST link role for use in documentation    
21 def config_reference_role(role, rawtext, text, lineno, inliner,
22                     options={}, content=[]):
23     basename = text
24     refuri = "report/build" + basename + '.html'
25     roles.set_classes(options)
26     node = nodes.reference(rawtext, utils.unescape(text), refuri=refuri,
27                         **options)
28     return [node], []
29
30 roles.register_local_role('config', config_reference_role)
31 # ____________________________________________________________
32
33
34 description = ('Generates (X)HTML documents from standalone reStructuredText '
35                'sources.  ' + default_description)
36
37 publish_cmdline(writer_name='html', description=description)
38