Add init weapon scraper
This commit is contained in:
14
BlueLaminate/BlueLaminate.Scraper/Wiki/WikiText.cs
Normal file
14
BlueLaminate/BlueLaminate.Scraper/Wiki/WikiText.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using HtmlAgilityPack;
|
||||
|
||||
namespace BlueLaminate.Scraper.Wiki;
|
||||
|
||||
/// <summary>Text helpers shared by wiki scrapers.</summary>
|
||||
public static class WikiText
|
||||
{
|
||||
private static readonly Regex Whitespace = new(@"\s+", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>Decodes HTML entities and collapses whitespace runs to single spaces.</summary>
|
||||
public static string Normalize(string raw) =>
|
||||
Whitespace.Replace(HtmlEntity.DeEntitize(raw) ?? string.Empty, " ").Trim();
|
||||
}
|
||||
Reference in New Issue
Block a user