예제 #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);
        }