Saturday, June 1, 2013

why does htlatex generate extra

?

why does htlatex generate extra <p class="noindent" >?

I am trying to learn how to use htlatex to make macros to generate duplicated HTML code which is different in only few places.
Actually it is easier to do it this way, since writing macros or functions in HTML is hard at least and one must use php to generate HTML code on the server using different argument.
It is much better to generate it once in the original HTML code.
The goal is to reduce code duplication in HTML by using macros with arguments.
But this is not the point here. My question is simple. I noticed in this simple HTML generated that htlatex adds an extra <p class="noindent"> BEFORE the HTML code it is being asked to generate.
My question is why is it doing this, and how to make it generate only the HTML code without this extra bit.
Here is the .tex file, it has one environment which makes DIV with a name passed in, and builds a list of 2 items, the content which is also passed in as arguments.
This environment takes 3 arguments.
\documentclass{article}%

\newenvironment{make_name}[3]
{
  \HCode{<div class=#1>}
      \Tg<OL>
        \Tg<LI> item is #2 \Tg</LI>
        \Tg<LI> item is #3 \Tg</LI>
      \Tg</OL>
   \Tg</div>
}

\begin{document}   

\ifx\HCode\undefined \else
 \begin{make_name}
      {"class_name"}{"A"}{"B"}
 \end{make_name}
\fi


\end{document}
The command to compile is htlatex 21.tex "htm" and the HTML generated is (formatted it a little to make it easier to read) is 21.htm

<html>
<head>
<link rel="stylesheet" type="text/css" href="21.css">
</head>
<body>
<p class="noindent">  <!---- WHY IS THIS HERE, WHERE DID IT COME FROM? -->
   <div class="class_name">
     <OL>
       <LI> item is &#8221;A&#8221; </LI>
       <LI> item is &#8221;B&#8221; </LI>
     </OL>
   </div>

</body>
</html>
One can see that extra <p class="noindent"> in the HTML. Is this something automatically done? and finally, where is there no </P> at the end? <p> should really have a corresponding </p> for valid HTML I thought, but not sure now.

No comments:

Post a Comment