/// <summary>
        /// 初始化类<see cref="TemplateHtmlCodeAttribute"/>。
        /// </summary>
        /// <param name="name">属性名称。</param>
        /// <param name="value">属性值。</param>
        public TemplateHtmlCodeAttribute(string name, string value)
            : base(TemplateHtmlAttributeType.Code)
        {
            var index = name.IndexOf('-');

            if (index == -1)
            {
                Name = name;
            }
            else
            {
                Name          = name.Substring(0, index);
                AttributeName = name.Substring(index + 1);
            }
            value = value.Trim();
            var condition = new TemplateString(value);

            Value = condition.ReadUntil(':', '?');
            while (condition.CanRead)
            {
                _args.Add(condition.ReadUntil(':'));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化类<see cref="TemplateExpression"/>。
 /// </summary>
 /// <param name="expression">表达式字符串。</param>
 public TemplateExpression(string expression)
 {
     _expression = new TemplateString(expression.Trim());
 }