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();
     }
Exemple #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);
        }
Exemple #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);
        }
Exemple #4
0
 public BlockContainerNode(BlockContainerNode original) : base(original)
 {
 }
 public BlockContainerNode(BlockContainerNode original) : base(original) { }
Exemple #6
0
 void PushBlock(BlockContainerNode node)
 {
     stack.Push(node);
     variables = new ScopedDictionary <string, ValueProviderBase>(variables);
 }