formatting: handle templates spans

Handle '}' in string templates correctly