Release v1.0.2
- moved folders around - provided readme
This commit is contained in:
parent
13659e7eaf
commit
fc19e6e4e1
52
Readme.md
52
Readme.md
|
@ -1,19 +1,47 @@
|
||||||
# ProSol.Web.Html.TagsProvider
|
# ProSol.Html.TagsProvider
|
||||||
|
|
||||||
A tool for extracting tags from HTML, via push-notifications.
|
TagsProvider is a tool for extracting HTML tags from a string, in event-driven way.
|
||||||
|
Helps to extract text, structured data, from a specific site.
|
||||||
|
|
||||||
- [Usage](#usage)
|
## How to use?
|
||||||
- [Known Issues](#known-issues)
|
|
||||||
- [Goals](#goals)
|
|
||||||
- [Footnote](#footnote)
|
|
||||||
|
|
||||||
## Usage
|
Install the package:
|
||||||
|
```sh
|
||||||
|
dotnet add package ProSol.Html.TagsProvider
|
||||||
|
```
|
||||||
|
|
||||||
## Known Issues
|
Make an Observer:
|
||||||
|
```csharp
|
||||||
|
internal class ConsoleLogObserver : IObserver<TagsProviderMessage>
|
||||||
|
{
|
||||||
|
public void OnCompleted() { }
|
||||||
|
|
||||||
## Goals
|
public void OnError(Exception error) { }
|
||||||
|
|
||||||
## Footnote
|
public void OnNext(TagsProviderMessage value)
|
||||||
|
{
|
||||||
|
Console.WriteLine(value.CurrentTag.TagInfo.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- The versioning is complied to the Semver 2.0.0. Please refer to [semver.org](https://semver.org/) for details.
|
Run the TagsProvider:
|
||||||
- Please refer to the [Changelog](./Changelog.md) for the progress.
|
```csharp
|
||||||
|
var provider = new TagsProvider();
|
||||||
|
using var unsub = provider.Subscribe(new ConsoleLogObserver());
|
||||||
|
provider.Process("<div> <span> </span> </div>");
|
||||||
|
```
|
||||||
|
|
||||||
|
Get the output:
|
||||||
|
```
|
||||||
|
span
|
||||||
|
div
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it!
|
||||||
|
The provider notifies about any tag met and its data:
|
||||||
|
- name,
|
||||||
|
- range of entire tag,
|
||||||
|
- range of inner content.
|
||||||
|
|
||||||
|
More demos [here](https://git.disroot.org/alexenko/Demos/src/branch/master/ProSol.TagsProvider).
|
|
@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.31903.59
|
VisualStudioVersion = 17.0.31903.59
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProSol.Web.Html.Tests", "ProSol.Web.Html.Tests\ProSol.Web.Html.Tests.csproj", "{2EF0FD35-7C6C-4CE7-8BA6-BE00FB7402FA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProSol.Html.Tests", "tests\ProSol.Html.Tests.csproj", "{2EF0FD35-7C6C-4CE7-8BA6-BE00FB7402FA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProSol.Web.Html", "ProSol.Web.Html\ProSol.Web.Html.csproj", "{24E53336-6607-4660-B194-297813769605}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProSol.Html", "src\ProSol.Html.csproj", "{24E53336-6607-4660-B194-297813769605}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Contracts.Data;
|
namespace ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the completed tag with metadata and offsets from begin to end.
|
/// Represents the completed tag with metadata and offsets from begin to end.
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Contracts.Data;
|
namespace ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the html info about the tag.
|
/// Represents the html info about the tag.
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Contracts.Data;
|
namespace ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a push-notification from <see cref="TagsProvider"/>
|
/// Represents a push-notification from <see cref="TagsProvider"/>
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Contracts.Operations;
|
namespace ProSol.Html.Contracts.Operations;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a conditional subscription.
|
/// Provides a conditional subscription.
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Data;
|
namespace ProSol.Html.Data;
|
||||||
|
|
||||||
internal enum TagKind
|
internal enum TagKind
|
||||||
{
|
{
|
|
@ -1,11 +1,11 @@
|
||||||
using ProSol.Web.Html.Contracts.Data;
|
using ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Data;
|
namespace ProSol.Html.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an opened tag, when there is incomplete data about it.
|
/// Represents an opened tag, when there is incomplete data about it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record class UnprocessedTag(
|
internal record class UnprocessedTag(
|
||||||
TagInfo TagInfo,
|
TagInfo TagInfo,
|
||||||
int TagOffset,
|
int TagOffset,
|
||||||
int? InnerOffset);
|
int? InnerOffset);
|
|
@ -1,6 +1,6 @@
|
||||||
using ProSol.Web.Html.Contracts.Data;
|
using ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Messaging;
|
namespace ProSol.Html.Messaging;
|
||||||
|
|
||||||
internal class Broadcaster
|
internal class Broadcaster
|
||||||
{
|
{
|
|
@ -1,5 +1,5 @@
|
||||||
using ProSol.Web.Html.Contracts.Data;
|
using ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Messaging;
|
namespace ProSol.Html.Messaging;
|
||||||
|
|
||||||
internal record class TagObserver(IObserver<TagsProviderMessage> Observer, string? TagName);
|
internal record class TagObserver(IObserver<TagsProviderMessage> Observer, string? TagName);
|
|
@ -1,5 +0,0 @@
|
||||||
global using ProSol.Web.Html.Tools;
|
|
||||||
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("ProSol.Web.Html.Tests")]
|
|
|
@ -1,9 +1,9 @@
|
||||||
using ProSol.Web.Html.Contracts.Data;
|
using ProSol.Html.Contracts.Data;
|
||||||
using ProSol.Web.Html.Contracts.Operations;
|
using ProSol.Html.Contracts.Operations;
|
||||||
using ProSol.Web.Html.Data;
|
using ProSol.Html.Data;
|
||||||
using ProSol.Web.Html.Messaging;
|
using ProSol.Html.Messaging;
|
||||||
|
|
||||||
namespace ProSol.Web.Html;
|
namespace ProSol.Html;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes the html input, provides push-notifications when html tag met for <see cref="IObserver<TagsProviderMessage"/>.
|
/// Processes the html input, provides push-notifications when html tag met for <see cref="IObserver<TagsProviderMessage"/>.
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Tools.Extracting;
|
namespace ProSol.Html.Tools.Extracting;
|
||||||
|
|
||||||
internal static class AttributeExtractor
|
internal static class AttributeExtractor
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Tools.Extracting;
|
namespace ProSol.Html.Tools.Extracting;
|
||||||
|
|
||||||
internal sealed class AttributeValuesExtractor
|
internal sealed class AttributeValuesExtractor
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Tools.Extracting;
|
namespace ProSol.Html.Tools.Extracting;
|
||||||
|
|
||||||
internal sealed class TagNameExtractor
|
internal sealed class TagNameExtractor
|
||||||
{
|
{
|
|
@ -1,8 +1,8 @@
|
||||||
using ProSol.Web.Html.Contracts.Data;
|
using ProSol.Html.Contracts.Data;
|
||||||
using ProSol.Web.Html.Data;
|
using ProSol.Html.Data;
|
||||||
using ProSol.Web.Html.Tools.Extracting;
|
using ProSol.Html.Tools.Extracting;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tools;
|
namespace ProSol.Html.Tools;
|
||||||
|
|
||||||
internal class HistoryTracker
|
internal class HistoryTracker
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Tools;
|
namespace ProSol.Html.Tools;
|
||||||
|
|
||||||
internal static class StringExtensions
|
internal static class StringExtensions
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using ProSol.Web.Html.Data;
|
using ProSol.Html.Data;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tools;
|
namespace ProSol.Html.Tools;
|
||||||
|
|
||||||
internal static class TagDetector
|
internal static class TagDetector
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace ProSol.Web.Html.Tools;
|
namespace ProSol.Html.Tools;
|
||||||
|
|
||||||
internal static class TagsNavigator
|
internal static class TagsNavigator
|
||||||
{
|
{
|
5
src/Usings.cs
Normal file
5
src/Usings.cs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
global using ProSol.Html.Tools;
|
||||||
|
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("ProSol.Html.Tests")]
|
|
@ -1,22 +1,25 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>ProSol.Web.Html.TagsProvider</id>
|
<id>ProSol.Html.TagsProvider</id>
|
||||||
<title>ProSol.Web.Html.TagsProvider</title>
|
<title>ProSol.Html.TagsProvider</title>
|
||||||
<version>1.0.1</version>
|
<version>1.0.2</version>
|
||||||
<authors>Alex Kozachenko</authors>
|
<authors>Alex Kozachenko</authors>
|
||||||
<owners>Alex Kozachenko</owners>
|
<owners>Alex Kozachenko</owners>
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<license type="expression">MIT</license>
|
<license type="expression">MIT</license>
|
||||||
<readme type="file">docs\Readme.md</readme>
|
<readme type="file">docs\Readme.md</readme>
|
||||||
<description>A tool for extracting tags from HTML, via push-notifications. </description>
|
<description>
|
||||||
|
TagsProvider is a tool for extracting HTML tags from a string, in event-driven way.
|
||||||
|
Helps to extract text, structured data, from a specific site.
|
||||||
|
</description>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<group targetFramework="net8.0" />
|
<group targetFramework="net8.0" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<tags> tool extraction html observer observer-pattern </tags>
|
<tags> tool extraction web html observer observer-pattern design-patterns </tags>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="bin\Release\net8.0\ProSol.Web.Html.dll" target="lib\net8.0" />
|
<file src="bin\Release\net8.0\ProSol.Html.dll" target="lib\net8.0" />
|
||||||
<file src="..\Readme.md" target="docs\" />
|
<file src="..\Readme.md" target="docs\" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
|
@ -1,7 +1,7 @@
|
||||||
using ProSol.Web.Html;
|
using ProSol.Html;
|
||||||
using ProSol.Web.Html.Tests.TestHelpers;
|
using ProSol.Html.Tests.TestHelpers;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tests.KnownIssues;
|
namespace ProSol.Html.Tests.KnownIssues;
|
||||||
|
|
||||||
public class TagsProvider_KnownIssues
|
public class TagsProvider_KnownIssues
|
||||||
{
|
{
|
|
@ -19,7 +19,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ProSol.Web.Html\ProSol.Web.Html.csproj" />
|
<ProjectReference Include="..\src\ProSol.Html.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
|
@ -1,7 +1,7 @@
|
||||||
using ProSol.Web.Html;
|
using ProSol.Html;
|
||||||
using ProSol.Web.Html.Tests.TestHelpers;
|
using ProSol.Html.Tests.TestHelpers;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tests;
|
namespace ProSol.Html.Tests;
|
||||||
|
|
||||||
public class TagsProvider_MessageHistory_Tests
|
public class TagsProvider_MessageHistory_Tests
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using ProSol.Web.Html;
|
using ProSol.Html;
|
||||||
using ProSol.Web.Html.Tests.TestHelpers;
|
using ProSol.Html.Tests.TestHelpers;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tests;
|
namespace ProSol.Html.Tests;
|
||||||
|
|
||||||
public class TagsProvider_MultipleTags_Tests
|
public class TagsProvider_MultipleTags_Tests
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using ProSol.Web.Html;
|
using ProSol.Html;
|
||||||
using ProSol.Web.Html.Tests.TestHelpers;
|
using ProSol.Html.Tests.TestHelpers;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tests;
|
namespace ProSol.Html.Tests;
|
||||||
|
|
||||||
public class TagsProvider_NamedListeners_Tests
|
public class TagsProvider_NamedListeners_Tests
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using ProSol.Web.Html;
|
using ProSol.Html;
|
||||||
using ProSol.Web.Html.Tests.TestHelpers;
|
using ProSol.Html.Tests.TestHelpers;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tests;
|
namespace ProSol.Html.Tests;
|
||||||
|
|
||||||
public class TagsProvider_SingleTag_Tests
|
public class TagsProvider_SingleTag_Tests
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using ProSol.Web.Html.Contracts.Data;
|
using ProSol.Html.Contracts.Data;
|
||||||
|
|
||||||
namespace ProSol.Web.Html.Tests.TestHelpers;
|
namespace ProSol.Html.Tests.TestHelpers;
|
||||||
|
|
||||||
internal class TagsProviderListener : IObserver<TagsProviderMessage>
|
internal class TagsProviderListener : IObserver<TagsProviderMessage>
|
||||||
{
|
{
|
Loading…
Reference in a new issue