WikiCrawler/MediaWiki/WikiUtils.cs
/// <summary>
/// Remove HTML comments from the text.
/// </summary>
Remove HTML comments from the text.
Remove HTML comments from the text .
public static string RemoveComments(string text, string prefix = "<!--")
		{
			Marker start = new Marker(prefix);
			Marker end = new Marker("-->");
			int startPos = -1;
			for (int c = 0; c < text.Length; c++)
			{
				if (startPos < 0)
				{
					if (start.MatchAgainst(text[c]))
					{
						startPos = c - start.Length + 1;
					}
				}
				else
				{
					if (end.MatchAgainst(text[c]))
					{
						text = text.Substring(0, startPos) + text.Substring(c + 1);
						c = startPos - 1;
						startPos = -1;
					}
				}
			}
			return text;
		}
public static string RemoveComments ( string text , string prefix = " " ) { Marker start = new Marker ( prefix ) ; Marker end = new Marker ( " " ) ; int startPos = - 1 ; for ( int c = 0 ; c < text . Length ; c ++ ) { if ( startPos < 0 ) { if ( start . MatchAgainst ( text [ c ] ) ) { startPos = c - start . Length + 1 ; } } else { if ( end . MatchAgainst ( text [ c ] ) ) { text = text . Substring ( 0 , startPos ) + text . Substring ( c + 1 ) ; c = startPos - 1 ; startPos = - 1 ; } } } return text ; }
Remove HTML comments from the text.
Remove HTML comments from the text .
text
string
prefix
string