# [tex2html.pm] 15.02.1997 R.Scholz <mrz@informatik.uni-jena.de>
#
# This Module is used by: texpro-doc2html.pl
# it does: translate TeX-Commands to HTML or to TEXT, whatever
# looks better in a Web Browser.
# Bitte nicht ändern, bei Erweiterungswünschen erst Kontakt mit
# mrz@informatik.uni-jena.de aufnehmen !!
sub tex2html
# translate TeX commands to HTML
{
local ($_) = @_;
s/[ \t]+/ /g; # compress spaces
# s/^ //; s/ $//;
s|\\&|&|g; # \& -> &
s|~| |g; # ~ -> " "
s|\\\\(\[\d+\w\w\])?|<BR>|g; # \\ -> <BR>
s|\\medskip|<BR><BR>|g; # \medskip -> <BR><BR>
s|\\smallskip|<BR><BR>|g; # \smallskip -> <BR><BR>
s|\\bigskip|<BR><BR><BR>|g; # \bigskip -> <BR><BR><BR>
s|\\noindent||g; # \noindent -> ""
s|\\protect||g; # \protect -> ""
s|\\narrowitem||g; # \narrowitem -> ""
s/\\parindent\d+(mm|in|cm|pt)?//g; # \parindentxmm -> ""
s|\\ | |g; # "\ " -> " "
s|\\,| |g; # "\," -> " "
s|\\quad| |g; # \quad -> " "
s|\\qquad| |g; # \qquad -> " "
s|\\BibTeX|BibTeX|g; # \BibTeX -> "BibTeX"
s|\\LaTeXe|LaTeX2e|g; # \LaTeXe -> "LaTeX2e"
s|\\LaTeX|LaTeX|g; # \LaTeX -> "LaTeX"
s|\\TeX|TeX|g; # \TeX -> "TeX"
# Umlaute:
s|\{\\"a\}|ä|g;
s|\{\\"A\}|Ä|g;
s|\{\\"o\}|ö|g;
s|\{\\"O\}|Ö|g;
s|\{\\"u\}|ü|g;
s|\{\\"U\}|Ü|g;
s|\{\\"s\}|ß|g;
s|\\ss|ß|g;
s|ä|ä|g;
s|Ä|Ä|g;
s|ö|ö|g;
s|Ö|Ö|g;
s|ü|ü|g;
s|Ü|Ü|g;
s|ß|ß|g;
s|\\"a|ä|g; s|"a|ä|g;
s|\\"A|Ä|g; s|"A|Ä|g;
s|\\"o|ö|g; s|"o|ö|g;
s|\\"O|Ö|g; s|"O|Ö|g;
s|\\"u|ü|g; s|"u|ü|g;
s|\\"U|Ü|g; s|"U|Ü|g;
s|\\"s|ß|g; s|\\ss|ß|g; s|"s|ß|g;
s|\\/||g; # \/ -> ""
s|\\-||g; # \- -> ""
s|\{\}||g; # {} -> ""
s|(\\cite\s*\{[^}]+\})||g; # \cite -> ""
s|\\'{\\i}|í|g; # \'{\i} -> í
s|\\'{a}|á|g; # \'{a} -> á
s|{\\`e}|é|g; # {\`e} -> é
s|é|é|g; # é -> é
s|\$\\mu\$|µ|g; # \mu -> µ
s|\$\\Psi\$|Psi|g; # $\Psi$ -> Psi
s|\$\\psi\$|psi|g; # $\psi$ -> psi
# s|\\centerline\s*(\{.+\})|<CENTER>$1</CENTER>|g; # \centerline -> <CENTER>
s|\\centerline\s*(\{.+\})|<DIV align="center">$1</DIV>|g; # \centerline -> <DIV align="center">
# Fonts:
# old LaTeX2.09:
s|\{\s*\\em\s+([^}]+)\}|<EM>$1</EM>|g; # \em -> <EM>
s|\{\s*\\it\s+([^}]+)\}|<EM>$1</EM>|g; # \it -> <EM>
s|\{\s*\\bf\s+([^}]+)\}|<STRONG>$1</STRONG>|g; # \bf -> <STRONG>
s|\{\s*\\tt\s+([^}]+)\}|<TT>$1</TT>|g; # \tt -> <TT>
# new LaTeX2e:
s|\\textbf\s*\{([^}].+)\}|<STRONG>$1</STRONG>|g; # \textbf{} -> <STRONG>
s|\\texttt\s*\{([^}].+)\}|<TT>$1</TT>|g; # \texttt{} -> <TT>
s|\\emph\s*\{([^}].+)\}|<EM>$1</EM>|g; # \emph{} -> <EM>
s|\{\s*\\small\s+([^}]+)\}|<SMALL>$1</SMALL>|g; # \small -> <SMALL>
s|\{\s*\\footnotesize\s+([^}]+)\}|<SMALL>$1</SMALL>|g; # \footnotesize -> <SMALL>
s|\{\s*\\underline\s+([^}]+)\}|<U>$1</U>|g; # \underline -> <U>
s/\\path\|([^|]+)\|/<TT>$1<\/TT>/g; # \path -> <TT>
s/\\verb\|([^|]+)\|/<TT>$1<\/TT>/g; # \verb -> <TT>
# itemize --> <UL>
# description --> <UL type="square">
# item --> <LI>
s|(\\begin\s*\{itemize\})|<UL>|g;
s|(\\end\s*\{itemize\})|</UL>|g;
s|(\\begin\s*\{description\})|<UL type="square">|g;
s|(\\end\s*\{description\})|</UL>|g;
s|(\\item)|<LI>|g;
s/\{(.+)\}/$1/g; # {text} -> text, klappt nicht bei mehreren { {}{} }
s/[ \t]+/ /g; # compress spaces
s/^[ \t]+//g; s/[ \t]+$//g; # rm whitespace at beginning and end
return($_);
}
# END
1;