To avoid duplicating the work of others, it looks like there's some useful information
here from Hadrien from Feedbooks, who generates ebooks with LaTeX. It appears he uses a modified version of
this html2latex tool for part of the task, so it might be a place to start.