Пример #1
0
        private MarkdownFile GenerateTableOfContents(DotNetDocumentationFile xmlDocumentation, DotNetQualifiedClassNameTreeNode node)
        {
            List <DotNetType>     types      = xmlDocumentation.Types.Where(t => t.Name.FullNamespace == node.Value).ToList();
            List <DotNetDelegate> _delegates = xmlDocumentation.Delegates.Where(d => d.Name.FullNamespace == node.Value).ToList();

            MarkdownFile markdown = new MarkdownFile();
            string       header   = "Contents of " + node.Value.FullName;

            if (node.Parent != null)
            {
                header = String.Format("Contents of [{0}]({1}).{2}", node.Parent.Value.FullName, TableOfContentsFilename(node.Parent.Value), node.Value.LocalName);
            }

            MarkdownSection section = markdown.AddSection(header);

            if (node.Children.Count > 0)
            {
                MarkdownSection childNamespacesSection = section.AddSection("Namespaces");
                foreach (DotNetQualifiedClassNameTreeNode child in node.Children)
                {
                    section.AddInLine(new MarkdownInlineLink(MarkdownText.Bold(child.Value.FullName), TableOfContentsFilename(child.Value)));
                }
            }

            AddTableOfContentsSection(section, "Concrete Types", types.Where(t => t.Category == TypeCategory.Normal).ToList());
            AddTableOfContentsSection(section, "Static Types", types.Where(t => t.Category == TypeCategory.Static).ToList());
            AddTableOfContentsSection(section, "Abstract Types", types.Where(t => t.Category == TypeCategory.Abstract).ToList());
            AddTableOfContentsSection(section, "Interfaces", types.Where(t => t.Category == TypeCategory.Interface).ToList());
            AddTableOfContentsSection(section, "Enums", types.Where(t => t.Category == TypeCategory.Enum).ToList());
            AddTableOfContentsSection(section, "Structs", types.Where(t => t.Category == TypeCategory.Struct).ToList());
            AddTableOfContentsSection(section, "Delegates", _delegates);
            AddTableOfContentsSection(section, "Exceptions", types.Where(t => t.Category == TypeCategory.Exception).ToList());

            return(markdown);
        }
Пример #2
0
        private void AddTableOfContentsSection(MarkdownSection parent, string header, List <DotNetDelegate> _delegates)
        {
            if (_delegates.Count == 0)
            {
                return;
            }

            MarkdownSection section = parent.AddSection(header);

            foreach (DotNetDelegate _delegate in _delegates.OrderBy(t => t.Name.LocalName))
            {
                section.AddInLine(new MarkdownInlineLink(MarkdownText.Bold(_delegate.Name.LocalName), FormatFilename(_delegate.Name.FullName + Ext.MD)));
                section.Add(ConvertDotNet.DotNetCommentGroupToMarkdown(_delegate.SummaryComments, _delegate));
                section.Add(new MarkdownLine());
            }
        }