JavaScript template parsing for wikicode, highly flammable and written at 2 in the morning