Skip to content

OPG-496: Update docs with template variable syntax #1045

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

Merged

Conversation

synqotik
Copy link
Contributor

@synqotik synqotik commented Apr 3, 2025

Template variable interpolation syntax rules have changed somewhat in OPG v9. To reduce ambiguity in parsing, you can only use $variable syntax if the variable is surrounded by whitespace, or at least ends in whitespace.

If the variable is part of a contiguous "word", users need to use the ${variable} syntax. Therefore some constructs that were valid in OPG v8 and before are no longer valid in v9.

Examples - if there is a template variable node:

Valid: $node
Valid (but not preferred): index_$node
Valid (preferred): index_${node}
Invalid: $node_index (this will be an error since OPG interprets this as the template variable node_index)
Valid: ${node}_index

This PR just updates some documentation to explain this syntax.

External References

@github-actions github-actions bot added the docs label Apr 3, 2025
@synqotik synqotik requested a review from dino2gnt April 3, 2025 18:27
@dino2gnt
Copy link

dino2gnt commented Apr 3, 2025

The table in your PR comment:

Valid (but not preferred): index_$node
Valid (preferred): index_${node}
Invalid: $node_index (this will be an error since OPG interprets this as the template variable node_index)
Valid: ${node}_index

...would be a great addition to the actual documentation.

@synqotik
Copy link
Contributor Author

synqotik commented Apr 3, 2025

The table in your PR comment:
...would be a great addition to the actual documentation.

good idea, will do!

Copy link

sonarqubecloud bot commented Apr 3, 2025

@synqotik
Copy link
Contributor Author

synqotik commented Apr 3, 2025

@dino2gnt added a "truth table" :D

Copy link

@dino2gnt dino2gnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

@synqotik synqotik merged commit b978dfe into release-9.x Apr 3, 2025
12 checks passed
@synqotik synqotik deleted the jira/OPG-496-update-docs-with-template-variable-syntax branch April 3, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants