bugid: 52072 -- insert a newline before an explicit HTML tag only if it ...

...does not follow an explicit HTML tag or parser hook tag

The reverse parser could not recognize parser hooks, which appear as their own externally defined HTML tags (e.g. <staff>). It was treating them as <p> tags, and therefore inserting newlines in weird places -- namely, in cases where an explicit HTML tag followed it.

Here, we introduce flat array storage for DOM nodes iterated over and their individual outputs, so that we can match up a node with its output later on. In this way, we can extract <p> tags that have had their text output reverse-parsed to the appropriate child tag as its text, since we remove <p> tags and treat the contents like raw wikitext (e.g. <p><staff/></p> --> <staff/>).

So now, we only insert a newline before overt HTML in source if the previous sibling fails a match for the hooks that have been registered in the parser.