diff --git a/src/Microsoft.Content.Build.Code2Yaml.ArticleGenerator/BasicArticleGenerator.cs b/src/Microsoft.Content.Build.Code2Yaml.ArticleGenerator/BasicArticleGenerator.cs index 1befbc1..070aa10 100644 --- a/src/Microsoft.Content.Build.Code2Yaml.ArticleGenerator/BasicArticleGenerator.cs +++ b/src/Microsoft.Content.Build.Code2Yaml.ArticleGenerator/BasicArticleGenerator.cs @@ -188,7 +188,8 @@ private static string RemoveArgs(string original) protected void FillSummary(ArticleItemYaml yaml, XElement node) { - yaml.Summary = node.NullableElement("briefdescription").NullableInnerXml() + ParseSummaryFromDetailedDescription(node.NullableElement("detaileddescription")); + yaml.Summary = node.NullableElement("briefdescription").NullableInnerXml() + ParseSummaryFromDetailedDescription(node.NullableElement("detaileddescription")) + + EnumValueAsSummary(node); if (yaml.Summary == string.Empty) { yaml.Summary = null; @@ -449,6 +450,23 @@ private string ParseReturnDescription(XElement detailedDescription) return returnValue.NullableInnerXml(); } + // Only for c++ language. + private string EnumValueAsSummary(XElement enumMember) + { + string language = (string) enumMember.Parent?.Parent?.Attribute("language"); + if ( (string.Equals(language, "c++", StringComparison.OrdinalIgnoreCase) && string.Equals(language, "cplusplus", StringComparison.OrdinalIgnoreCase)) || (string)enumMember.Attribute("kind") != "enum") + { + return null; + } + string rowValues = ""; + + foreach (var node in enumMember.Elements("enumvalue")) + { + rowValues += "
| Name | Description |
|---|
///
@@ -508,6 +526,10 @@ private static int ParseStartline(string startlineStr)
{
type = MemberType.Field;
}
+ else if (kind.Contains("enum"))
+ {
+ type = MemberType.Enum;
+ }
//else if (kind.Contains("friend"))
//{
// type = MemberType.Friend;
diff --git a/test/code2yaml.Tests/Code2YamlTest.cs b/test/code2yaml.Tests/Code2YamlTest.cs
index 4ce5a0e..29f55fc 100644
--- a/test/code2yaml.Tests/Code2YamlTest.cs
+++ b/test/code2yaml.Tests/Code2YamlTest.cs
@@ -148,6 +148,44 @@ public void checkIndentation() {
Assert.Equal("App's summary
\r\n\r\n
\r\n - \r\n
Test ScalarStyle for Summary of reference view model.
\r\n \r\n
\r\n".Replace("\r\n", "\n"), referenceItem.Summary.Replace("\r\n", "\n"));
}
+ [Fact]
+ public void TestMetadataFromCPlusPlusProject()
+ {
+ // arrange
+ var outputFolder = Path.Combine(_workingFolder, "output");
+ var config = new ConfigModel
+ {
+ InputPaths = new List { "TestData/cplusplus" },
+ Language = "cplusplus",
+ OutputPath = outputFolder,
+ };
+ var context = new BuildContext();
+ context.SetSharedObject(Constants.Constants.Config, config);
+ var procedure = new StepCollection(
+ new RunDoxygen(),
+ new PreprocessXml(),
+ new ScanHierarchy(),
+ new TaskParallel(
+ new List
+ {
+ new GenerateToc { NameGenerator = NameGeneratorFactory.Create(config.Language) },
+ new GenerateArticles { Generator = ArticleGeneratorFactory.Create(config.Language) },
+ }));
+
+ // act
+ procedure.RunAsync(context).Wait();
+
+ // assert
+ var outputPathStruct = Path.Combine(outputFolder, "Check.CheckStruct1.yml");
+ var outputPathClass = Path.Combine(outputFolder, "Check.CheckClass1.yml");
+ var outputPathamespace = Path.Combine(outputFolder, "Check.yml");
+ var outputToc = Path.Combine(outputFolder, "toc.yml");
+ Assert.True(File.Exists(outputPathStruct));
+ Assert.True(File.Exists(outputPathClass));
+ Assert.True(File.Exists(outputPathamespace));
+ Assert.True(File.Exists(outputToc));
+ }
+
public void Dispose()
{
try