Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend 'separators' that are supported in join blocks #710

Open
OliverTod opened this issue Dec 16, 2021 · 0 comments
Open

Extend 'separators' that are supported in join blocks #710

OliverTod opened this issue Dec 16, 2021 · 0 comments

Comments

@OliverTod
Copy link

OliverTod commented Dec 16, 2021

At the moment, a simple separator can be set by the user that will be inserted between all values in an array when populating a template.

So, for example:

TemplateMark: Discount applies to the following items: {{#join items separator=", "}}{{name}} ({{id}}){{/join}}

will accept an array of
{{"name": "Pineapple", "id": 111}, {"name": "Strawberries", "id": 222}, {"name": "Pomegranate", "id": 333}}

to give:
Discount applies to the following items: Pineapple (111), Strawberries (222), Pomegranate (333)

Each list item is separated by a comma.

Request: There should be support for specifically setting the standard, penultimate and final separators. This is already done in other doc generation tools which use the | symbol is used to indicate the punctuation as "list item | penultimate item | final item"

Example syntax:
;|; and|.

So, the example above with the new functionality would be:

TemplateMark: Discount applies to the following items: {{#join items separator=",|and|. "}}{{name}} ({{id}}){{/join}}.

will accept an array of
{{"name": "Pineapple", "id": 111}, {"name": "Strawberries", "id": 222}, {"name": "Pomegranate", "id": 333}}

to give:
Discount applies to the following items: Pineapple (111), Strawberries (222) and Pomegranate (333).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant