Fix again what was supposed to be fixed in PR#14101.

The initial problem was, that the <li> elements for the JS-generated
TOC weren't placed inside <ul></ul>, but after it.
Merge pull request #16474 from eliasp/develop-fix-pr-14101

Fix again what was supposed to be fixed in PR#14101.