コード例 #1
0
        internal static MarkdownLine DotNetCommentsToLine(DotNetComment comment, DotNetMember parent = null)
        {
            MarkdownLine line = new MarkdownLine();

            if (comment is DotNetCommentQualifiedLinkedGroup && (comment.Tag == CommentTag.See || comment.Tag == CommentTag.SeeAlso))
            {
                line.Add(ToMDLink(comment as DotNetCommentQualifiedLinkedGroup, parent));
            }
            else if (comment is DotNetCommentText)
            {
                if (comment is DotNetCommentCodeBlock)
                {
                    //no action
                }
                else if (comment is DotNetCommentCode)
                {
                    line.Add(new MarkdownCode((comment as DotNetCommentCode).Text));
                }
                else
                {
                    string text = (comment as DotNetCommentText).Text;
                    line.Add(new MarkdownText(text));
                }
            }
            else if (comment is DotNetCommentQualifiedLink)
            {
                line.Add(ToMDLink(comment as DotNetCommentQualifiedLink, parent));
            }
            else if (comment is DotNetCommentParameterLink)            //paramref or typeparamref
            {
                line.Add(ToMDText(comment as DotNetCommentParameterLink));
            }

            return(line);
        }
コード例 #2
0
        internal static MarkdownList ToMDList(DotNetCommentList commentList, DotNetMember parent = null)
        {
            MarkdownList markdownList = new MarkdownList(isNumbered: commentList.IsNumbered);

            foreach (DotNetCommentListItem commentItem in commentList.Items)
            {
                MarkdownLine text = new MarkdownLine();
                if (commentItem.Term == null && commentItem.Description == null)
                {
                    markdownList.Add(text);
                    continue;
                }

                if (commentItem.Term == null)
                {
                    text = DotNetCommentGroupToMarkdownLine(commentItem.Description, parent);
                }
                else if (commentItem.Description == null)
                {
                    text = DotNetCommentGroupToMarkdownLine(commentItem.Term, parent);
                }
                else
                {
                    text = DotNetCommentGroupToMarkdownLine(commentItem.Term, parent);
                    text.Add(": ");
                    text.Concat(DotNetCommentGroupToMarkdownLine(commentItem.Description, parent));
                }
                markdownList.Add(text);
            }

            return(markdownList);
        }
コード例 #3
0
        /// <summary>
        /// Returns the first line of comments produced by the group.
        /// Intended for groups that boil down to a single line.
        /// </summary>
        internal static MarkdownLine DotNetCommentGroupToMarkdownLine(DotNetCommentGroup group, DotNetMember parent = null)
        {
            MarkdownLine line = new MarkdownLine();

            if (group == null)
            {
                return(line);
            }

            foreach (DotNetComment comment in group.Comments)
            {
                line.Concat(DotNetCommentsToLine(comment, parent));
            }
            return(line);
        }
コード例 #4
0
 internal static IMarkdownInSection DotNetCommentGroupToMarkdown(DotNetCommentGroup group, DotNetMember parent = null)
 {
     if (group.Tag == CommentTag.See || group.Tag == CommentTag.SeeAlso)
     {
         MarkdownLine line = new MarkdownLine();
         foreach (DotNetComment comment in group.Comments)
         {
             line.Concat(DotNetCommentsToLine(comment, parent));
         }
         return(line);
     }
     else
     {
         MarkdownParagraph paragraph = new MarkdownParagraph();
         foreach (DotNetComment comment in group.Comments)
         {
             DotNetCommentsFillParagraph(paragraph, comment, parent);
         }
         return(paragraph);
     }
 }