Skip to content

[IDEA] pragma to assign variables by evaluating a filter expression #9391

@saqimtiaz

Description

@saqimtiaz

Currently the only way to assign a variable using a filter that can be imported elsewhere is to use nested $set widgets and the syntax is a frequent pitfall, especially in terms of understanding the requirements for nesting.

It is recommended to introduce a new pragma shorthand so that user can use set widgets to assign variables using a familiar syntax like procedures and functions.

Possible syntax:

\set myvar() [tag[HelloThere]]

or

\function-now myvar() [tag[HelloThere]]
\function-now myvar(daysPerYear:365) [tag<daysPerYear>]

equivalent to:
<$set name="myvar" filter="[tag[HelloThere]]"></$set>

The latter has the advantage of emphasizing the similarity with functions, the difference being when the execution of the filter happens.


Update:

  • Assign MVV as opposed to a title list
  • consider alternative syntax \let myvar= [tag[HelloThere]] for consistency with variable assignment in filter expressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions