Skip to content
This repository was archived by the owner on Mar 29, 2026. It is now read-only.

Creation of a custom tag  #81

Description

@TechWatching

I am doing json templating with mustache-sharp and I need to create a custom tag (#comma} to inject a comma after each elements of the json collection except the last one to respect json formatting.

Unfortunately, I don't really see how to do that using mustach-sharp. I guess I have to inherit from InlineTagDefinition but after I don't see how to do it :

I have been thinking to use my new template like that :
{{ #each Items}} {{ Name }} {{ #comma #index Items }} {{/each}}
It would allow me to have access to current index and length of my collection in order to know if a comma is needed or not but I am not sure if it is the correct way to think or even if it can work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions