Пример #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;
 }
Пример #2
0
 public virtual WikiElement Add(WikiNode node)
 {
     if (CanContain (node)) {
         return AppendChild (node);
     } else {
         return _parent.Add (node);
     }
 }
Пример #3
0
        protected override WikiElement AppendChild(WikiNode node)
        {
            if (!(node is WikiListItemElement))
                throw new Exception ();

            node.SetParent (this);
            _children.Add (node);
            return this;
        }
Пример #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 ();
 }
Пример #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);
        }
Пример #6
0
 /// <summary>
 /// 引数に指定されたノードを子供に含められるかどうか判定します
 /// </summary>
 public virtual bool CanContain(WikiNode node)
 {
     return true;
 }