Alex Waite 21edf69157 Add better-tables pelican plugin - for restoring sanity to tables 9 年之前
..
LICENSE 21edf69157 Add better-tables pelican plugin - for restoring sanity to tables 9 年之前
README.md 21edf69157 Add better-tables pelican plugin - for restoring sanity to tables 9 年之前
__init__.py 21edf69157 Add better-tables pelican plugin - for restoring sanity to tables 9 年之前
better_tables.py 21edf69157 Add better-tables pelican plugin - for restoring sanity to tables 9 年之前

README.md

Better Tables

This pelican plugin removes the excess attributes and elements in the HTML tables generated from RST. Trimming this fat allows them to pass HTML5 validation. Hopefully rst2html5 will be merged into pelican at some point, but until then, this hacky approach is needed.

This approach has the advantage of restoring sanity to tables, and allows their column with to flow normally. All styling is default and must be styled by CSS rather than in HTML attributes.

I make no claim that /all/ HTML table crimes generated are corrected, merely the ones which I have stumbled across.

Requirements

  • Beautiful Soup 4

What does it do?

At the moment, the following is stripped from tables (though when in doubt, check the source as it may be updated out of sync with this document).

  • element (and its evil children)
  • table's "border" attribute
  • and 's valign attribute

    Usage

    Enable the plugin in your pelicanconf.py

    PLUGINS = [
        # ...
        'better_tables',
        # ...
    ]
    

    And that's it. Life's simple like that sometimes.