27.4 ProblemFix: Disabling Links and Index Generation

  27.4.1 Disabling Hyperlinks Inside the Table of Contents
  27.4.2 Disabling Hyperlinks in the Index

It is problematic to generate links and indices inside the table of contents and inside the index. It would lead to improper XHTML code. So we simply disable the generation of links and indices by providing a command disableLinksAndIndices for the following sections.

3354ht disable links and index generation 335  (327)  336
\newcommand{\rhxSimpleDefineTerm}[3]{#2}%
\newcommand{\rhxSimpleUseTerm}[3]{#2}%
\newcommand{\rhxSimplehref}[2]{#2}%
\def\disableLinksAndIndices{%
  \let\rhxDefineTerm\rhxSimpleDefineTerm
  \let\rhxUseTerm\rhxSimpleUseTerm
  \let\href\rhxSimplehref}

Defines:
disableLinksAndIndices, used in chunks 336 and 337.

27.4.1 Disabling Hyperlinks Inside the Table of Contents

The following code is a verbatim copy from TEX4ht’s html4.4ht with the command disableLinksAndIndices added.

3364ht disable links and index generation 335+   (327)  335  337
\Configure{tableofcontents}
   {\IgnorePar\EndP\disableLinksAndIndices
     \HCode{<div class="tableofcontents">}\IgnorePar}
   {\ifTag{tex4ht-body}{\HCode{<br />}\Link{tex4ht-body}{}Home\EndLink}{}}
   {\IgnorePar\EndP\HCode{</div>}\ShowPar}
   {\HCode{<br />}}{}

\Configure{TocAt}%
{\let\sv:atoc\a:tableofcontents
  \let\sv:btoc\b:tableofcontents
  \let\sv:ctoc\c:tableofcontents
  \let\sv:dtoc\d:tableofcontents
  \let\sv:etoc\e:tableofcontents
  %
  \Configure{tableofcontents}
  {\IgnorePar\EndP\disableLinksAndIndices
    \HCode{<div class="\sec:typ TOCS">}\IgnorePar}
  {}{\IgnorePar\HCode{</div>}\ShowPar}{\HCode{<br />}}{}%
  \ifvmode \IgnorePar\fi \EndP
}
{\let\a:tableofcontents\sv:atoc
  \let\b:tableofcontents\sv:btoc
  \let\c:tableofcontents\sv:ctoc
  \let\d:tableofcontents\sv:dtoc
  \let\e:tableofcontents\sv:etoc
  \par\ShowPar}

Uses disableLinksAndIndices 335.

27.4.2 Disabling Hyperlinks in the Index

Similar to the previous section, we copy code from html4.4ht and add the command disableLinksAndIndices.

3374ht disable links and index generation 335+   (327)  336
\Configure{theindex}
   {\ifvmode \IgnorePar\fi \EndP\disableLinksAndIndices
    \HCode{<div class="theindex">}\let\end:theidx\empty}
   {\end:theidx\HCode{</div>}}
   {} {\hfil\break\HCode{<br />}}
   {\ \ \ \ } {\hfil\break\HCode{<br />}}
   {\ \ \ \ \ \ \ \ } {\hfil\break\HCode{<br />}}
   {\hbox{\end:theidx\HCode{<p class="theindex">}}%
    \def\end:theidx{\HCode{</p>}}}

Uses disableLinksAndIndices 335.