Skip to content

Document template comment syntax #273

@TimMoore

Description

@TimMoore

Sometimes it's useful to put a comment into a template that is intended for template maintainers, and should not be included in the generated output.

It took a bit of searching around through StringTemplate documentation and experimentation to find a comment syntax that works: wrapping comments between $! and !$.

For example:

$! This comment won't appear in the output !$
// This comment will appear in the output
$!
This multiline comment won't appear either
No matter how
long it is

Internal $substitutions$ are ignored.

Even $invalid$ ones.

!$
/*
 * This comment is output and can contain $substitutions$
 */

If you generate using substitutions=variables that get substituted when the template is applied, results in:

// This comment will appear in the output
/*
 * This comment is output and can contain variables that get substituted when the template is applied
 */

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions