Example #1
0
        public void PopContext()
        {
            var c = Context;

            Context = Stack.Pop();
            if (c.ParentHolder != null)
            {
                if (Context.Nesting)
                {
                    Context.ChildLogger = c.Logger;
                    Context.Holders     = TemplatorUtil.MergeHolders(Context.Holders, c.Holders.Values);
                }
                else
                {
                    c.ParentHolder.Children = TemplatorUtil.MergeHolders(c.ParentHolder.Children, c.Holders.Values);
                }
            }
            if (Context.NestingBefore)
            {
                Context.ChildResultBefore.Append(c.Result);
            }
            else if (Context.NestingAfter)
            {
                Context.ChildResultAfter.Append(c.Result);
            }
            else
            {
                AppendResult(c.Result);
            }
        }
Example #2
0
 private void CollectHolderResults(string mergeInto = null)
 {
     if (StackLevel > 0)
     {
         var cleared = _clearedSyntaxError;
         //this is an additional check, dont increase errors
         if (!Xml)
         {
             //xml has to be checked as as plain text but it does not have to have a collection end tag as plain text template
             LogSyntaxError("Collection Level not cleared: levels at {0}, possibly missing end holder of a collection/repeat holder, or missed StartOver()", StackLevel);
         }
         _clearedSyntaxError = cleared;
     }
     TemplatorUtil.MergeHolders(Holders, Context.Holders.Values, mergeInto);
 }
Example #3
0
 public object GetInputValue(string key, object defaultRet = null, int seekup = 0)
 {
     return(TemplatorUtil.GetInputValue(this, key, Context.Input, defaultRet, seekup));
 }
Example #4
0
 public T GetValue <T>(TextHolder key, T defaultRet = default(T), int seekUp = 0)
 {
     return(TemplatorUtil.GetValue(this, key, Context.Input, defaultRet).SafeConvert(default(T), Config.DateFormat));
 }
Example #5
0
 public IDictionary <string, object>[] GetChildInputs(string key)
 {
     return(TemplatorUtil.GetChildCollection(Context.Input, key, Config));
 }