Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install rst2html5

How to install rst2html5

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install rst2html5
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.9
1.0Never BuiltWhy not?
0.9 Available View build log
Linux (64-bit)
1.0 Available View build log
0.9 Available View build log
1.0 Available View build log
 
License
MIT License
Depended by
Imports
Lastest release
version 1.0 on Sep 20th, 2013

rst2html5 generates (X)HTML5 documents from standalone reStructuredText sources. It is a complete rewrite of the docutils' rst2html and uses new HTML5 constructs as <section> and <aside>.

Usage

System Message: ERROR/3 (<string>, line 12)

Unknown directive type "code-block".

.. code-block:: bash

        $ rst2html5 [options] SOURCE

Options:

--no-indent Don't indent output
--stylesheet=<URL or path>
 Specify a stylesheet URL to be included. (This option can be used multiple times)
--script=<URL or path>
 Specify a script URL to be included. (This option can be used multiple times)
--script-defer=<URL or path>
 Specify a script URL with a defer attribute to be included in the output HTML file. (This option can be used multiple times)
--script-async=<URL or path>
 Specify a script URL with a async attribute to be included in the output HTML file. (This option can be used multiple times)
--html-tag-attr=<attribute>
 Specify a html tag attribute. (This option can be used multiple times)

Examples

Consider the following rst snippet:

System Message: ERROR/3 (<string>, line 42)

Unknown directive type "code-block".

.. code-block:: rst

    Title
    =====

    Some text and a target to `Title 2`_. **strong emphasis**:

    * item 1
    * item 2

    Title 2
    =======

    .. parsed-literal::

        Inline markup is supported, e.g. *emphasis*, **strong**, ``literal
        text``,
        _`hyperlink targets`, and `references <http://www.python.org/>`_


The html5 produced is clean and tidy:

System Message: ERROR/3 (<string>, line 64)

Unknown directive type "code-block".

.. code-block:: html

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
    </head>
    <body>
        <a id="title"></a>
        <section>
            <h1>Title</h1>
            <p>Some text and a target to <a href="#title-2">Title 2</a>. <strong>strong emphasis</strong>:</p>
            <ul>
                <li>item 1</li>
                <li>item 2</li>
            </ul>
        </section>
        <a id="title-2"></a>
        <section>
            <h1>Title 2</h1>
            <pre>Inline markup is supported, e.g. <em>emphasis</em>, <strong>strong</strong>, <code>literal
    text</code>,
    <a id="hyperlink-targets">hyperlink targets</a>, and <a href="http://www.python.org/">references</a></pre>
        </section>
    </body>
    </html>

No stylesheets or classes are spread over the html5 by default. However:

  1. Stylesheets and javascritps URLs or paths can be included through stylesheet and script options.

    $ rst2html5 example.rst \
    --stylesheet css/default.css \
    --stylesheet css/special.css \
    --script https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
    

    System Message: ERROR/3 (<string>, line 103)

    Unknown directive type "code-block".

    .. code-block:: html
    
        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8" />
            <link href="css/default.css" rel="stylesheet" />
            <link href="css/special.css" rel="stylesheet" />
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        ...
    
    
    
  2. Script attributes defer and async:

    $ rst2html5 example.rst \
    --script js/test1.js \
    --script-defer js/test2.js \
    --script-async js/test3.js
    

    System Message: ERROR/3 (<string>, line 124)

    Unknown directive type "code-block".

    .. code-block:: html
    
        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8" />
            <script src="js/test1.js"></script>
            <script src="js/test2.js" defer="defer"></script>
            <script src="js/test3.js" async="async"></script>
        ...
    
    
    
  3. Html tag attributes can be included through html-tag-attr option:

    $ rst2html5 --html-tag-attr 'lang="pt-BR"' example.rst
    

    System Message: ERROR/3 (<string>, line 142)

    Unknown directive type "code-block".

    .. code-block:: html
    
        <!DOCTYPE html>
        <html lang="pt-BR">
        ...
    
    
    
    
  4. Classes can be explicitly associated to rst elements (see ref):

    System Message: ERROR/3 (<string>, line 152)

    Unknown directive type "code-block".

    .. code-block:: rst
    
         .. class:: special
    
         This is a "special" paragraph.
    
         .. class:: exceptional remarkable
    
         An Exceptional Section
         ======================
    
         This is an ordinary paragraph.
    
    

    which results in:

    <p class="special">This is a "special" paragraph.</p>
    <a id="an-exceptional-section"></a>
    <section class="exceptional remarkable">
        <h1>An Exceptional Section</h1>
        <p>This is an ordinary paragraph.</p>
    </section>
    

Installation

System Message: ERROR/3 (<string>, line 179)

Unknown directive type "code-block".

.. code-block:: bash

    $ pip install rst2html5


Subscribe to package updates

Last updated Sep 20th, 2013

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.