/// <summary> /// 克隆当前元素到新的宿主模板 /// </summary> /// <param name="ownerTemplate"></param> /// <returns></returns> internal override DMEWeb_Element Clone(DMEWeb_Template ownerTemplate) { DMEWeb_VariableTag tag = new DMEWeb_VariableTag(ownerTemplate, (DMEWeb_VariableExpression)this.VarExpression.Clone(ownerTemplate)); foreach (var att in this.Attributes) { tag.Attributes.Add(att.Clone(ownerTemplate)); } foreach (DMEWeb_IExpression exp in this.CallFunctions) { tag.CallFunctions.Add(exp.Clone(ownerTemplate)); } return tag; }
/// <summary> /// 构建变量标签元素 /// </summary> /// <param name="ownerTemplate">宿主模板</param> /// <param name="container">标签的容器</param> /// <param name="match"></param> internal static DMEWeb_VariableTag CreateVariableTag(DMEWeb_Template ownerTemplate, DMEWeb_Tag container, Match match) { string prefix; DMEWeb_Variable variable = CreateVariable(ownerTemplate, match, out prefix); DMEWeb_VariableIdentity variableId = new DMEWeb_VariableIdentity(ownerTemplate, variable, prefix); //变量标签元素则需要缓存表达式的值 DMEWeb_VariableExpression varExp = CreateVariableExpression(variableId, match, true); DMEWeb_VariableTag tag = new DMEWeb_VariableTag(ownerTemplate, varExp); //解析属性列表 ParseElementAttributes(tag, match); container.AppendChild(tag); return tag; }