DOM-based link prefix / trail escaping

We used to have a hack based on serializer output, but now we are able to look
behind / ahead on the DOM to figure this out.

This patch adds DOM-based escaping. It can be further improved to handle
non-serializing tags too, but for now it should handle realistic use cases.

Example test case fixed with this patch:
echo '<a rel="mw:WikiLink" href="apple">apple</a>s' | node parse --html2wt
[[apple]]<nowiki/>s

New parser tests for this are submitted in I53289110.

Bug: 33091
Change-Id: I627dd609d4eb00080c61628306ad8c3aea7a9077
Merge "DOM-based link prefix / trail escaping"