-
Notifications
You must be signed in to change notification settings - Fork 11
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
Conversation
Arkatufus
commented
Oct 4, 2022
- 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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('>')) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
There was a problem hiding this 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM