Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to put sections inside container in reStructuredText?

I would like to write a 2-column website (html) with reStructuredText and rst2html5.

I have tried like this

.. container:: right

   Right text

.. container:: left

   Left text

and it works well (with css "float").

However, rst2html5 could not compile a .rst with a section within a container directive with a message (SEVERE/4) Unexpected section title or transition..

.. container:: right

   ========
   Section1
   ========

   Right text

.. container:: left

   Left text

I guess/think the rst2html5 behavior is completely valid for the rst specification.

I would like to get .html from .rst with rst2html5 like this.

<div class="right">
  <h1>Section1</h1>
  <p>Right text</p>
</div>
<div class="left">
  <p>Left text</p>
</div>

Is it allowed to include sections within container or something like that? (I think it is not allowed, right?) or How can I get a similar html output to above from .rst (with rst2html5)?

I read this thread, but could not manage to get 2-column html.

Any comments would be appreciated. Thanks in advance.

like image 921
heartfield Avatar asked Apr 29 '13 03:04

heartfield


1 Answers

I think trying to make the ReST to handle the two columns is the wrong way. ReST does not care about layout and should not care about layout. That should be done by the site design, and classes.

Here is a question on that issue: flow 2 columns of text automatically with CSS It looks like the CSS3: columns property is being quite widely supported now.

And you are right, Docutils doesn't sections headers in containers. Containers are a type of body elements, and only allowed inside sections. http://docutils.sourceforge.net/docs/ref/doctree.html

like image 88
Lennart Regebro Avatar answered Oct 30 '22 09:10

Lennart Regebro