alterTemplate - PeterNaydenov/code-assembly-line GitHub Wiki
Change placeholder names for template during execution of "run" method. Use it instead reshape much larger existing data-structure.
Fields
{
do : 'alterTemplate'
, tpl : tplName
, data : changes
}
Types
- tpl: string. Template name
- changes: { existingPlaceholder : newPlaceholder }
- existingPlaceholder: string. Existing in template placeholder name.
- newPlaceholder: string. Change placeholder name to 'newPlaceholder'.
Example
{ do: 'alterTemplate', data: {text:user} }
If current-data has items like { user: 'Peter' } and template is 'Hello, {{txt}}'. The 'alterTemplate' process-step will change template placeholder from 'txt' to 'user'. Template will become: 'Hello, {{user}}'. The 'alterTemplate' process-step could be much more efficient then 'alter' if data is too big.
NOTE: AlterTemplate will NOT change template. Altering template placeholders has scope current 'run' process.