dzhu/rstfmt

Breaking block quotes

kayhayen opened this issue · 2 comments

Working on my Changelog.rst for Nuitka, I discovered this breaking change done by rstfmt 0.0.6:

From this code:

python 2.6::

   Pystone(1.1) time for 50000 passes = 0.48
   This machine benchmarks at 104167 pystones/second

it creates:

python 2.6:

.. code::

   Pystone(1.1) time for 50000 passes = 0.48
   This machine benchmarks at 104167 pystones/second

The later is wrong, this is not code (I think Python is the default). When I run it again, it does not complain about invalid Python, but if I add it, it does. The rst2pdf however complains very loudly about this rest code for that reason. So I think, this reveals 2 bugs in rst2fmt, fist missing default language, second turning block quotes to code, which is not correct. I am merely quoting program outputs with block quotes.

On a side note, I was deeply impressed by the black integration you are using there, very nice, and it found a bunch of syntax errors in my code snippets, good job there, making that happen, very appreciated. For now, I will do a search and replace to fix these up, but I can use the end result otherwise I believe.

I have updated to 0.0.7 from PyPI (for which code is on dev, but not on master) but the issue here is still present.

The issue is still present, but I checked in the official docs, and it says this that the change I am complaining about is absolutely valid: https://docutils.sourceforge.io/docs/ref/rst/directives.html#id44

It's just that rst2pdf will not accept it that way, but that's just a search and replace away. That's not your issue. Not sure yet about Nikola, but I guess it either works there, or it's their issue as well.

The other issues I can confirm are all solved. I am going to add it to my development requires and commit hook to have the automatic formatting. Big relief, thanks for your hard work on this.