BaseExtensions can be used to scan through a document and perform a search-and-replace on all content control tags that match criteria defined in parameters.
The feature will most commonly be for internal use, and not an end user. The feature could be used for moving from Templafy bindings to our DocumentData bindings. In other cases, it can also be from Templafy binding to Templafy binding in a document where bindings appear lots of times in content control tags.
CMD
<Cmd case="BaseExtensions:search-replace-cc-tag" toSearchStart="x" toSearchEnd="x" toReplaceStart="x" toReplaceEnd="x" />
Parameters
The parameters in above command can be used to define a range to search for in the beginning and in the end of the content control tag, leaving a range in the middle to remain untouched.
Besides parameters being pretty self-explanatory, below example serves to illustrate how to use the feature to switch from Templafy bindings to DocumentData bindings.
Example of usage
Be aware that certain characters may need escaping in XML. Colors are for didactic reasons.
<Cmd case="BaseExtensions:search-replace-cc-tag" toSearchStart="{"templafy":{"visibility":{"action":"delete","compareValue":"Yes","binding":"Form." toSearchEnd="","operator":"NotEquals"},"type":"group"}}" toReplaceStart="{"SkabelonDesign":{"type":"group","visibility":{"action":"keep","binding":"Doc.Prop.Form." toReplaceEnd="","operator":"Equals","compareValues":["Yes"]}}}" />
This will perform the following search/replace, leaving the variable in the middle untouched:
Search
{"templafy":{"visibility":{"action":"delete","compareValue":"Yes","binding":"Form. CFS_CDDbuyside.CFS-CDDbuyside ","operator":"NotEquals"},"type":"group"}}
Replace
{"SkabelonDesign":{"type":"group","visibility":{"action":"keep","binding":"Doc.Prop.Form. CFS_CDDbuyside.CFS-CDDbuyside ","operator":"Equals","compareValues":["Yes"]}}}
Comments
0 comments
Article is closed for comments.