Various code improvment:

- Avoid use of float('inf')
- Rename python_list2html_list to toc_list2html (more coherent)
- Rename variables in toc_list2html to be clearer
- Use document.replace('<p><<toc>></p>', html_toc, 1) in toc emit to limit replacement

Unit tests still fail in python2 (but pass with python3).