Пример #1
0
 /// <summary>
 /// Abstract base class for all markdown elements with one child element.
 /// </summary>
 /// <param name="Document">Markdown document.</param>
 /// <param name="Child">Child element.</param>
 public MarkdownElementSingleChild(MarkdownDocument Document, MarkdownElement Child)
     : base(Document)
 {
     if (Child is NestedBlock NestedBlock && NestedBlock.HasOneChild)
     {
         this.child = NestedBlock.FirstChild;
     }
        /// <summary>
        /// Abstract base class for all markdown elements with one child element.
        /// </summary>
        /// <param name="Document">Markdown document.</param>
        /// <param name="Child">Child element.</param>
        public MarkdownElementSingleChild(MarkdownDocument Document, MarkdownElement Child)
            : base(Document)
        {
            NestedBlock NestedBlock = Child as NestedBlock;

            if (NestedBlock != null && NestedBlock.HasOneChild)
            {
                this.child = NestedBlock.FirstChild;
            }
            else
            {
                this.child = Child;
            }
        }
Пример #3
0
 /// <summary>
 /// If the current object has same meta-data as <paramref name="E"/>
 /// (but not necessarily same content).
 /// </summary>
 /// <param name="E">Element to compare to.</param>
 /// <returns>If same meta-data as <paramref name="E"/>.</returns>
 public virtual bool SameMetaData(MarkdownElement E)
 {
     return(this.GetType() == E.GetType());
 }
Пример #4
0
 /// <summary>
 /// Prefixes a block of markdown.
 /// </summary>
 /// <param name="Output">Markdown will be output here.</param>
 /// <param name="Child">Child element.</param>
 /// <param name="PrefixFirstRow">Prefix, for first row.</param>
 /// <param name="PrefixNextRows">Prefix, for the rest of the rows, if any.</param>
 protected static void PrefixedBlock(StringBuilder Output, MarkdownElement Child, string PrefixFirstRow, string PrefixNextRows)
 {
     PrefixedBlock(Output, new MarkdownElement[] { Child }, PrefixFirstRow, PrefixNextRows);
 }
Пример #5
0
 /// <summary>
 /// Prefixes a block of markdown.
 /// </summary>
 /// <param name="Output">Markdown will be output here.</param>
 /// <param name="Child">Child element.</param>
 /// <param name="Prefix">Block prefix</param>
 protected static void PrefixedBlock(StringBuilder Output, MarkdownElement Child, string Prefix)
 {
     PrefixedBlock(Output, Child, Prefix, Prefix);
 }