Menu

#173 Make *TeX writers convert nonstandard table classes to DUclass environments

None
closed-accepted
nobody
None
5
2021-04-03
2020-10-17
No

The attached patch modifies the LaTeX and XeLaTeX writers so that any classes on a table that are not listed in docutils.writers.latex2e.Writer.table_style_values (i.e., any classes that docutils does not already assign a meaning to) are converted to DUclass environments around the table in the output. With this patch, an input of:

.. table::
    :class: my-class colwidths-auto

    ===  ======
    Foo  Bar
    ===  ======
    Red  Blue
    Qux  Glarch
    ===  ======

would be converted by rst2latex.py to a document containing:

\begin{DUclass}{my-class}
% normal markup for colwidths-auto table goes here
\end{DUclass}

Note that I made the minimum changes necessary to implement this patch while disrupting as little of the pre-existing tests as possible. You may want to fiddle with the patch some to adjust the whitespace around the output \begin{DUclass} commands.

1 Attachments

Discussion

  • John Thorvald Wodder II

    I ended up fiddling with the whitespace myself. Attached is a modified patch with more reasonable spacing around the \begin{DUclass}.

     
  • Günter Milde

    Günter Milde - 2020-10-27
    • status: open --> open-accepted
     
  • Günter Milde

    Günter Milde - 2020-10-27

    Applied in r8569.
    Thank you for the patch.

     
  • Günter Milde

    Günter Milde - 2021-04-03
    • status: open-accepted --> closed-accepted
     
  • Günter Milde

    Günter Milde - 2021-04-03

    Fixed in Docutils 0.17.
    Thanks again for your contribution.

     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.
Try Free →