replace hyphens and spaces with underscores in template names loaded from directory