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.