maranget / hevea

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

Optimizer drops some pseudo-element selectors. #31

Open cspiel opened 4 years ago

cspiel commented 4 years ago

Hevea optimizes (option: -O) out some CSS classes that use pseudo-element selectors; without optimization the generated HTML code is fine.

Here comes an example:


\documentclass{article}

\usepackage{hevea}

\newstyle{:root}{--initialcapwidth: 60\%}% not optimized away
\newstyle{.initialcap}{margin: auto; width: var(--initialcapwidth)}
%%  Bug: next two newstyles are evicted by the optimizer (`-O').
\newstyle{.initialcap::first-letter}{font-size: 250\%}
\newstyle{.initialcap::first-line}{line-height: 120\%}

\newenvironment{initialcap}{\begin{divstyle}{initialcap}}{\end{divstyle}}

\begin{document}
\begin{initialcap}
  Well, you know or don't you kennet or haven't I told you every
  telling has a taling and that's the he and the she of it.  Look,
  look, the dusk is growing!  My branches lofty are taking root.  And
  my cold cher's gone ashley.  Fieluhr?  Filou!  What age is at?  It
  saon is late.
\end{initialcap}
\end{document}

Classes :root and .initialcap survive the optimization phase, whareas .initialcap::first-letter and .initialcap::first-line are lost.