HTML export: Make table row tag customizable
commit8e34ea7b48e249386acf26540086bcbb8bca5e1f
authorCarsten Dominik <carsten.dominik@gmail.com>
Thu, 18 Jun 2009 05:07:22 +0000 (18 07:07 +0200)
committerCarsten Dominik <carsten.dominik@gmail.com>
Thu, 18 Jun 2009 05:07:22 +0000 (18 07:07 +0200)
tree2619fcabc8068a0d443bfb65305e915c10be8f90
parent5406183319a9b26214c23b4869d9be218149aec1
HTML export: Make table row tag customizable

Xin Shi writes:

> Hello Experts,
>
> I use org-mode to produce a lot of big tables with numbers in
> them. When I present these tables by HTML, I found it's hard to
> keep track which row it is. I'm wondering if it's possible to
> implement additional class attribute to the <tr>, such as:
>
> <table class="sample">
> <tr class="d0"><td>One</td><td>Fish</td></tr>
> <tr class="d1"><td>Two</td><td>Fish</td></tr>
>
> <tr class="d0"><td>Red</td><td>Fish</td></tr>
> <tr class="d1"><td>Blue</td><td>Fish</td></tr>
> </table>
>
> So, that in the CSS file, it'll be easier to implement the color:
>
>
> <style type="text/css">
> table.sample {
>  border: 6px inset #8B8378;
>  -moz-border-radius: 6px;
> }
> table.sample td {
>  border: 1px solid black;
>  padding: 0.2em 2ex 0.2em 2ex;
>
>  color: black;
> }
> table.sample tr.d0 td {
>  background-color: #FCF6CF;
> }
> table.sample tr.d1 td {
>  background-color: #FEFEF2;
> }
> </style>

This commit introduces a new variable `org-export-table-row-tags'
that can be used for this and similar purposes.  For the example
of the poster, one could use:

 (setq org-export-table-row-tags
       (cons '(if head "<tr>"
                (if (= (mod nline 2) 1)
                    "<tr class=\"d1\">"
                  "<tr class=\"d0\">"))
             "</tr>"))
lisp/ChangeLog
lisp/org-html.el