forked from EWSoftware/SHFB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed handling of list items with a term element but no description. Fixes EWSoftware#989. - Fixed odd case with an implicit operator that had no parameters. Fixes EWSoftware#985.
- Loading branch information
1 parent
f2e3d57
commit 2ea7eae
Showing
12 changed files
with
78 additions
and
30 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
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 - Sandcastle Tools Core Class Library | ||
// File : ListElement.cs | ||
// Author : Eric Woodruff ([email protected]) | ||
// Updated : 07/24/2022 | ||
// Note : Copyright 2022, Eric Woodruff, All rights reserved | ||
// Updated : 04/29/2023 | ||
// Note : Copyright 2022-2023, Eric Woodruff, All rights reserved | ||
// | ||
// This file contains the class used to handle list elements based on the topic type | ||
// | ||
|
@@ -217,14 +217,22 @@ private void RenderXmlCommentsList(TopicTransformationCore transformation, XElem | |
|
||
if(term != null || description != null) | ||
{ | ||
// If there's a term but no description, render the term as the description | ||
if(term != null && description == null) | ||
{ | ||
description = term; | ||
term = null; | ||
} | ||
|
||
if(term != null) | ||
{ | ||
var strong = new XElement("strong"); | ||
li.Add(strong, " \u2013 "); | ||
transformation.RenderChildElements(strong, term.Nodes()); | ||
} | ||
|
||
transformation.RenderChildElements(li, description.Nodes()); | ||
if(description != null) | ||
transformation.RenderChildElements(li, description.Nodes()); | ||
} | ||
else | ||
transformation.RenderChildElements(li, item.Nodes()); | ||
|
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 - Sandcastle Tools Core Class Library | ||
// File : ListElement.cs | ||
// Author : Eric Woodruff ([email protected]) | ||
// Updated : 05/29/2022 | ||
// Note : Copyright 2022, Eric Woodruff, All rights reserved | ||
// Updated : 04/29/2023 | ||
// Note : Copyright 2022-2023, Eric Woodruff, All rights reserved | ||
// | ||
// This file contains the class used to handle list elements based on the topic type | ||
// | ||
|
@@ -187,6 +187,13 @@ private static void RenderXmlCommentsList(TopicTransformationCore transformation | |
container = new XElement(OpenXmlElement.WordProcessingML + "p"); | ||
li.Add(container); | ||
|
||
// If there's a term but no description, render the term as the description | ||
if(term != null && description == null) | ||
{ | ||
description = term; | ||
term = null; | ||
} | ||
|
||
if(term != null) | ||
{ | ||
bold = new XElement("span", new XAttribute("class", "Bold")); | ||
|
@@ -195,7 +202,8 @@ private static void RenderXmlCommentsList(TopicTransformationCore transformation | |
transformation.RenderChildElements(bold, term.Nodes()); | ||
} | ||
|
||
transformation.RenderChildElements(container, description.Nodes()); | ||
if(description != null) | ||
transformation.RenderChildElements(container, description.Nodes()); | ||
} | ||
else | ||
transformation.RenderChildElements(li, item.Nodes()); | ||
|
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 - Sandcastle Tools Core Class Library | ||
// File : TopicTransformationCore.cs | ||
// Author : Eric Woodruff ([email protected]) | ||
// Updated : 10/11/2022 | ||
// Note : Copyright 2022, Eric Woodruff, All rights reserved | ||
// Updated : 04/29/2023 | ||
// Note : Copyright 2022-2023, Eric Woodruff, All rights reserved | ||
// | ||
// This file contains the abstract base class that is used to define the settings and common functionality for a | ||
// specific presentation style topic transformation. | ||
|
@@ -1612,26 +1612,26 @@ protected virtual XNode ApiTopicTocTitleSimple() | |
/// <returns>An enumerable list of one or more XML nodes representing the parameter and return types</returns> | ||
protected virtual IEnumerable<XNode> ApiTopicOperatorTypes(bool plainText) | ||
{ | ||
var parameters = this.ReferenceNode.Element("parameters").Elements(); | ||
var parameters = this.ReferenceNode.Element("parameters")?.Elements(); | ||
var returns = this.ReferenceNode.Element("returns").Elements(); | ||
|
||
if(plainText) | ||
{ | ||
var sb = new StringBuilder(1024); | ||
|
||
if(parameters.Count() == 1 || returns.Count() == 1) | ||
if((parameters != null && parameters.Count() == 1) || returns.Count() == 1) | ||
sb.Append('('); | ||
|
||
if(parameters.Count() == 1) | ||
if(parameters != null && parameters.Count() == 1) | ||
this.ApiTypeNamePlainText(sb, parameters.First().Elements().First()); | ||
|
||
if(parameters.Count() == 1 || returns.Count() == 1) | ||
if(parameters != null && parameters.Count() == 1 && returns.Count() == 1) | ||
sb.Append(" to "); | ||
|
||
if(returns.Count() == 1) | ||
this.ApiTypeNamePlainText(sb, returns.First()); | ||
|
||
if(parameters.Count() == 1 || returns.Count() == 1) | ||
if((parameters != null && parameters.Count() == 1) || returns.Count() == 1) | ||
sb.Append(')'); | ||
|
||
return new[] { new XText(sb.ToString()) }; | ||
|
@@ -1640,19 +1640,19 @@ protected virtual IEnumerable<XNode> ApiTopicOperatorTypes(bool plainText) | |
// This isn't returned, just its content | ||
var opsElement = new XElement("parameters"); | ||
|
||
if(parameters.Count() == 1 || returns.Count() == 1) | ||
if((parameters != null && parameters.Count() == 1) || returns.Count() == 1) | ||
opsElement.Add("("); | ||
|
||
if(parameters.Count() == 1) | ||
if(parameters != null && parameters.Count() == 1) | ||
this.ApiTypeNameDecorated(opsElement, parameters.First().Elements().First()); | ||
|
||
if(parameters.Count() == 1 || returns.Count() == 1) | ||
if(parameters != null && parameters.Count() == 1 && returns.Count() == 1) | ||
opsElement.Add(" to "); | ||
|
||
if(returns.Count() == 1) | ||
this.ApiTypeNameDecorated(opsElement, returns.First()); | ||
|
||
if(parameters.Count() == 1 || returns.Count() == 1) | ||
if((parameters != null && parameters.Count() == 1) || returns.Count() == 1) | ||
opsElement.Add(")"); | ||
|
||
return opsElement.Nodes(); | ||
|
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