Performs some clean up operations on Contao text elements