Exemple #1
0
        async Task WriteTable(string title, IEnumerable <ApiEntry> entries, ProgrammableBlockApi api, ApiEntry entry, MarkdownWriter writer)
        {
            var items = entries.ToList();

            if (items.Count == 0)
            {
                return;
            }
            await writer.WriteHeaderAsync(4, title);

            await writer.BeginTableAsync("Member", "Description");

            foreach (var item in items)
            {
                await writer.BeginTableCellAsync();

                await writer.WriteAsync(MemberGenerator.LinkTo(item.ToString(ApiEntryStringFlags.ParameterTypes), item));

                await writer.EndTableCellAsync();

                await writer.BeginTableCellAsync();

                var obsoleteAttribute = item.Member.GetCustomAttribute <ObsoleteAttribute>(false);
                if (obsoleteAttribute != null)
                {
                    await writer.BeginParagraphAsync();

                    if (string.IsNullOrWhiteSpace(obsoleteAttribute.Message))
                    {
                        await writer.WriteAsync(MarkdownInline.Emphasized(MarkdownInline.Strong("Obsolete")));
                    }
                    else
                    {
                        await writer.WriteAsync(MarkdownInline.Emphasized($"{MarkdownInline.Strong("Obsolete:")} {obsoleteAttribute.Message}"));
                    }
                    await writer.EndParagraphAsync();
                }

                var context = new XmlDocWriteContext(key => ResolveTypeReference(api, key));
                item.Documentation?.Summary?.WriteMarkdown(context, writer);

                if (entry != item.DeclaringEntry)
                {
                    await writer.BeginParagraphAsync();

                    await writer.WriteAsync(MarkdownInline.Emphasized($"Inherited from {MemberGenerator.LinkTo(item.DeclaringEntry.ToString(ApiEntryStringFlags.ShortDisplayName), item.DeclaringEntry)}"));

                    await writer.EndParagraphAsync();
                }

                await writer.EndTableCellAsync();
            }

            await writer.EndTableAsync();
        }