Skip to content

Fix bug in code data-dev-comment conversions. #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PortToDocs/src/app/PortToDocs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
<Version>1.3</Version>
<Version>1.4</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
8 changes: 5 additions & 3 deletions src/PortToDocs/src/libraries/XmlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ internal class XmlHelper
{ @"\<(see|seealso){1} cref\=""object""[ ]*\/\>", "<see cref=\"T:System.Object\" />" },
{ @"\<(see|seealso){1} cref\=""dynamic""[ ]*\/\>", "<see langword=\"dynamic\" />" },
{ @"\<(see|seealso){1} cref\=""string""[ ]*\/\>", "<see cref=\"T:System.String\" />" },
{ @"<code data-dev-comment-type=""(?<elementName>[a-zA-Z0-9_]+)"">(?<elementValue>[a-zA-Z0-9_]+)</code>", "<see ${elementName}=\"${elementValue}\" />" },
{ @"<xref data-throw-if-not-resolved=""[a-zA-Z0-9_]+"" uid=""(?<docId>[a-zA-Z0-9_,\<\>\.\@\#\$%^&`\(\)]+)""><\/xref>", "<see cref=\"T:${docId}\" />" },
{ @"<code data-dev-comment-type=""langword"">(?<elementValue>[a-zA-Z0-9_]+)</code>", "<see langword=\"${elementValue}\" />" },
{ @"<code data-dev-comment-type=""paramref"">(?<elementValue>[a-zA-Z0-9_]+)</code>", "<paramref name=\"${elementValue}\" />" },
{ @"<code data-dev-comment-type=""typeparamref"">(?<elementValue>[a-zA-Z0-9_]+)</code>", "<typeparamref name=\"${elementValue}\" />" },
{ @"<xref data-throw-if-not-resolved=""[a-zA-Z0-9_]+"" uid=""(?<docId>[a-zA-Z0-9_,\<\>\.\@\#\$%^&`\(\)]+)""(><\/xref>|[ ]*/>)", "<see cref=\"T:${docId}\" />" },
};

private static readonly Dictionary<string, string> _replaceableMarkdownPatterns = new Dictionary<string, string> {
Expand Down Expand Up @@ -123,7 +125,7 @@ internal class XmlHelper
{ @"\<(typeparamref|paramref){1} name\=""(?'refNameContents'[a-zA-Z0-9_\-]+)""[ ]*\/\>", @"`${refNameContents}`" },
{ @"\<see langword\=""(?'seeLangwordContents'[a-zA-Z0-9_\-]+)""[ ]*\/\>", @"`${seeLangwordContents}`" },
{ @"<code data-dev-comment-type=""[a-zA-Z0-9_]+"">(?<elementValue>[a-zA-Z0-9_]+)</code>", "`${elementValue}`" },
{ @"<xref data-throw-if-not-resolved=""[a-zA-Z0-9_]+"" uid=""(?<docId>[a-zA-Z0-9_,\<\>\.]+)""><\/xref>", "<xref:${docId}>" },
{ @"<xref data-throw-if-not-resolved=""[a-zA-Z0-9_]+"" uid=""(?<docId>[a-zA-Z0-9_,\<\>\.]+)""(><\/xref>|[ ]*/>)", "<xref:${docId}>" },
};

private static readonly string[] _splittingSeparators = new string[] { "\r", "\n", "\r\n" };
Expand Down
2 changes: 1 addition & 1 deletion src/PortToDocs/tests/PortToDocs.Strings.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ public void Convert_CodeDataDevCommentType_To_ExpectedElementNames()
<AssemblyName>MyAssembly</AssemblyName>
</AssemblyInfo>
<Docs>
<summary>Langword <see langword=""true"" />. Paramref <see paramref=""myParam"" />. Typeparamref <see typeparamref=""myTypeParam"" />.</summary>
<summary>Langword <see langword=""true"" />. Paramref <paramref name=""myParam"" />. Typeparamref <typeparamref name=""myTypeParam"" />.</summary>
<remarks>
<format type=""text/markdown""><![CDATA[

Expand Down
Loading