diff --git a/src/Doki.Abstractions/AssemblyDocumentation.cs b/src/Doki.Abstractions/AssemblyDocumentation.cs index b1f5197..e6fa0a6 100644 --- a/src/Doki.Abstractions/AssemblyDocumentation.cs +++ b/src/Doki.Abstractions/AssemblyDocumentation.cs @@ -34,6 +34,6 @@ public NamespaceDocumentation[] Namespaces public AssemblyDocumentation() { - Content = DocumentationContentType.Assembly; + ContentType = DocumentationContentType.Assembly; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/CodeBlock.cs b/src/Doki.Abstractions/CodeBlock.cs index ed4ac10..14628d7 100644 --- a/src/Doki.Abstractions/CodeBlock.cs +++ b/src/Doki.Abstractions/CodeBlock.cs @@ -17,6 +17,6 @@ public sealed record CodeBlock : DocumentationObject public CodeBlock() { - Content = DocumentationContentType.CodeBlock; + ContentType = DocumentationContentType.CodeBlock; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/DocumentationObject.cs b/src/Doki.Abstractions/DocumentationObject.cs index 34041ee..2012a65 100644 --- a/src/Doki.Abstractions/DocumentationObject.cs +++ b/src/Doki.Abstractions/DocumentationObject.cs @@ -18,7 +18,7 @@ public abstract record DocumentationObject /// /// Gets the content type of the documentation object. /// - public DocumentationContentType Content { get; protected set; } + public DocumentationContentType ContentType { get; protected init; } protected DocumentationObject() { @@ -30,6 +30,6 @@ protected DocumentationObject(DocumentationObject obj) Id = obj.Id ?? throw new ArgumentException("DocumentationObject.Id cannot be null.", nameof(obj)); Parent = obj.Parent; - Content = obj.Content; + ContentType = obj.ContentType; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/DocumentationObjectExtensions.cs b/src/Doki.Abstractions/DocumentationObjectExtensions.cs index 0d6ee0c..41b875e 100644 --- a/src/Doki.Abstractions/DocumentationObjectExtensions.cs +++ b/src/Doki.Abstractions/DocumentationObjectExtensions.cs @@ -10,7 +10,7 @@ public static class DocumentationObjectExtensions var parent = obj.Parent; while (parent != null) { - if (parent is T t && (expectedContent == null || t.Content == expectedContent)) return t; + if (parent is T t && (expectedContent == null || t.ContentType == expectedContent)) return t; parent = parent.Parent; } diff --git a/src/Doki.Abstractions/DocumentationRoot.cs b/src/Doki.Abstractions/DocumentationRoot.cs index 366b835..eeae878 100644 --- a/src/Doki.Abstractions/DocumentationRoot.cs +++ b/src/Doki.Abstractions/DocumentationRoot.cs @@ -15,6 +15,6 @@ public AssemblyDocumentation[] Assemblies public DocumentationRoot() { Id = "root"; - Content = DocumentationContentType.Root; + ContentType = DocumentationContentType.Root; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/Link.cs b/src/Doki.Abstractions/Link.cs index f6f36ec..8c92646 100644 --- a/src/Doki.Abstractions/Link.cs +++ b/src/Doki.Abstractions/Link.cs @@ -17,6 +17,6 @@ public sealed record Link : DocumentationObject public Link() { - Content = DocumentationContentType.Link; + ContentType = DocumentationContentType.Link; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/NamespaceDocumentation.cs b/src/Doki.Abstractions/NamespaceDocumentation.cs index d718bbc..7fd3f4c 100644 --- a/src/Doki.Abstractions/NamespaceDocumentation.cs +++ b/src/Doki.Abstractions/NamespaceDocumentation.cs @@ -16,6 +16,6 @@ public TypeDocumentation[] Types public NamespaceDocumentation() { - Content = DocumentationContentType.Namespace; + ContentType = DocumentationContentType.Namespace; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/TextContent.cs b/src/Doki.Abstractions/TextContent.cs index 0219084..1eec99a 100644 --- a/src/Doki.Abstractions/TextContent.cs +++ b/src/Doki.Abstractions/TextContent.cs @@ -12,6 +12,6 @@ public sealed record TextContent : DocumentationObject public TextContent() { - Content = DocumentationContentType.Text; + ContentType = DocumentationContentType.Text; } } \ No newline at end of file diff --git a/src/Doki.Abstractions/XmlDocumentation.cs b/src/Doki.Abstractions/XmlDocumentation.cs index 6164df5..23f4d58 100644 --- a/src/Doki.Abstractions/XmlDocumentation.cs +++ b/src/Doki.Abstractions/XmlDocumentation.cs @@ -16,6 +16,6 @@ public DocumentationObject[] Contents public XmlDocumentation() { - Content = DocumentationContentType.Xml; + ContentType = DocumentationContentType.Xml; } } \ No newline at end of file diff --git a/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs b/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs index 0774af9..9c548a2 100644 --- a/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs +++ b/src/Doki.Output.ClassLibrary/ClassLibraryOutput.cs @@ -80,7 +80,7 @@ private static void BuildAssemblyDocumentation(AssemblyDocumentation assemblyDoc FileName = "{{assemblyDocumentation.FileName}}", Version = "{{assemblyDocumentation.Version}}", PackageId = "{{assemblyDocumentation.PackageId}}", - Items = + Namespaces = [ """); @@ -101,11 +101,11 @@ private static void BuildNamespaceDocumentation(NamespaceDocumentation namespace var i = new string(' ', indent * 4); content.AppendLine($$""" - {{i}}new ContentList + {{i}}new NamespaceDocumentation {{i}}{ {{i}} Name = "{{namespaceDocumentation.Name}}", {{i}} Description = "{{namespaceDocumentation.Description}}", - {{i}} Items = + {{i}} Types = {{i}} [ """); diff --git a/src/Doki.Output.Markdown/InternalExtensions.cs b/src/Doki.Output.Markdown/InternalExtensions.cs index 1b979e2..33e548a 100644 --- a/src/Doki.Output.Markdown/InternalExtensions.cs +++ b/src/Doki.Output.Markdown/InternalExtensions.cs @@ -31,15 +31,15 @@ public static Text BuildBreadcrumbs(this MarkdownBuilder builder, DocumentationO public static Text BuildText(this MarkdownBuilder builder, DocumentationObject obj) { - if (obj is not ContentList { Content: DocumentationContentType.XmlDocumentation } contentList) + if (obj is not XmlDocumentation { ContentType: DocumentationContentType.Xml } xmlDocumentation) throw new ArgumentException("DocumentationObject must be a ContentList with XmlDocumentation content.", nameof(obj)); var text = Text.Empty; - foreach (var item in contentList.Items) + foreach (var content in xmlDocumentation.Contents) { - switch (item) + switch (content) { case TextContent textContent: text.Append(textContent.Text); @@ -59,7 +59,7 @@ public static Text BuildText(this MarkdownBuilder builder, DocumentationObject o break; default: throw new NotSupportedException( - $"Unsupported {nameof(DocumentationObject)} type: {item.GetType().Name}"); + $"Unsupported {nameof(DocumentationObject)} type: {content.GetType().Name}"); } } @@ -74,7 +74,7 @@ public static string BuildRelativePath(this MarkdownBuilder builder, Documentati public static Element BuildLinkTo(this MarkdownBuilder builder, DocumentationObject to, string? text = null) { - var indexFile = to.Content is DocumentationContentType.Assemblies or DocumentationContentType.Assembly + var indexFile = to.ContentType is DocumentationContentType.Root or DocumentationContentType.Assembly or DocumentationContentType.Namespace; var asText = false; diff --git a/src/Doki.Output.Markdown/MarkdownOutput.cs b/src/Doki.Output.Markdown/MarkdownOutput.cs index 045dccc..2933ac1 100644 --- a/src/Doki.Output.Markdown/MarkdownOutput.cs +++ b/src/Doki.Output.Markdown/MarkdownOutput.cs @@ -302,7 +302,7 @@ private static IEnumerable BuildInheritanceChain(MarkdownBuilder markdo if (!file.Directory!.Exists) file.Directory.Create(); var heading = new Heading(name, 1); - if (documentationObject.Content == DocumentationContentType.Namespace) heading.Append(" Namespace"); + if (documentationObject.ContentType == DocumentationContentType.Namespace) heading.Append(" Namespace"); var markdown = new MarkdownBuilder(documentationObject.GetPath()).Add(heading);