Fix issue #3035: search highlighting broke URLs in some imported messages (Twitter)
Fix issue #3035: search highlighting broke URLs in some imported messages (Twitter)

Search highlighting was being done with a regex on raw HTML text, followed by a second regex undoing replacements within double-quoted attribute values.
This broke on imported Twitter messages, as the way we generate the markup uses single quotes on the attributes, which didn't get matched by the second regex.
I've replaced this do-then-undo cycle by dividing up the import HTML into freetext spans and tags; the freetext gets replaced, while the tags are left untouched.

UngPirat/freesocial,charlycoste/StatusNet,minmb/statusnet,charnimda/lgbtpzn-social,gnusocial/mainline,zh/statusnet,charnimda/lgbtpzn-social,zcopley/StatusNet,studio666/gnu-social,csarven/statusnet,chimo/social,eXcomm/gnu-social,furtherfield/gnu-social,d3vgru/StatusNet,charnimda/lgbtpzn-social,sikevux/bsk-social,sikevux/bsk-social,studio666/gnu-social,xebia/statusnet-oauth2,csarven/statusnet,bankonme/gnu-social,Piratas/tortuga,gnusocial/mainline,xebia/statusnet-oauth2,gnusocial/mainline,zh/statusnet,minmb/statusnet,UngPirat/freesocial,eXcomm/gnu-social,csarven/statusnet,Piratas/tortuga,sikevux/bsk-social,UngPirat/freesocial,zcopley/StatusNet,minmb/statusnet,Piratas/tortuga,chimo/social,sikevux/bsk-social,faulteh/gnu-social,faulteh/gnu-social,bankonme/gnu-social,bankonme/gnu-social,charlycoste/StatusNet,zcopley/zcopleys-statusnet-clone,zh/statusnet,furtherfield/gnu-social,faulteh/gnu-social,Piratas/tortuga,foocorp/gnu-social,eXcomm/gnu-social,furtherfield/gnu-social,furtherfield/gnu-social,bankonme/gnu-social,xebia/statusnet-oauth2,studio666/gnu-social,d3vgru/StatusNet,charlycoste/StatusNet,foocorp/gnu-social,studio666/gnu-social,d3vgru/StatusNet,gnusocial/mainline,zcopley/zcopleys-statusnet-clone,foocorp/gnu-social,csarven/statusnet,eXcomm/gnu-social,chimo/social,faulteh/gnu-social,zcopley/StatusNet,zcopley/zcopleys-statusnet-clone