Calculator: use proper quoting of regex chars.

The old version clearly worked, but it was clunky and somewhat
inexplciable.  While reading up on something else, I discovered `perldoc
quotemeta` which resolves this in a much more predictable and correct
way.
Calculator: refactor the output preprocessing.

I think this makes it somewhat easier to follow the intent here.  We're
just trying to convert these two known strings into different output
formats, so wrapping that up seems like a good idea.
Calculator: superscripting for arbitrary terms.

This would be better with some proper parsing, but this resolves some
issues with the current HTML output, making it raise things to
arbitrarily high superscripting levels based on what it seems to look
like.
Merge pull request #508 from mwmiller/power_up

Calculator: improve exponent handling