6 # Docutils front-end with syntax highlight.
8 # :Author: David Goodger, a Pygments author|contributor, Guenter Milde
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.
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
31 locale
.setlocale(locale
.LC_ALL
, '')
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/