-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ExperimentalAttribute and required modifier support
Changes made: - Added support for ExperimentalAttribute to add tags to API members similar to ObsoleteAttribute in all presentation styles. Closes #1093. - Added support for the `required` modifier on fields and properties in the C# syntax generator. - Made some usability improvements to the Entity References tool window (#1094).
- Loading branch information
1 parent
ccec05c
commit 2f554ed
Showing
31 changed files
with
542 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
// System : Sandcastle Tools Standard Presentation Styles | ||
// File : Default2022Transformation.cs | ||
// Author : Eric Woodruff ([email protected]) | ||
// Updated : 08/30/2024 | ||
// Note : Copyright 2022-2024, Eric Woodruff, All rights reserved | ||
// Updated : 02/23/2025 | ||
// Note : Copyright 2022-2025, Eric Woodruff, All rights reserved | ||
// | ||
// This file contains the class used to generate a MAML or API HTML topic from the raw topic XML data for the | ||
// Default 2022 presentation style. | ||
|
@@ -1137,15 +1137,17 @@ private void RenderPageTitleAndLogo(XElement body) | |
//===================================================================== | ||
|
||
/// <summary> | ||
/// This is used to render the preliminary and obsolete API notices | ||
/// This is used to render the preliminary, obsolete, and experimental API notices | ||
/// </summary> | ||
/// <param name="transformation">The topic transformation to use</param> | ||
private static void RenderNotices(TopicTransformationCore transformation) | ||
{ | ||
var preliminary = transformation.CommentsNode.Element("preliminary"); | ||
var obsolete = transformation.ReferenceNode.AttributeOfType("T:System.ObsoleteAttribute"); | ||
var experimental = transformation.ReferenceNode.AttributeOfType( | ||
"T:System.Diagnostics.CodeAnalysis.ExperimentalAttribute"); | ||
|
||
if(preliminary != null || obsolete != null) | ||
if(preliminary != null || obsolete != null || experimental != null) | ||
{ | ||
var currentElement = transformation.CurrentElement; | ||
var notes = new XElement("span", new XAttribute("class", "tags")); | ||
|
@@ -1164,6 +1166,13 @@ private static void RenderNotices(TopicTransformationCore transformation) | |
new XElement("include", new XAttribute("item", "boilerplate_obsoleteLong")))); | ||
} | ||
|
||
if(experimental != null) | ||
{ | ||
notes.Add(new XElement("span", | ||
new XAttribute("class", "tag is-warning is-medium"), | ||
new XElement("include", new XAttribute("item", "boilerplate_experimentalLong")))); | ||
} | ||
|
||
transformation.CurrentElement = currentElement; | ||
} | ||
} | ||
|
@@ -1606,8 +1615,9 @@ private static void RenderApiNamespaceList(TopicTransformationCore transformatio | |
|
||
var obsoleteAttr = e.AttributeOfType("T:System.ObsoleteAttribute"); | ||
var prelimComment = e.Element("preliminary"); | ||
var experimentalAttr = e.AttributeOfType("T:System.Diagnostics.CodeAnalysis.ExperimentalAttribute"); | ||
|
||
if(obsoleteAttr != null || prelimComment != null) | ||
if(obsoleteAttr != null || prelimComment != null || experimentalAttr != null) | ||
{ | ||
if(!summaryCell.IsEmpty) | ||
summaryCell.Add(new XElement("br")); | ||
|
@@ -1620,6 +1630,14 @@ private static void RenderApiNamespaceList(TopicTransformationCore transformatio | |
new XAttribute("item", "boilerplate_obsoleteShort")))); | ||
} | ||
|
||
if(experimentalAttr != null) | ||
{ | ||
summaryCell.Add(new XElement("span", | ||
new XAttribute("class", "tag is-warning"), | ||
new XElement("include", | ||
new XAttribute("item", "boilerplate_experimentalShort")))); | ||
} | ||
|
||
if(prelimComment != null) | ||
{ | ||
summaryCell.Add(new XElement("span", | ||
|
@@ -1779,7 +1797,9 @@ private static void RenderApiEnumerationMembersList(TopicTransformationCore tran | |
thisTransform.RenderChildElements(summaryCell, remarks.Nodes()); | ||
} | ||
|
||
if(e.AttributeOfType("T:System.ObsoleteAttribute") != null) | ||
var obsoleteAttr = e.AttributeOfType("T:System.ObsoleteAttribute"); | ||
|
||
if(obsoleteAttr != null) | ||
{ | ||
if(!summaryCell.IsEmpty) | ||
summaryCell.Add(new XElement("br")); | ||
|
@@ -1790,6 +1810,17 @@ private static void RenderApiEnumerationMembersList(TopicTransformationCore tran | |
new XAttribute("item", "boilerplate_obsoleteShort")))); | ||
} | ||
|
||
if(e.AttributeOfType("T:System.Diagnostics.CodeAnalysis.ExperimentalAttribute") != null) | ||
{ | ||
if(!summaryCell.IsEmpty && obsoleteAttr == null) | ||
summaryCell.Add(new XElement("br")); | ||
|
||
summaryCell.Add(new XElement("span", | ||
new XAttribute("class", "tag is-warning"), | ||
new XElement("include", | ||
new XAttribute("item", "boilerplate_experimentalShort")))); | ||
} | ||
|
||
if(summaryCell.IsEmpty) | ||
summaryCell.Add(Element.NonBreakingSpace); | ||
} | ||
|
@@ -2038,8 +2069,9 @@ private static void RenderApiTypeMemberLists(TopicTransformationCore transformat | |
|
||
var obsoleteAttr = e.AttributeOfType("T:System.ObsoleteAttribute"); | ||
var prelimComment = e.Element("preliminary"); | ||
var experimentalAttr = e.AttributeOfType("T:System.Diagnostics.CodeAnalysis.ExperimentalAttribute"); | ||
|
||
if(obsoleteAttr != null || prelimComment != null) | ||
if(obsoleteAttr != null || prelimComment != null || experimentalAttr != null) | ||
{ | ||
if(!summaryCell.IsEmpty) | ||
summaryCell.Add(new XElement("br")); | ||
|
@@ -2052,6 +2084,14 @@ private static void RenderApiTypeMemberLists(TopicTransformationCore transformat | |
new XAttribute("item", "boilerplate_obsoleteShort")))); | ||
} | ||
|
||
if(experimentalAttr != null) | ||
{ | ||
summaryCell.Add(new XElement("span", | ||
new XAttribute("class", "tag is-warning"), | ||
new XElement("include", | ||
new XAttribute("item", "boilerplate_experimentalShort")))); | ||
} | ||
|
||
if(prelimComment != null) | ||
{ | ||
summaryCell.Add(new XElement("span", | ||
|
Oops, something went wrong.