Implement support for formatting arrays in macro strings

fixes #7262