factored out duplicated code in [card] tag parsing