#87 tables should have an additional class in html

closed-fixed
nobody
None
6
2009-09-18
2007-07-19
Nilton Volpato
No

Docutils generates html for tables something like this:

<table class="docutils" border="1"> ... </table>

However docutils uses html tables for implementing a series of other constructs (field-lists, option-lists, footnotes, citations, etc). The problem is that all of them have class docutils, making it very difficult to use css selectors that affect just rst tables.

For instance:

table.docutils { border: 1px solid black; }

will add border to citations, footnotes, etc. which is certainly not what one wants.

I propose that rst tables have an additional class, say "tabular", so that CSS authors can easily change just tables properties.

Also, instead of passing border="1" to such tables, docutils css can provide a default style for tables:

table.tabular { ... }

<table class="docutils tabular"> ... </table>

This problem may not have arised earlier because docutils css is too simple, and people generally does not use all docutils constructs which avoid the pathological situations.

Thanks,
-- Nilton

Discussion

  • Günter Milde
    Günter Milde
    2009-09-10

    • priority: 5 --> 6
     
  • Günter Milde
    Günter Milde
    2009-09-11

    • status: open --> open-fixed
     
  • Günter Milde
    Günter Milde
    2009-09-11

    Added a backwards compatible fix to CSS (upcoming release 0.6)
    Similar to the latex writer, a "--table-style" option was added.
    The content of this option is added to the class argument of standard tables.

    > Also, instead of passing border="1" to such tables, docutils css can
    > provide a default style for tables

    The border=1 can be easily overridden with a CSS rule (try table-style=borderless)

    I would like to see/add a rule for a "booktabs" style similar to the latex writers "booktabs" setting.

     
  • Günter Milde
    Günter Milde
    2009-09-18

    • status: open-fixed --> closed-fixed