Exemplo n.º 1
0
 protected internal override void RenderNode(WordTemplateParameters p)
 {
     if (this.NodeProvider.IsParagraph(this.Parent) &&
         !this.Parent !.ChildElements.Any(a => BlockContainerNode.IsImportant(a, NodeProvider) && a != this))
     {
         this.Parent.Remove();
     }
Exemplo n.º 2
0
        T PopBlock <T>() where T : BlockContainerNode
        {
            if (stack.IsEmpty())
            {
                AddError(true, "No {0} has been opened".FormatWith(BlockContainerNode.UserString(typeof(T))));
                return(null);
            }

            BlockContainerNode n = stack.Pop();

            if (n == null || !(n is T))
            {
                AddError(true, "Unexpected '{0}'".FormatWith(BlockContainerNode.UserString(n?.GetType())));
                return(null);
            }

            variables = variables.Previous;
            return((T)n);
        }
Exemplo n.º 3
0
        T PeekBlock <T>() where T : BlockContainerNode
        {
            if (stack.IsEmpty())
            {
                AddError(true, "No {0} has been opened".FormatWith(BlockContainerNode.UserString(typeof(T))));
                return(null);
            }

            BlockContainerNode n = stack.Peek();

            if (n == null || !(n is T))
            {
                AddError(true, "Unexpected '{0}'".FormatWith(BlockContainerNode.UserString(n?.GetType())));
                return(null);
            }


            variables = variables.Previous;
            variables = new ScopedDictionary <string, ValueProviderBase>(variables);
            return((T)n);
        }
Exemplo n.º 4
0
 public BlockContainerNode(BlockContainerNode original) : base(original)
 {
 }
 public BlockContainerNode(BlockContainerNode original) : base(original) { }
Exemplo n.º 6
0
 void PushBlock(BlockContainerNode node)
 {
     stack.Push(node);
     variables = new ScopedDictionary <string, ValueProviderBase>(variables);
 }