Skip to content

Commit

Permalink
Merge pull request #471 from baynezy/release/7.0.1.9
Browse files Browse the repository at this point in the history
Release version 7.0.1.9
  • Loading branch information
baynezy authored Sep 6, 2024
2 parents ed65111 + c8b45f8 commit a1b6512
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [7.0.1.9] - 2024-09-06

### Added

- Added support extending existing Schemes for customisation

## [7.0.0.8] - 2024-08-15

### Added
Expand Down Expand Up @@ -485,7 +491,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.0.1] - 2013-07-04

[unreleased]: https://github.com/baynezy/Html2Markdown/compare/7.0.0.8...HEAD
[unreleased]: https://github.com/baynezy/Html2Markdown/compare/7.0.1.9...HEAD
[7.0.1.9]: https://github.com/baynezy/Html2Markdown/compare/7.0.0.8...7.0.1.9
[7.0.0.8]: https://github.com/baynezy/Html2Markdown/compare/6.2.5.7...7.0.0.8
[6.2.5.7]: https://github.com/baynezy/Html2Markdown/compare/6.2.4.6...6.2.5.7
[6.2.4.6]: https://github.com/baynezy/Html2Markdown/compare/6.2.3.6...6.2.4.6
Expand Down
2 changes: 1 addition & 1 deletion semver.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"major":"7","minor":"0","patch":"0","build":"8"}
{"major":"7","minor":"0","patch":"1","build":"9"}
2 changes: 1 addition & 1 deletion src/Html2Markdown/Html2Markdown.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.63" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.65" />
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
</ItemGroup>

Expand Down
11 changes: 10 additions & 1 deletion src/Html2Markdown/Scheme/AbstractScheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Html2Markdown.Scheme;
/// A group of IReplacer to deal with converting HTML entities.
/// </summary>
public abstract class AbstractScheme : IScheme {

/// <summary>
/// The collection of IReplacer instances used for replacements.
/// </summary>
Expand All @@ -30,4 +30,13 @@ public IList<IReplacer> Replacers()
{
return ReplacerCollection;
}

/// <summary>
/// Adds a single replacer to the collection.
/// </summary>
/// <param name="replacer">The replacer to add.</param>
public void AddReplacer(IReplacer replacer)
{
ReplacerCollection.Add(replacer);
}
}
6 changes: 3 additions & 3 deletions test/Html2Markdown.Test/Html2Markdown.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<ItemGroup>
<PackageReference Include="JunitXml.TestLogger" Version="4.0.254" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NUnit" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Verify.NUnit" Version="26.2.0" />
<PackageReference Include="Verify.NUnit" Version="26.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
106 changes: 106 additions & 0 deletions test/Html2Markdown.Test/Scheme/AbstractSchemeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
using System.Collections.Generic;
using Html2Markdown.Replacement;
using Html2Markdown.Scheme;

namespace Html2Markdown.Test.Scheme;

public class AbstractSchemeTests
{
[Test]
public void Replacers_WhenCalled_ReturnsReplacerCollection()
{
// arrange
const int expectedCount = 1;
var scheme = new TestScheme();

// act
var replacers = scheme.Replacers();

// assert
Assert.That(replacers.Count, Is.EqualTo(expectedCount));
}

[Test]
public void Replacers_WhenCalled_ReturnsReplacerCollectionWithTestReplacer()
{
// arrange
var scheme = new TestScheme();

// act
var replacers = scheme.Replacers();

// assert
Assert.That(replacers[0], Is.InstanceOf<TestReplacer>());
}

[Test]
public void Replacers_WhenCalled_ReturnsReplacerCollectionWithTestReplacerReplaceMethod()
{
// arrange
const string expected = "test";
var scheme = new TestScheme();

// act
var replacers = scheme.Replacers();
var result = replacers[0].Replace(string.Empty);

// assert
Assert.That(result, Is.EqualTo(expected));
}

[Test]
public void AddReplacer_WhenCalled_AddsReplacerToReplacerCollection()
{
// arrange
const int expectedCount = 2;
var scheme = new TestScheme();

// act
scheme.AddReplacer(new TestReplacer());
var replacers = scheme.Replacers();

// assert
Assert.That(replacers.Count, Is.EqualTo(expectedCount));
}

[Test]
public void AddReplacer_WhenCalled_AddsReplacerToReplacerCollectionWithTestReplacer()
{
// arrange
var scheme = new TestScheme();

// act
scheme.AddReplacer(new TestReplacer());
var replacers = scheme.Replacers();

// assert
Assert.That(replacers[1], Is.InstanceOf<TestReplacer>());
}
}

public class TestScheme : AbstractScheme
{
public TestScheme()
{
AddReplacementGroup(ReplacerCollection, new TestReplacementGroup());
}
}

public class TestReplacementGroup : IReplacementGroup
{
public IEnumerable<IReplacer> Replacers()
{
return new List<IReplacer>
{
new TestReplacer()
};
}
}

public class TestReplacer : IReplacer
{
public string Replace(string html)
{
return "test";
}
}

0 comments on commit a1b6512

Please sign in to comment.