Fix multilined LaTeX within card templates

Fix issue 1935. The mungeQA method is passed a string that has been
stripped of newline characters in the "meat" of the card, but which can
still contain newlines in the templated part. Get mungeQA to handle this
properly; also, switch to case-insensitive matching for [latex] tags.