mustache-sharp icon indicating copy to clipboard operation
mustache-sharp copied to clipboard

Help creating custom tag

Open skedlyio opened this issue 5 years ago • 1 comments

First, let me say I'm loving this project. However, I'm finding it hard to get help creating a custom tag. The docs are a little light as are the tests. Generally speaking, I think many people would benefit from more docs and tests.

My specific need right now is creating a custom tag that would render a random element. So, my template would be:

<speak> <p> <s> {{#Random}} {{#Voice}} Phrase one {{/Voice}} {{#Voice}} Phrase two {{/Voice}} {{/Random}} </s> </p> </speak>

As you can see, I'm creating html, more specifically ssml for an Alexa skill.

I've found examples of FirstOf that takes the first element of a collection of strings. But I don't want my tag to be collection-type aware; it should render one of its child elements allowing me to use whatever nested-structure I choose.

Any help much appreciated

skedlyio avatar Jun 07 '19 08:06 skedlyio

Did you ever figure this out?

johnkamau avatar Apr 30 '21 12:04 johnkamau