Refactor and fix bugs in the breadcrumb template tag

The code in pombola/core/templatetags/breadcrumbs.py was difficult
to follow and had a number of bugs in it. These commits do an
incremental refactoring of this code to make it clearer and fix the
following issues:

* #1333
* #1334
* A possible XSS vulnerability