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