コード例 #1
0
 /// <summary>
 /// Adds a child to the children collection
 /// </summary>
 /// <param name="child">The child</param>
 public override void AddChild(SyntaxNode child)
 {
     if (child is TextSyntaxNode)
     {
         //when the node is root (no newline replacer) or something is messed up, we have to use a default newline (</p><p>)
         child.NewlineRepresentation = string.IsNullOrEmpty(NewlineRepresentation) ? Constants.Constants.CloseHtmlParagraph + Constants.Constants.OpenHtmlParagraph : NewlineRepresentation;
     }
     Children.Add(child);
 }
コード例 #2
0
 /// <summary>
 /// Adds a child to the children collection
 /// </summary>
 /// <param name="child">The child</param>
 public override void AddChild(SyntaxNode child)
 {
     if (child is TextSyntaxNode)
     {
         //when the node is root (no newline replacer) or something is messed up, we have to use a default newline (</p><p>)
         child.NewlineRepresentation = string.IsNullOrEmpty(NewlineRepresentation) ? Constants.Constants.CloseHtmlParagraph + Constants.Constants.OpenHtmlParagraph : NewlineRepresentation;
         //This means that we can also work with other text nodes here, but not when outputing, but we will also have to encode it, etc. and it's better to leave this job to
         //the TextSyntaxNode. The only exclusion is here, because of the parser specifics.
         (child as TextSyntaxNode).Text = (child as TextSyntaxNode).Text.Replace(Constants.Constants.CloseHtmlParagraph + Constants.Constants.OpenHtmlParagraph, "\n")
             .Replace(Constants.Constants.OpenHtmlParagraph, "")
             .Replace(Constants.Constants.CloseHtmlParagraph, "");
     }
     Children.Add(child);
 }
コード例 #3
0
 /// <summary>
 /// Adds a child to the children collection
 /// </summary>
 /// <param name="child">The child</param>
 public abstract void AddChild(SyntaxNode child);
コード例 #4
0
 public bool hasSameTags(SyntaxNode other)
 {
     if (other == null) return false;
     return this.Tag.Equals(other.Tag);
 }
コード例 #5
0
 /// <summary>
 /// Adds a child to the children collection. In the text syntax node children are not allowed
 /// </summary>
 /// <param name="child">The child</param>
 public override void AddChild(SyntaxNode child)
 {
     throw new NotSupportedException("You can't add children to a text syntax node!"); //the text syntax node doesn't have children
 }