You can try this .cfg
file:
\Preamble{xhtml}
\Configure{halignTB<>}{tabular}{%
\HCode{id="TBL-\TableNo" class="tabular"\Hnewline
\GROUPS\Hnewline
}<>\HAlign}
\begin{document}
\EndPreamble
The \Configure{halignTB<>}
command configures contents of HTML attributes that are used in the <table>
element. I took this definition from TeX4ht source code and removed cellspacing
and cellpading
.
The following sample file:
\documentclass{article}
\begin{document}
\begin{tabular}{|l| l|}
\hline
first & second\\
\hline
third & fourth\\\hline
\end{tabular}
\end{document}
Compiled using
tex4ebook -c mycfg.cfg sample.tex
Produces this HTML code:
<div class='tabular'> <table class='tabular' id='TBL-1'><colgroup id='TBL-1-1g'><col id='TBL-1-1' /></colgroup><colgroup id='TBL-1-2g'><col id='TBL-1-2' /></colgroup><tr class='hline'><td><hr /></td><td><hr /></td></tr><tr id='TBL-1-1-' style='vertical-align:baseline;'><td class='td11' id='TBL-1-1-1' style='white-space:nowrap; text-align:left;'>first</td><td class='td11' id='TBL-1-1-2' style='white-space:nowrap; text-align:left;'>second</td></tr><tr class='hline'><td><hr /></td><td><hr /></td></tr><tr id='TBL-1-2-' style='vertical-align:baseline;'><td class='td11' id='TBL-1-2-1' style='white-space:nowrap; text-align:left;'>third</td> <td class='td11' id='TBL-1-2-2' style='white-space:nowrap; text-align:left;'>fourth</td>
</tr><tr class='hline'><td><hr /></td><td><hr /></td></tr></table>
</div>