Reverted bad style.
[docutils/kirr.git] / sandbox / code-block-directive / rst2html-highlight
blob0203c857e755e8bdb8c942101f6f25bba6762a3d
1 #!/usr/bin/python
3 # rst2html-highlight
4 # ==================
5 #
6 # Docutils front-end with syntax highlight.
7 #
8 # :Author: David Goodger, a Pygments author|contributor, Guenter Milde
9 # :Date: $Date: $
10 # :Copyright: This module has been placed in the public domain.
12 # This is a merge of the docutils_ `rst2html` front end with an extension
13 # suggestion taken from the pygments_ documentation.
15 # ::
17 """
18 A front end to docutils, producing HTML with syntax colouring using pygments
20 Generates (X)HTML documents from standalone reStructuredText sources. Uses
21 `pygments` to parse and mark up the content of ``.. code-block::` directives.
22 Needs an adapted stylesheet
23 """
25 # Requirements
26 # ------------
27 # ::
29 try:
30 import locale
31 locale.setlocale(locale.LC_ALL, '')
32 except:
33 pass
35 from docutils.core import publish_cmdline, default_description
37 # The `pygments_code_block_directive`_ module defines and registers a new
38 # directive `code-block` that uses the `pygments`_ source highlighter to
39 # render code in color::
41 import pygments_code_block_directive
43 # Call the docutils publisher to render the input as html::
45 description = __doc__ + default_description
46 publish_cmdline(writer_name='html', description=description)
48 # .. _docutils: http://docutils.sf.net/
49 # .. _pygments_code_block_directive.py: pygments_code_block_directive.py
50 # .. _pygments: http://pygments.org/
51 # .. _Using Pygments in ReST documents: http://pygments.org/docs/rstdirective/