Opened 4 years ago

Closed 4 years ago

#4583 enhancement closed fixed (fixed)

lore2sphinx should use `code-block` blocks for code samples.

Reported by: Screwtape Owned by:
Priority: normal Milestone:
Component: core Keywords: documentation
Cc: khorn Branch:
Author: Launchpad Bug:

Description

The current Twisted Documentation Standard describes the three different kinds of code-snippets that Lore can prettify: python, python-interpreter and shell:

<pre class="python">
print "hello, world"
</pre>
<pre class="python-interpreter">
>>> 1 + 1
2
</pre>
<pre class="shell">
$ twistd --version
</pre>

Currently, lore2sphinx throws away the class information and renders all three as plain block-text constructs:

::
  print "hello, world"

::
  >>> 1+1
  2

::
  $ twistd --version

Due to the Magic of Sphinx, the first two examples are properly detected and syntax-highlighted anyway, but the third is not. It would be good if lore2sphinx could include the type information in the ReST markup:

.. code-block:: python
   print "hello, world"

.. code-block:: pycon
   >>> 1+1
   2

.. code-block:: console
   $ twistd --version

Change History (4)

comment:1 Changed 4 years ago by khorn

  • Owner changed from glyph to exarkun

Good call, Screwtape!

I've updated lore2sphinx with this change, and pushed it out to the bitbucket repo. I presume we should wait until the builder is updated and the results are verified in order to "review" this ticket.

Exarkun, can you update the builder (just pull the new lore2sphinx)?

comment:2 Changed 4 years ago by khorn

  • Keywords review added
  • Owner exarkun deleted

comment:3 Changed 4 years ago by exarkun

  • Keywords review removed
  • Resolution set to fixed
  • Status changed from new to closed

Updated; for the time being the build results are at <http://buildbot.twistedmatrix.com/builds/sphinx-html-15623/>. The shell examples look good. Seems fixed, thanks!

comment:4 Changed 4 years ago by <automation>

Note: See TracTickets for help on using tickets.