Extending rst container to output extra div attributes

Posted by Manwe on Stack Overflow See other posts from Stack Overflow or by Manwe
Published on 2014-05-23T08:37:18Z Indexed on 2014/06/12 15:25 UTC
Read the original article Hit count: 265

I'm starting to use pelican with reStructuredText rst page format. I have custom javascript (jQuery) things that I'd like to control with div attributes like data-default-tpl="basename" with nested content.

What to extend and what. I've looked at Directives and nodes, but I just can't wrap my head around how to do it.

.. rstdiv:: class1 class2 
    :name: namessid
    :extra: thisIsMyextra

    .. rstdiv:: nested class3
        :name: nestedid  
        :extra: data-default-tpl="basename"

        some text

.. container:: This is normal rst container 
    :name: contid

    text

From rst to html with pelican.

<div id="nameisid" class="class1 class2" thisIsMyextra>
<div id="nestedid" class="nested class3" data-default-tpl="basename">
some text
</div>
</div>
<div id="contid" class="container This is normal rst container">
text
</div>

© Stack Overflow or respective owner

Related posts about python

Related posts about restructuredtext