maranget / hevea

Hevea is a fast latex to html translator
http://hevea.inria.fr
Other
97 stars 12 forks source link

Invalid HTML generated with macro followed by blank line inside of table #37

Closed cspiel closed 4 years ago

cspiel commented 4 years ago

Almost minimal example:

\documentstyle{article}

\begin{document}
\begin{tabular}{p{0.25\linewidth}@{\qquad}l}
  Head1  &  Head2  \\
  \relax% macro call plus following blank lines[s] screw up the output.

  Data11  &  Data12  \\
  Data21  &  Data22  \\
\end{tabular}
\end{document}

Translate with hevea tabular-unexpected-p.tex. Except, manually reformatted for clarity:

<table style="border-spacing:6px;border-collapse:separate;" class="cellpading0">
  <tr>
    <td style="vertical-align:top;text-align:left;" > Head1</td>
    <td style="text-align:center;white-space:nowrap" >&#XA0;&#XA0;&#XA0;&#XA0;</td>
    <td style="vertical-align:top;text-align:left;white-space:nowrap" >Head2 </td>
  </tr>

  <tr>
    <td style="vertical-align:top;text-align:left;" >
      <p>Data11<td style="text-align:center;white-space:nowrap" >&#XA0;&#XA0;&#XA0;&#XA0;</td></p>
    </td>
    <td style="vertical-align:top;text-align:left;white-space:nowrap" >Data12 </td>
  </tr>

  <tr>
    <td style="vertical-align:top;text-align:left;" > Data21</td>
    <td style="text-align:center;white-space:nowrap" >&#XA0;&#XA0;&#XA0;&#XA0;</td>
    <td style="vertical-align:top;text-align:left;white-space:nowrap" >Data22 </td>
  </tr>
</table>

A p-element sneaks into the second tr, which harbours a td.

maranget commented 4 years ago

Hi, thanks fore reporting the issue, especially in (almost) minimal form,

commit 10fd45f54c649be74cd0b361e36395f9542a92b0 is meant to solve the issue.

Would you please try on some other instance of the bug, if some exists.

cspiel commented 4 years ago

THX for fixing the problem!

I have found xmllint(1) a useful tool for checking the well-formedness and the validity of HTML code generated by HeVeA; it is not as loquatious as tidy(1), but points out the problems our browser remain silent about.

    xmllint --html --noout HTML-FILE

In fact xmllint told me to grab my brown paper bag, because I botched the translation of \verb to <code>; see #38

maranget commented 4 years ago

THX for fixing the problem!

I have found xmllint(1) a useful tool for checking the well-formedness and the validity of HTML code generated by HeVeA; it is not as loquatious as tidy(1), but points out the problems our browser remain silent about.

    xmllint --html --noout HTML-FILE

In fact xmllint told me to grab my brown paper bag, because I botched the translation of \verb to <code>; see #38

Good catch, one bug/fix each... Thank you xmllint.