Add value increment variable and macros
This commit is contained in:
parent
fae90f8227
commit
ebcefe67fc
|
@ -59,8 +59,12 @@
|
|||
<ul>
|
||||
<li><tt>{{getvar::name}}</tt> – replaced with the value of the local variable "name"</li>
|
||||
<li><tt>{{setvar::name::value}}</tt> – replaced with empty string, sets the local variable "name" to "value"</li>
|
||||
<li><tt>{{addvar::name::increment}}</tt> – replaced with the result of addition numeric value of "increment" to the local variable "name"</li>
|
||||
<li><tt>{{addvar::name::increment}}</tt> – replaced with empty strings, adds a numeric value of "increment" to the local variable "name"</li>
|
||||
<li><tt>{{incvar::name}}</tt> – replaced with the result of the increment of value of the variable "name" by 1</li>
|
||||
<li><tt>{{decvar::name}}</tt> – replaced with the result of the decrement of value of the variable "name" by 1</li>
|
||||
<li><tt>{{getglobalvar::name}}</tt> – replaced with the value of the global variable "name"</li>
|
||||
<li><tt>{{setglobalvar::name::value}}</tt> – replaced with empty string, sets the global variable "name" to "value"</li>
|
||||
<li><tt>{{addglobalvar::name::value}}</tt> – replaced with the result of addition numeric value of "increment" to the global variable "name"</li>
|
||||
<li><tt>{{addglobalvar::name::value}}</tt> – replaced with empty string, adds a numeric value of "increment" to the global variable "name"</li>
|
||||
<li><tt>{{incglobalvar::name}}</tt> – replaced with the result of the increment of value of the global variable "name" by 1</li>
|
||||
<li><tt>{{decglobalvar::name}}</tt> – replaced with the result of the decrement of value of the global variable "name" by 1</li>
|
||||
</ul>
|
||||
|
|
|
@ -141,6 +141,18 @@ export function replaceVariableMacros(input) {
|
|||
return '';
|
||||
});
|
||||
|
||||
// Replace {{incvar::name}} with empty string and increment the variable name by 1
|
||||
line = line.replace(/{{incvar::([^}]+)}}/gi, (_, name) => {
|
||||
name = name.trim();
|
||||
return incrementLocalVariable(name);
|
||||
});
|
||||
|
||||
// Replace {{decvar::name}} with empty string and decrement the variable name by 1
|
||||
line = line.replace(/{{decvar::([^}]+)}}/gi, (_, name) => {
|
||||
name = name.trim();
|
||||
return decrementLocalVariable(name);
|
||||
});
|
||||
|
||||
// Replace {{getglobalvar::name}} with the value of the global variable name
|
||||
line = line.replace(/{{getglobalvar::([^}]+)}}/gi, (_, name) => {
|
||||
name = name.trim();
|
||||
|
@ -161,6 +173,18 @@ export function replaceVariableMacros(input) {
|
|||
return '';
|
||||
});
|
||||
|
||||
// Replace {{incglobalvar::name}} with empty string and increment the global variable name by 1
|
||||
line = line.replace(/{{incglobalvar::([^}]+)}}/gi, (_, name) => {
|
||||
name = name.trim();
|
||||
return incrementGlobalVariable(name);
|
||||
});
|
||||
|
||||
// Replace {{decglobalvar::name}} with empty string and decrement the global variable name by 1
|
||||
line = line.replace(/{{decglobalvar::([^}]+)}}/gi, (_, name) => {
|
||||
name = name.trim();
|
||||
return decrementGlobalVariable(name);
|
||||
});
|
||||
|
||||
lines[i] = line;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue