diff --git a/dotnet-document.sln b/dotnet-document.sln
index 2b05713..b70b070 100644
--- a/dotnet-document.sln
+++ b/dotnet-document.sln
@@ -14,6 +14,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotnetDocument.Tests", "tes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotnetDocument.Performance", "test\DotnetDocument.Performance\DotnetDocument.Performance.csproj", "{87C75476-E094-4BB6-9F90-2A0B099686E4}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{654CBDE5-28CE-4677-B902-35CD8BB6CD3E}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ .gitignore = .gitignore
+ Directory.Build.props = Directory.Build.props
+ LICENSE = LICENSE
+ README.md = README.md
+ build\Version.props = build\Version.props
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/src/DotnetDocument.Tools/DotnetDocument.Tools.csproj b/src/DotnetDocument.Tools/DotnetDocument.Tools.csproj
index eda8543..31ca424 100644
--- a/src/DotnetDocument.Tools/DotnetDocument.Tools.csproj
+++ b/src/DotnetDocument.Tools/DotnetDocument.Tools.csproj
@@ -22,18 +22,18 @@
-
+
-
-
+
+
-
+
-
+
diff --git a/src/DotnetDocument/Configuration/DocumentationOptions.cs b/src/DotnetDocument/Configuration/DocumentationOptions.cs
index 67a3f02..94a0113 100644
--- a/src/DotnetDocument/Configuration/DocumentationOptions.cs
+++ b/src/DotnetDocument/Configuration/DocumentationOptions.cs
@@ -159,6 +159,11 @@ public class PropertyDocumentationOptions : MemberDocumentationOptionsBase
public SummaryDocumentationOptions Summary { get; init; } =
new($"{TemplateKeys.Accessors} the value of the {TemplateKeys.Name}");
+ ///
+ /// Gets or inits the value of the value
+ ///
+ public ValueDocumentationOptions Value { get; init; } = new($"The {TemplateKeys.Name}.");
+
///
/// Gets the syntax kind
///
@@ -166,6 +171,45 @@ public class PropertyDocumentationOptions : MemberDocumentationOptionsBase
public override SyntaxKind GetSyntaxKind() => SyntaxKind.PropertyDeclaration;
}
+ ///
+ /// Class value documentation options
+ ///
+ public class ValueDocumentationOptions
+ {
+ ///
+ /// Initializes a new instance of the class
+ ///
+ public ValueDocumentationOptions()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class
+ ///
+ /// The template
+ public ValueDocumentationOptions(string template) => Template = template;
+
+ ///
+ /// Gets or inits the value of the template
+ ///
+ public string Template { get; init; } = $"The {TemplateKeys.Name}.";
+
+ ///
+ /// Gets or inits the value of the new line
+ ///
+ public bool NewLine { get; init; } = false;
+
+ ///
+ /// Gets or inits the value of the enabled
+ ///
+ public bool Enabled { get; init; } = true;
+
+ ///
+ /// Gets or inits the value of the include comments
+ ///
+ public bool IncludeComments { get; init; } = false;
+ }
+
///
/// The enum documentation options class
///
diff --git a/src/DotnetDocument/DotnetDocument.csproj b/src/DotnetDocument/DotnetDocument.csproj
index 5f3a79f..22295d9 100644
--- a/src/DotnetDocument/DotnetDocument.csproj
+++ b/src/DotnetDocument/DotnetDocument.csproj
@@ -2,9 +2,9 @@
-
-
-
+
+
+
diff --git a/src/DotnetDocument/Strategies/PropertyDocumentationStrategy.cs b/src/DotnetDocument/Strategies/PropertyDocumentationStrategy.cs
index 7f7dd44..624d734 100644
--- a/src/DotnetDocument/Strategies/PropertyDocumentationStrategy.cs
+++ b/src/DotnetDocument/Strategies/PropertyDocumentationStrategy.cs
@@ -90,10 +90,20 @@ public override PropertyDeclarationSyntax Apply(PropertyDeclarationSyntax node)
{
}
- return GetDocumentationBuilder()
+ var builder = GetDocumentationBuilder()
.For(node)
- .WithSummary(summary.ToArray())
- .Build();
+ .WithSummary(summary.ToArray());
+
+ if (_options.Value.Enabled)
+ {
+ var value = _options.Value.Template
+ .Replace(TemplateKeys.Accessors, accessorsDescription)
+ .Replace(TemplateKeys.Name, humanizedPropertyName);
+
+ builder = builder.WithValue(value);
+ }
+
+ return builder.Build();
}
}
}
diff --git a/src/DotnetDocument/Syntax/DocumentationBuilder.cs b/src/DotnetDocument/Syntax/DocumentationBuilder.cs
index 7f1c3bb..3c15947 100644
--- a/src/DotnetDocument/Syntax/DocumentationBuilder.cs
+++ b/src/DotnetDocument/Syntax/DocumentationBuilder.cs
@@ -43,6 +43,11 @@ public class DocumentationBuilder where T : SyntaxNode
///
private bool _hasReturns;
+ ///
+ /// Gets the value of the has value
+ ///
+ private bool HasValue => !string.IsNullOrWhiteSpace(_value);
+
///
/// The node
///
@@ -53,6 +58,11 @@ public class DocumentationBuilder where T : SyntaxNode
///
private string? _returnsDescription;
+ ///
+ /// The value
+ ///
+ private string? _value;
+
///
/// Fors the node
///
@@ -219,6 +229,18 @@ public DocumentationBuilder WithTypeParams(IEnumerable<(string name, string d
return this;
}
+ ///
+ /// Adds the value using the specified value
+ ///
+ /// The value
+ /// A documentation builder of t
+ public DocumentationBuilder WithValue(string value)
+ {
+ _value = OnlyWhen.NotNull(value, nameof(value));
+
+ return this;
+ }
+
///
/// Builds this instance
///
@@ -270,6 +292,13 @@ public T Build()
// Declare the returns XML element
returnsXmlElement = DocumentationFactory.Returns(_returnsDescription ?? string.Empty);
+ XmlElementSyntax? valueXmlElement = null;
+ if (HasValue)
+ // Declare the value XML element
+ {
+ valueXmlElement = DocumentationFactory.Value(_value ?? string.Empty);
+ }
+
// Build the documentation trivia syntax for the entire doc
var docCommentTriviaSyntax = DocumentationFactory.XmlDocument(newLineXmlNode,
summaryXmlElement,
@@ -277,7 +306,8 @@ public T Build()
typeParamElements,
paramElements,
exceptionsElements,
- returnsXmlElement);
+ returnsXmlElement,
+ valueXmlElement);
// Wrap the doc into a syntax trivia
var documentationTrivia = SyntaxFactory.Trivia(docCommentTriviaSyntax);
diff --git a/src/DotnetDocument/Syntax/DocumentationFactory.cs b/src/DotnetDocument/Syntax/DocumentationFactory.cs
index 586f723..685030c 100644
--- a/src/DotnetDocument/Syntax/DocumentationFactory.cs
+++ b/src/DotnetDocument/Syntax/DocumentationFactory.cs
@@ -156,6 +156,15 @@ public static XmlElementSyntax TypeParam(string type, string description)
.XmlElement(startTag, descriptionXml, endTag);
}
+ ///
+ /// Values the description
+ ///
+ /// The description
+ /// The xml element syntax
+ public static XmlElementSyntax Value(string description) => SyntaxFactory
+ .XmlValueElement(SyntaxFactory
+ .XmlText(description));
+
///
/// Xmls the document using the specified xml indented new line
///
@@ -166,6 +175,7 @@ public static XmlElementSyntax TypeParam(string type, string description)
/// The parameters
/// The exceptions
/// The returns
+ /// The value
/// The documentation comment trivia syntax
public static DocumentationCommentTriviaSyntax XmlDocument(
XmlTextSyntax xmlIndentedNewLine,
@@ -174,7 +184,8 @@ public static DocumentationCommentTriviaSyntax XmlDocument(
List? typeParameters = null,
List? parameters = null,
List? exceptions = null,
- XmlElementSyntax? returns = null)
+ XmlElementSyntax? returns = null,
+ XmlElementSyntax? value = null)
{
var list = new List
{
@@ -215,6 +226,12 @@ public static DocumentationCommentTriviaSyntax XmlDocument(
list.Add(returns);
}
+ if (value is not null)
+ {
+ list.Add(xmlIndentedNewLine);
+ list.Add(value);
+ }
+
// This is the trivia syntax for the entire doc
return SyntaxFactory.DocumentationComment(list.ToArray());
}
diff --git a/src/DotnetDocument/Utils/EnglishUtils.cs b/src/DotnetDocument/Utils/EnglishUtils.cs
index 7139c7a..31d1b81 100644
--- a/src/DotnetDocument/Utils/EnglishUtils.cs
+++ b/src/DotnetDocument/Utils/EnglishUtils.cs
@@ -15,6 +15,15 @@ public static class EnglishUtils
/// The string
public static string ConjugateToThirdPersonSingular(string verb)
{
+ switch (verb)
+ {
+ case "be": return "is";
+ case "has": return verb;
+ case "have": return "has";
+ case "is": return verb;
+ }
+
+ // ss should be replaced by "es", s is debatable, but generally s => es should suffice.
// Check if verb ends with one of the following chars
if (verb.EndsWith("ch") || verb.EndsWith("s") || verb.EndsWith("sh") ||
verb.EndsWith("x") || verb.EndsWith("z") || verb.EndsWith("o"))
diff --git a/test/DotnetDocument.Performance/DotnetDocument.Performance.csproj b/test/DotnetDocument.Performance/DotnetDocument.Performance.csproj
index dd06b39..abd4942 100644
--- a/test/DotnetDocument.Performance/DotnetDocument.Performance.csproj
+++ b/test/DotnetDocument.Performance/DotnetDocument.Performance.csproj
@@ -1,8 +1,8 @@
-
-
+
+
diff --git a/test/DotnetDocument.Tests/DotnetDocument.Tests.csproj b/test/DotnetDocument.Tests/DotnetDocument.Tests.csproj
index 5ccad88..e6ed41b 100644
--- a/test/DotnetDocument.Tests/DotnetDocument.Tests.csproj
+++ b/test/DotnetDocument.Tests/DotnetDocument.Tests.csproj
@@ -5,19 +5,19 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/test/DotnetDocument.Tools.Tests/DotnetDocument.Tools.Tests.csproj b/test/DotnetDocument.Tools.Tests/DotnetDocument.Tools.Tests.csproj
index 67d7019..fb18a28 100644
--- a/test/DotnetDocument.Tools.Tests/DotnetDocument.Tools.Tests.csproj
+++ b/test/DotnetDocument.Tools.Tests/DotnetDocument.Tools.Tests.csproj
@@ -5,13 +5,13 @@
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all