Conditional logic for code template
Posted: Mon May 23, 2016 5:58 pm
I've created a code template for use when authoring content. It does a nice job of prompting the user for a value, which is then wrapped in a specific element (which has a specific attribute).
I'd like to extend this so that the value of ${selection} is evaluated, and if this is not empty then we simply wrap the current selection. Only if there is no selection would we prompt the user for a value.
Can this be done? I'm using oXygen 17.1
Current Code:
Desired (pseudocode):
I'd like to extend this so that the value of ${selection} is evaluated, and if this is not empty then we simply wrap the current selection. Only if there is no selection would we prompt the user for a value.
Can this be done? I'm using oXygen 17.1
Current Code:
Code: Select all
<keyword otherprops="g.signal.name">${ask('Please provide the signal name.')}</keyword>
Code: Select all
if ($selection=="") {
<keyword otherprops="g.signal.name">${ask('Please provide the signal name.')}</keyword>
} else {
<keyword otherprops="g.signal.name">${selection}</keyword>
}