Ejemplo n.º 1
0
 protected virtual WikiElement AppendChild(WikiNode node)
 {
     node.SetParent (this);
     _children.Add (node);
     if (node as WikiElement == null)
         return this;
     return node as WikiElement;
 }
Ejemplo n.º 2
0
 public virtual WikiElement Add(WikiNode node)
 {
     if (CanContain (node)) {
         return AppendChild (node);
     } else {
         return _parent.Add (node);
     }
 }
Ejemplo n.º 3
0
        protected override WikiElement AppendChild(WikiNode node)
        {
            if (!(node is WikiListItemElement))
                throw new Exception ();

            node.SetParent (this);
            _children.Add (node);
            return this;
        }
Ejemplo n.º 4
0
 public override WikiElement Add(WikiNode node)
 {
     if (node is WikiTextNode)
         return base.Add (node);
     if (node is WikiListItemElement || (node is WikiListContainer && (node as WikiListContainer).Indent <= this.Indent))
         return _parent.Add (node);
     if (node is WikiListContainer)
         return base.Add (node);
     throw new Exception ();
 }
Ejemplo n.º 5
0
        public override WikiElement Add(WikiNode node)
        {
            if (node is WikiListItemElement || node is WikiListContainer) {
                WikiIndentedElement other = node as WikiIndentedElement;
                if (other.Indent < this.Indent)
                    return _parent.Add (node);
                if (node is WikiListItemElement) {
                    if (other.Indent == this.Indent)
                        return this.AppendChild (node);
                    throw new Exception ();
                }
                if (node is WikiListContainer && other.Indent == this.Indent)
                    return _parent.Add (node);
                if (other.Indent != this.Indent + 1)
                    throw new Exception ();
            }

            if (_children.Count == 0)
                AppendChild (new WikiListItemElement (_indent, _isRel));
            return (_children[_children.Count - 1] as WikiListItemElement).Add (node);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 引数に指定されたノードを子供に含められるかどうか判定します
 /// </summary>
 public virtual bool CanContain(WikiNode node)
 {
     return true;
 }