#2 pyweb.py test/test_rst.w generate wrong ReST

open-works-for-me
None
5
2010-12-30
2010-07-16
Anonymous
No

$ cd pyweb-2.1
$ python ../pyweb.py test_rst.w

The generated test_rst.rst contain something like this:

.. _`1`:
.. rubric:: test.py (1)
.. parsed-literal::

|srarr| Import the os module (`3`_)
|srarr| Get the OS description (`4`_)
|srarr| Construct the message with Concatenation (`5`_)
|srarr| Print the message (`7`_)

which is wrong. The correct is like (indent |srarr|):

.. _`1`:
.. rubric:: test.py (1)
.. parsed-literal::

|srarr| Import the os module (`3`_)
|srarr| Get the OS description (`4`_)
|srarr| Construct the message with Concatenation (`5`_)
|srarr| Print the message (`7`_)

Discussion

  • spaces got lost when rendered by tracker. In face the correct ReSt
    should be like this, with '4spaces' replaced by 4 spaces:

    .. _`1`:
    .. rubric:: test.py (1)
    .. parsed-literal::

    4spaces|srarr| Import the os module (`3`_)
    4spaces|srarr| Get the OS description (`4`_)
    4spaces|srarr| Construct the message with Concatenation (`5`_)
    4spaces|srarr| Print the message (`7`_)

     
  • Confirmed. It seems to be some problem in the emitter class. Adding a code_indent=0 and setting the context with

    self.context= [self.code_indent]

    seems to fix the problem.

     
  • Steven F. Lott
    Steven F. Lott
    2010-12-30

    • assigned_to: nobody --> slott56
    • status: open --> open-works-for-me