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

Add a syntax to fetch a variable based on a string name #283

Open
bob2517 opened this issue Sep 22, 2022 · 4 comments
Open

Add a syntax to fetch a variable based on a string name #283

bob2517 opened this issue Sep 22, 2022 · 4 comments
Assignees
Labels
docs to do Documentation still needs doing before this can get released enhancement New feature or request

Comments

@bob2517
Copy link
Member

bob2517 commented Sep 22, 2022

Currently variables written directly in HTML looks like this: {$varname}. A need has arisen for there to be an additional syntax for fetching a variable based on a string name. An old programming term for that is "variable substitution".

Something like {${$varnameString}} and {${"varname"}}.

The inner parentheses, or whatever it ends up being, would be needed in case this was needed: {${$obj.varName}}.

This would then spill over into the syntax for if statements, etc., and look like ${$varnameString} and ${"varname"}.

It would also need to work like that in run command JS blocks and {= =} JS expressions.

@bob2517 bob2517 added the enhancement New feature or request label Sep 22, 2022
@bob2517 bob2517 self-assigned this Sep 22, 2022
@bob2517 bob2517 changed the title Add an HTML syntax to fetch a variable based on a string name Add a syntax to fetch a variable based on a string name Sep 22, 2022
@bob2517
Copy link
Member Author

bob2517 commented Oct 6, 2022

Needs to work like lodash _get() and handle complex paths, like the new getVar() helper function.

@bob2517
Copy link
Member Author

bob2517 commented Jan 21, 2024

On review this has come up several times in development scenarios, so worth doing.

@bob2517 bob2517 added the in progress This issue is currently being worked on label Jan 21, 2024
@bob2517
Copy link
Member Author

bob2517 commented Jan 21, 2024

Note to self: There is a helper function in the docs called getVar for use in JS expressions which gets a variable value based on a path. The new syntax would be a native ACSS equivalent for use in non JS commands.

@bob2517
Copy link
Member Author

bob2517 commented Jan 21, 2024

Do this for attribute references too, as in #304

@bob2517 bob2517 removed the in progress This issue is currently being worked on label Jan 21, 2024
@bob2517 bob2517 added this to the 2.16.0 milestone Jan 21, 2024
@bob2517 bob2517 added the docs to do Documentation still needs doing before this can get released label Jan 21, 2024
@bob2517 bob2517 removed this from the 2.16.0 milestone Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs to do Documentation still needs doing before this can get released enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant