예제 #1
0
        public static IRtTag AddExpression(IRtConnector creator, string expresionFull, IRtTagOptions options = null)
        {
            MatchCollection matches = rgx.Matches(expresionFull);

            if (matches.Count > 0)
            {
                string expresion     = expresionFull;
                int    i             = 0;
                var    argumentsTags = new IRtTag[matches.Count];
                foreach (Match match in matches)
                {
                    var tagDefinition = match.Value.Trim().TrimStart('{').TrimEnd('}');
                    argumentsTags[i] = creator.AddTagDefinition(tagDefinition, options);
                    expresion        = expresion.Replace(match.Value, $"arg{i}");
                    i++;
                }
                return(new RtTagExpression(expresionFull, expresion, argumentsTags));
            }
            else if (expresionFull.StartsWith("="))
            {
                return(new RtTagExpression(expresionFull, expresionFull, null));
            }
            else
            {
                return(creator.AddTagDefinition(expresionFull, options));
            }
        }
 public static RtTagType <TValue> AddTagDefinition <TValue>(this IRtConnector conn, string tagDefinition, IRtTagOptions options = null)
 {
     return(new RtTagType <TValue>(conn.AddTagDefinition(tagDefinition, options)));
 }