Fix missing quotes in template inheritance
Refactor breadcrumbs code

The _fixup_parents routine had got a bit messy due to multiple
incremental changes to try and sort out the mess of the parents
list.

Refactored to make the code simpler and hopefully also more robust.