move PocketSharp.Reader
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
namespace ReadSharp.Ports.NReadability
|
||||
{
|
||||
public static class HtmlUtils
|
||||
{
|
||||
public static string RemoveScriptTags(string htmlContent)
|
||||
{
|
||||
if (htmlContent == null)
|
||||
{
|
||||
throw new ArgumentNullException("htmlContent");
|
||||
}
|
||||
|
||||
if (htmlContent.Length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
int indexOfScriptTagStart = htmlContent.IndexOf("<script", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (indexOfScriptTagStart == -1)
|
||||
{
|
||||
return htmlContent;
|
||||
}
|
||||
|
||||
int indexOfScriptTagEnd = htmlContent.IndexOf("</script>", indexOfScriptTagStart, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (indexOfScriptTagEnd == -1)
|
||||
{
|
||||
return htmlContent.Substring(0, indexOfScriptTagStart);
|
||||
}
|
||||
|
||||
string strippedHtmlContent =
|
||||
htmlContent.Substring(0, indexOfScriptTagStart) +
|
||||
htmlContent.Substring(indexOfScriptTagEnd + "</script>".Length);
|
||||
|
||||
return RemoveScriptTags(strippedHtmlContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user