# autoref in French documents incompatible with TeX4ht

I'm currently using MiKTeX 2.9 on Windows 7 and can't get to compile a French document correctly. Here is a very minimal example:

\documentclass[francais]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{hyperref}

\begin{document}
Voir \autoref{test}.
\begin{figure}
\caption{Test}
\label{test}
\end{figure}
\end{document}


pdflatex compiles this without any errors or warnings. htlatex will only produce the correct results if I specify another language, like ngerman. For francais, however, I get the following warning:

l.7 --- TeX4ht warning --- \Link{x1-21}? ---
! Missing \endcsname inserted.
\special
l.7 Voir \autoref{test}
.


and this output in HTML if I ignore the warning:

Voir <a
href="#x1-21"><span class="frenchb-nbsp">&nbsp;</span>:autoreffigure1</a>.


It seems that the activation of the colon character by babel conflicts with the internal command names used by TeX4ht. So I tried to use \shorthandoff{:} immediately after loading babel, as is suggested here, to no effect.
I also installed the newest version of frenchb.ldf from http://daniel.flipo.free.fr/frenchb/ (mentioned in babel documentation) and used the documentation there to alleviate some other problems. But the command \noextrasfrench, again issued right after loading babel, did not help either.
Then I resorted to directly editing frenchb.ldf -- I commented out any occurence of \initiate@active@char and \declare@shorthand containing colons. This produces the correct results, but throws warnings like this one:

! Missing control sequence inserted.
<inserted text>
\inaccessible
l.6 \begin{document}


Besides, it's hardly a permanent solution. Any help would be appreciated.

When I was searching for the babel source code (in order to find the definitions of the commands used in frenchb.ldf), I stumbled upon the package babeltools, which seems to be made for my specific problem (and more). Adding \usepackage[shorthands=;!?]{babeltools} before loading babel successfully avoids activating the colon character (the others are also standard with francais and still work). htlatex returns a cryptic error message, which doesn't show up in batchmode and can apparently be ignored. On a side note, when searching for "babel deactivate colon", the second link that shows up points to babeltools -- for whatever reason I didn't come up with that exact combination of keywords before...