Hashes any non-block tags.

    Only the tags themselves are hashed -- the contains surrounded
    by tags are not touched. Indeed, there is no notion of "contained"
    text for non-block tags.

    Inline tags that are to be hashed are not white-listed, which
    allows users to define their own tags. These user-defined tags
    will also be preserved in their original form until the controller
    (see link.py) is applied to them.

def hash_tags(text, hashes):
    """Hashes any non-block tags.

    Only the tags themselves are hashed -- the contains surrounded
    by tags are not touched. Indeed, there is no notion of "contained"
    text for non-block tags.

    Inline tags that are to be hashed are not white-listed, which
    allows users to define their own tags. These user-defined tags
    will also be preserved in their original form until the controller
    (see link.py) is applied to them.
    """
    def sub(match):
        hashed = hash_text(match.group(0), 'tag')
        hashes[hashed] = match.group(0)
        return hashed
    return re_tag.sub(sub, text)