diff --git a/src/Doki.Abstractions/DocumentationContentType.cs b/src/Doki.Abstractions/DocumentationContentType.cs index d025b79..c541b6a 100644 --- a/src/Doki.Abstractions/DocumentationContentType.cs +++ b/src/Doki.Abstractions/DocumentationContentType.cs @@ -94,4 +94,9 @@ public enum DocumentationContentType /// A property in the documentation. /// Property, + + /// + /// A method in the documentation. + /// + Method, } \ No newline at end of file diff --git a/src/Doki/DocumentationGenerator.Content.cs b/src/Doki/DocumentationGenerator.Content.cs index eb516b4..72a7bfa 100644 --- a/src/Doki/DocumentationGenerator.Content.cs +++ b/src/Doki/DocumentationGenerator.Content.cs @@ -256,7 +256,7 @@ private IEnumerable BuildMethodDocumentation(Type type, Doc { Id = methodId, Name = method.GetSanitizedName(), - ContentType = DocumentationContentType.Property, + ContentType = DocumentationContentType.Method, Namespace = method.DeclaringType.Namespace, Assembly = methodAssembly.Name, Parent = parent, @@ -390,6 +390,52 @@ private DocumentationObject BuildCRefDocumentation(string cref, DocumentationObj IsDocumented = PropertyFilter.Expression?.Invoke(property) ?? PropertyFilter.Default(property) }; } + case "F": + { + var field = type.GetField(memberName, AllMembersBindingFlags); + if (field == null) + return new TextContent + { + Id = "text", + Parent = parent, + Text = memberName + }; + + return new MemberDocumentation + { + Id = field.GetXmlDocumentationId(), + Name = field.Name, + ContentType = DocumentationContentType.Field, + Namespace = type.Namespace, + Assembly = type.Assembly.GetName().Name, + Parent = typeDocumentationReference, + IsDocumented = FieldFilter.Expression?.Invoke(field) ?? FieldFilter.Default(field) + }; + } + case "M": + { + var method = type.GetMethod(memberName, AllMembersBindingFlags); + if (method == null) + return new TextContent + { + Id = "text", + Parent = parent, + Text = memberName + }; + + return new MemberDocumentation + { + Id = method.GetXmlDocumentationId(), + Name = method.GetSanitizedName(), + ContentType = method.IsConstructor + ? DocumentationContentType.Constructor + : DocumentationContentType.Method, + Namespace = type.Namespace, + Assembly = type.Assembly.GetName().Name, + Parent = typeDocumentationReference, + IsDocumented = MethodFilter.Expression?.Invoke(method) ?? MethodFilter.Default(method) + }; + } default: throw new ArgumentOutOfRangeException(nameof(cref), cref, "Unsupported cref member type."); }