Skip to content
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

Fix Nuke highly oppinionated XML and MD helper to our own code #125

Merged
merged 4 commits into from
Oct 4, 2022

Conversation

Arkatufus
Copy link
Contributor

  • Add our own markdown "parser"
  • Insert a CDATA section into the XML if the input has '<' or '>' instead of sanitizing the text.

}
}

private static IEnumerable<ReleaseSection> GetReleaseSections(List<string> content)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is replaced.
Instead of adhering to the draconian keep a changelog rule, we instead grab anything between the H2 headers as changelog content.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

/// <param name="changelogFile">The path to the changelog file.</param>
/// <returns>A <see cref="ChangeLog"/> object to work with the changelog.</returns>
[Pure]
public static ChangeLog ReadChangelog(string changelogFile)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from Nuke, no change

/// <param name="tag">The tag which release notes should get extracted.</param>
/// <returns>A collection of the release notes.</returns>
[Pure]
public static IEnumerable<string> ExtractChangelogSectionNotes(string changelogFile, string tag = null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from Nuke, no change


public static class MdHelper
{
public static string GetNuGetReleaseNotes(string changelogFile, GitRepository repository = null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from Nuke, no change

/// <param name="changelogFile">The path to the changelog file.</param>
/// <returns>A readonly list of the release sections contained in the changelog.</returns>
[Pure]
public static IReadOnlyList<ReleaseNotes> ReadReleaseNotes(string changelogFile)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from Nuke, no change

var (elements, attributes) = GetObjects(document, xpath, namespaces);
Assert.True((elements.Count == 1 || attributes.Count == 1) && !(elements.Count == 0 && attributes.Count == 0));

if (value.Contains('<') || value.Contains('>'))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the input string have invalid XML text, wrap it inside a CDATA block

document.Save(xmlWriter);
}

private static (IReadOnlyCollection<XElement> Elements, IReadOnlyCollection<XAttribute> Attributes) GetObjects(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied over from Nuke, no change

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}
}

private static IEnumerable<ReleaseSection> GetReleaseSections(List<string> content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) October 4, 2022 20:13
@Aaronontheweb Aaronontheweb merged commit f059fa7 into akkadotnet:dev Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants