This question is a follow-up to tex4ht: custom list of … (part 2 of 2)
I'm using htlatex to produce html on a one-subsection-per-page basis. I'm also using the technique described in the post linked above to produce a custom list of <things>. The two methods are, it appears, interfering with one another, as demonstrated in the following minimum working example.
mwe.tex
\documentclass{article}
\usepackage{figuredescriptions}
\begin{document}
\section{First section}
\subsection{subsection}
\figuredescription{Figure description needed: 9}
\figuredescription{Figure description needed: 10}
\subsection{another subsection}
\section{Second section}
section text
\subsection{a subsection}
subsection text
\listofdesc
\end{document}
ht-mwe.cfg
\Preamble{xhtml,3}
\begin{document}
\EndPreamble
figuredescriptions.sty
\ProvidesPackage{figuredescriptions}
\newcommand\printdescentry[1]{#1}
\newcommand{\figuredescription}[1]{\addcontentsline{desc}{subsection}{#1}\printdescentry{#1}}
\newcommand{\listofdesc}{\section{List of figure descriptions}\@starttoc{desc}}
\endinput
The file figuredescriptions.4ht is not necessary to demonstrate the problem.
Upon running the command
htlatex mwe.tex "ht-mwe.cfg"
then I receive the following output:
Notice that the 'minitoc' for section 2 is not correct.
I can get round this by not having a minitoc by using \Preamble{xhtml,3,nominitoc} but perhaps in the future I'd actually quite like a (correct!) minitoc on a per-section basis.
the question
How can I amend the code above so that minitocs on a per-section basis are correct in the html output?

