fix for efficiency and accuracy.
fix for efficiency and accuracy.

the first loop was going through every single tag, and the second loop
that was nested in it was going through every paragraph. in the process
it was missing nested tags if they registered later by replacing their
shorter versions in paragraphs. now the first loop runs once to figure
out every tag all at once, and then goes through each paragraph on the
page.

merenlab/web,merenlab/web,merenlab/web,merenlab/web,merenlab/web,merenlab/web