Strip trailing whitespace in pombola/core/templatetags/breadcrumbs.py
Test a special case in the breadcrumbs template tag for Hansard URLs
Simplify the path extraction in the breadcrumbs template tag
Return early in the case of an empty path

This reduces the indentation of the rest of the code and gets that
case out of the way.
Strip out any empty breadcrumb elements earlier

This removes a later conditional, reducing indentation and making
it clearer.
Factor out code to wrap test snippets in <li>s with internal separators

This means that the main loop in the breadcrumbs filter only has to
worry about producing a list of the HTML for each breadcrumb element,
and not inserting separators.

Note that this also changes one of the tests: one of the tests had
inconsistent whitespace (two spaces instead of one) so this fixes that
too.
Use set instead of dict to indicate intended usage clearly
Remove unnecessary and error-prone book-keeping
Add a comment and reverse the if / else sense for clarity
Factor out the functionality that links some text if possible
Add a FIXME for some possibly unnecessary code
Remove unnecessary parentheses
Factor out the code that removes unnecessary breadcrumb elements
This_url may be needed if a coordinate isn't the last element

Fixes #1334
Remove duplicate setting of this_url
The "bread" variable is unnecessary
Add a helpful comment
Factor out the code to make the element into something presentable
Add some more comments
Fix a potential (but probably difficult to do) XSS attack

Text in the URL was being emitted back into the page (after being
somewhat transformed) by the breadcrumb generation code.  For example,
if you included '<b>' in the URL it would make some part of the text
of the returned page in bold text.  This isn't obviously exploitable,
since the transformations (splitting on slashes, title-casing, etc.)
make it difficult either to include a script from a URL on another
site or include some malicious Javascript directly in a <script> tag.

However, this is by no means assured, and instead we should correctly
escape the text used in breadcrumbs before including them in the
returned page - this commit introduces that change.