9.4 Lit Prog and Verbatim

  9.4.1 ProTex
  9.4.2 moreverb
  9.4.3 fancyvrb
  9.4.4 Listings
  9.4.5 Verbatim
  9.4.6 mdwlist
  9.4.7 verbatimlisting
  9.4.8 doc

9.4.1 ProTex

<..configure html4 ProTex..>
 \def\NAME:{ id=}
 \:CheckProtexOption{[[]]}\if:Option
    <.frame protex code.>
 \fi
-_-_-

<..frame protex code..>
 \HAssign\ShowCodeN = 0
 \Configure{FrameCode}
    {\ifvmode \IgnorePar\fi  \EndP
     \gHAdvance\ShowCodeN by 1
     <.lynx separator.>%
         \HCode{<div class="ShowCode"
                     id="ShowCode-\ShowCodeN">\ifx \:test\:minus
                  \else<div class="head">\fi}\par\IgnorePar}
    {\ifvmode \IgnorePar\fi \EndP
         \HCode{</div></div>}}
 \Configure{ShowCode}
    {\HCode{\ifx \:test\:minus  \else </div>\fi
        \html:src<div class="body"><span class="ShowCode"
         style="font-family:monospace;white-space:nowrap;"
      >\html:invisible}%
      \nobreak
    }
    {\special{t4ht=\html:src</span>%
            \ifx \:test\:minus \else
               </div><div class="tail">\html:BackTitle\fi}}
    {\HCode{<br />\html:invisible}}
    {\HCode{<i>}}
    {\HCode{</i>}}
    {<.nbsp.>}
 \Css{div.ShowCode{background-color:\#EEEEEE; border: 1px white solid;}}
 \Css{div.ShowCode div.head{background-color:\#E0E0E0;}}
 \Css{div.ShowCode div.tail{background-color:\#E0E0E0;}}
-_-_-

<..nbsp..>
 \leavevmode\special{t4ht@+\string&{35}x00A0{59}}x%
-_-_-

The ‘59’ stands for semicolon. Explicit character might be problematic for languages (e.g., French) where the cahacter is active and may be imported from aux or another file.

<..lynx separator..>
 \ifx \par:end\empty \HCode{<p></p>}\fi
-_-_-

9.4.2 moreverb

<..configure html4 moreverb..>
 <.moreverb.sty config 4.0t.>
-_-_-

<..moreverb.sty config 4.0t..>
 \ConfigureEnv{verbatimtab}
    {\env:verb{verbatim}}
    {\endenv:verb}{}{}
 \Configure{verbatimtab}
    {\HAdvance\Verb:N by 1 \ifnum \Verb:N>1 \:nbsp \HCode{<br />}\fi}
    {\a:sp}
 \ConfigureEnv{boxedverbatim}
    {\env:verb{boxedverbatim}}{\endenv:verb}{}{}
 \ConfigureEnv{boxedverbatim*}
    {\env:verb{boxedverbatim}}{\endenv:verb}{}{}
 \Css{table.boxedverbatim {width:100\%;}}
-_-_-

<..moreverb.sty config 4.0t..>+
 \ConfigureEnv{boxedverbatim}
    {\env:verB{boxedverbatim}}{\endenv:verb}{}{}
 \ConfigureEnv{boxedverbatim*}
    {\env:verB{boxedverbatim}}{\endenv:verb}{}{}
 \def\env:verB#1{\IgnorePar\HCode{<table  \Hnewline
    class="#1"><tr class="#1"><td \Hnewline
    class="#1"><pre class="#1">}\EndNoFonts}
 \Css{ pre.boxedverbatim{border:solid 1px; padding-right:1em;} }
 \Css{table.boxedverbatim {text-align:center;}}
-_-_-

<..moreverb.sty config 4.0t..>+
 \Configure{listinginput}
    {\HCode{<div class="listinginput">}}
    {\IgnorePar\HCode{</div>}}
 \Css{.listinginput p{ margin-bottom:0em; margin-top:0em; }}
-_-_-

<..moreverb.sty config 4.0t..>+
 \Configure{verbatimtabinput}
    {\ifvmode \IgnorePar\fi \EndP
     \HCode{<div class="verbatimtabinput"\a:LRdir>}}
    {\ifvmode \IgnorePar\fi \EndP \HCode{</div>}}
-_-_-

9.4.3 fancyvrb

<..configure html4 fancyvrb..>
 \HAssign\fancyvrbNo=0
 \Configure{fancyvrb}
    {\IgnorePar \EndP \gHAdvance\fancyvrbNo by 1
     \gHAssign\fancyvrb:cnt0
     \HCode{<div class="fancyvrb" id="fancyvrb\fancyvrbNo">}}
    {\EndP\HCode{</div>}}
    {\gHAdvance\fancyvrb:cnt by 1
     \ifnum \fancyvrb:cnt>1
     \HCode{<br class="fancyvrb" />}\fi} {}
    {\ \ }{}
 \Css{P.fancyvrb {white-space: nowrap; margin:0em;}}
-_-_-

The following is harmful at the start of section 1.1 in listings.dtx.

\ConfigureEnv{verbatim}{\HAssign\Verb:N=0\relax}{\empty}{}{}  
\ConfigureEnv{verbatim*}{\HAssign\Verb:N=0\relax}{\empty}{}{}

<..configure html4 fancyvrb..>+
 \Configure{fancyvrbcolor}
   {\Css{div\#fancyvrb\fancyvrbNo { color: \HColor; }}}
   {\Css{div\#fancyvrb\fancyvrbNo { background-color: \HColor;}}}
   {\Css{div\#fancyvrb\fancyvrbNo { border-color: \HColor;}}}
-_-_-

<..configure html4 fancyvrb..>+
 \Configure{fancyvrbframe}
    {\Css{div\#fancyvrb\fancyvrbNo { border-top: solid \HSize; }}}
    {\Css{div\#fancyvrb\fancyvrbNo { border-left: solid \HSize; }}}
    {\Css{div\#fancyvrb\fancyvrbNo { border-bottom: solid \HSize; }}}
    {\Css{div\#fancyvrb\fancyvrbNo { border-right: solid \HSize; }}}
    {\Css{div\#fancyvrb\fancyvrbNo {border-width:\HSize;}}}
    {\Css{div\#fancyvrb\fancyvrbNo {padding:\HSize;}}}
-_-_-

<..configure html4 fancyvrb..>+
 \Configure{BVerbatimInput}
    {\ifvmode \IgnorePar \fi \EndP
     \gHAssign\HRow=0
     \HCode{<div class="BVerbatimInput">}}
    {\ifvmode \IgnorePar \fi \EndP \HCode{</div>}}
    {\gHAdvance\HRow by 1 \ifnum \HRow>1 \HCode{<br />}\fi}{}
-_-_-

9.4.4 Listings

<..configure html4 listings..>
 \Configure{lstinline}
    {\HCode{<span class="lstinline">}}
    {\HCode{</span>}}
-_-_-

<..configure html4 listings..>+
 \Log:Note{to ensure proper alignments use
    fixed size fonts (see listings.dtx)}
-_-_-

<..configure html4 listings..>+
 \HAssign\listings:Depth = 0
 \Configure{listings}
    {\ifvmode \IgnorePar\fi \EndP
     {\everypar{}\leavevmode}\HCode{<!--l. \the\inputlineno-->}%
      \ifnum \listings:Depth=0 \HCode{<pre class="listings">}\else
                               \HCode{<span class="listings-nested">}\fi
      \gHAdvance\listings:Depth by 1
    }
    {\gHAdvance\listings:Depth by -1
     \ifnum \listings:Depth=0 \HCode{</pre>}\else
                              \HCode{</span>}\fi
    }
    {<.nbsp.>\HCode{<br /><span class="label">}}
    {\HCode{</span>}}%
-_-_-

<..configure html4 listings..>+
 \Configure{listings-init}{\special{t4ht@(}}{\special{t4ht@)}}
-_-_-

<..configure html4 listings..>+
 \HAssign\listingN=0
 \ConfigureEnv{lstlisting}
    {\ifvmode \IgnorePar\fi \EndP
     \gHAdvance\listingN by 1
     \HCode{<!--l. \the\inputlineno-->}%
     \gdef\start:LstLn{%
        \HCode{<div class="lstlisting" id="listing-\listingN">}%
        \gdef\start:LstLn{<.nbsp.>\HCode{<br />}}}
     \bgroup
        \Configure{listings}
          {{\everypar{}\leavevmode}}
          {{\everypar{}\leavevmode}}
          {\start:LstLn \HCode{<span class="label">}}
          {\HCode{</span>}}%
    }
    {\egroup
     \ifvmode \IgnorePar\fi \EndP \HCode{</div>}\par}
    {} {}
 \Css{.lstlisting .label{margin-right:0.5em; }}
 \Css{div.lstlisting{font-family: monospace; white-space: nowrap;
                     margin-top:0.5em; margin-bottom:0.5em;
                    }}
-_-_-

<..configure html4 listings..>+
 \Configure{lstinputlisting}
    {\ifvmode \IgnorePar\fi \EndP
     \HCode{<!--l. \the\inputlineno-->}%
     \HCode{<div class="lstinputlisting">}%
     \bgroup \tt %\special{t4ht@(}%
        \Configure{listings}
          {{\everypar{}\leavevmode}}
          {{\everypar{}\leavevmode}}
          {\leavevmode\special{t4ht@+\string&{35}x00A0{59}}x%
              \HCode{<br /><span class="label">}}
          {\HCode{</span>}}%
    }
    {%\special{t4ht@)}
     \egroup
     \ifvmode \IgnorePar\fi \EndP  \HCode{</div>}\par}
 \Css{div.lstinputlisting{
    font-family: monospace;
    white-space: nowrap;
 }}
 \Css{.lstinputlisting .label{margin-right:0.5em;}}
-_-_-

9.4.5 Verbatim

<..configure html4 verbatim..>
 \Configure{verbatiminput}
   {\HAssign\Verb:N=0 \ifvmode \IgnorePar\fi \EndP
    \HCode{<div class="verbatiminput"\a:LRdir>}}
   {\ifvmode \IgnorePar\fi \EndP \HCode{</div>}}
 \Css{div.verbatiminput
        {font-family: monospace; white-space: nowrap; }}
-_-_-

9.4.6 mdwlist

<..configure html4 sverb..>
 \HAssign\demoN=0
 \Configure{demo}
    {\HAdvance\demoN by 1
     \ifvmode \IgnorePar \fi \EndP
     \ifnum \demoN=1
        \HCode{<table class="demo"><tr>}%
     \fi
     \HCode{<td>}%
    }
    {\ifvmode \IgnorePar \fi \EndP
     \HCode{</td>}
     \ifnum \demoN=2
         \HAssign\demoN=0
         \HCode{</tr></table>}%
     \fi
    }
-_-_-

9.4.7 verbatimlisting

<..configure html4 verbatimlisting..>
 \Configure{verbatimlisting}
   {\ifvmode \EndP\fi \EndP\HCode{<div class="verbatimlisting"\a:LRdir>}}
   {\HCode{</div>}}
   {\ifnum \c@lineno > 1 \HCode{<br />}\fi
    \ifnum \c@lineno<10 ~\fi
    \ifnum \c@lineno<100 ~\fi
    \ifnum \c@lineno<1000 ~\fi
   }
   {}
-_-_-

9.4.8 doc

<..configure html4 doc..>
 \ConfigureEnv{macrocode}
   {\ifvmode \IgnorePar\fi\EndP\HCode{<pre class="macrocode">}}
   {\ifvmode \IgnorePar \HCode{</pre>}\par\else \HCode{</pre>}\fi}
   {}{}
-_-_-