maybe have a look to this thread:
I’d suggest to read the post and check the template parser on GitHub
I combinend the great work from @dchar with another action to use the template parser in the same action here.