31.2 Chapters, Appendixes, and Like Chapters

We can test for \@chapter, but not fo \chapter, to check whether the unit exists. fancyheadings.sty changes the latter into \relax.

<..chapters for book / report..>
 \let\:tempb=\chapter
 \Def:Section\chapter{\thechapter}{#1}
 \let\:chapter=\chapter
 \let\chapter=\:tempb
 \def\@makechapterhead#1{}
 \let\no@chapter=\@chapter
 \def\@chapter[#1]#2{%
    <.adjust minipageNum for setcounter footnote 0.>%
    {\SkipRefstepAnchor \let\addcontentsline=\:gobbleIII\no@chapter[#1]{}}%
    \HtmlEnv   \Toc:Title{#1}\:chapter{#2}}
 -_-_-

<..chapters for book / report..>+
 \Def:Section\likechapter{}{#1}
 \let\:likechapter=\likechapter
 \let\likechapter=\:UnDef
 \let\no@schapter=\@schapter
 \def\@schapter#1{%
    <.star ch title.>%
    {\let\addcontentsline=\:gobbleIII\no@schapter{}}%
    \HtmlEnv   \:likechapter{#1}}
 -_-_-

<..chapters for book / report..>+
 \let\no@appendix=\appendix
 \Def:Section\appendix{\thechapter}{#1}
 \let\:appendix=\appendix
 \def\appendix{%
    \def\@chapter[##1]##2{%
       <.adjust minipageNum for setcounter footnote 0.>%
       {\def\addcontentsline####1####2####3{}\no@chapter[##1]{}}%
       \HtmlEnv \Toc:Title{##1}\:appendix{##2}}%
    \no@appendix}
 -_-_-

<..html latex divs..>
 \def\Toc:Title#1{\gdef\TocTitle{#1}%
   \ifx\TocTitle\empty \global\let\TocTitle=\:UnDef\fi}
 -_-_-

If defined, the \TocTitle carries the info in the square brackets of ‘\@chapter[##1]##2{...’, ‘\@section[##1]##2{...’, etc.

> I discovered that TeX4ht uses some literal strings, like "Chapter" 
> for the name of the chapters. This causes an incompatibility with 
> the package Babel (for typesetting documents in other languages than 
> english). LaTeX uses the command \chaptername for storing the string 
> "Chapter", and babel redefines this command in a convenient way for 
> each language (in spanish, \chaptername is "Cap\’{\i}tulo"). Since 
> TeX4ht does not use the \chaptername, its output is always 
> "Chapter", which is inconvenient for non-english users. I don’t know 
> if TeX4ht uses other literal strings, I only noticed this one. 

[more]