Replace template variable using the new data variable name

@inner
@param {string} value the value to update
@param {Object} data the data variable name map, key is the old variable name,
value is the new variable name
@return {string} return the updated value
function replaceTemplateVariable(value, data) {
    return value.replace(/\{\{(.+)\}\}/g, (match, varName) => {
        varName = varName.trim();
        let newVarName = data[varName];
        if (newVarName) {
            return `{{${newVarName}}}`;
        }
        return match;
    });
}