${expand(...)} editor variable
Posted: Mon Dec 06, 2021 6:11 pm
Hi,
right now, oXygen allows to set user-defined editor variables in a
global or project-specific scope, e.g. ${myvar}. And it throws an
exception, when trying to access an editor variable, that was not
initialized (set). It would be cool, to have an editor variable (or a
function) that would try to get a variable by name and if that
variable was not initialized, a default value would be
returned. Having such a variable (or function) would greatly leverage
framework writing, because it would enable us to write parametrizable
author actions, thus more generic frameworks.
The thing I have in mind would be something like,
and would expand to the value of the variable called VARIABLE_NAME if
that variable is present, and to DEFAULT, if that variable is not
present.
An alternative improvement would be, to enable shipping variable
initialization along with a framework, while also allowing to override
such variables by setting them again (be it in a global or
project-specific way).
Could you imagine, adding such a feature? Or are there simple
alternatives?
Regards,
Chris
right now, oXygen allows to set user-defined editor variables in a
global or project-specific scope, e.g. ${myvar}. And it throws an
exception, when trying to access an editor variable, that was not
initialized (set). It would be cool, to have an editor variable (or a
function) that would try to get a variable by name and if that
variable was not initialized, a default value would be
returned. Having such a variable (or function) would greatly leverage
framework writing, because it would enable us to write parametrizable
author actions, thus more generic frameworks.
The thing I have in mind would be something like,
Code: Select all
${expand(VARIABLE_NAME, DEFAULT)}
that variable is present, and to DEFAULT, if that variable is not
present.
An alternative improvement would be, to enable shipping variable
initialization along with a framework, while also allowing to override
such variables by setting them again (be it in a global or
project-specific way).
Could you imagine, adding such a feature? Or are there simple
alternatives?
Regards,
Chris