/// <summary>
/// Hides images, external links, templates, headings
/// </summary>
public string HideMore(string ArticleText, bool HideOnlyTargetOfWikilink)
{
MoreHide.Clear();
string ArticleTextBefore;
do
{ // hide nested templates
ArticleTextBefore = ArticleText;
List <Match> matches = Parsers.GetTemplates(ArticleText, Parsers.EveryTemplate);
ReplaceMore(matches, ref ArticleText);
}while (!ArticleTextBefore.Equals(ArticleText));
ReplaceMore(WikiRegexes.Blockquote.Matches(ArticleText), ref ArticleText);
ReplaceMore(WikiRegexes.Source.Matches(ArticleText), ref ArticleText);
ReplaceMore(WikiRegexes.Code.Matches(ArticleText), ref ArticleText);
if (HideExternalLinks)
{
ReplaceMore(WikiRegexes.ExternalLinks.Matches(ArticleText), ref ArticleText);
}
ReplaceMore(WikiRegexes.Headings.Matches(ArticleText), ref ArticleText);
ReplaceMore(WikiRegexes.UnFormattedText.Matches(ArticleText), ref ArticleText);
ReplaceMore(WikiRegexes.IndentedText.Matches(ArticleText), ref ArticleText);
// This hides internal wikilinks (with or without pipe) with extra word character(s) e.g. [[link]]age, which need hiding even if hiding for typo fixing
// http://en.wikipedia.org/wiki/Wikipedia_talk:AutoWikiBrowser/Feature_requests#Improve_HideText.HideMore.28.29
// place this as first wikilink rule as otherwise WikiLinksOnly will grab link without extra word character(s)
ReplaceMore(WikiRegexes.WikiLinksOnlyPlusWord.Matches(ArticleText), ref ArticleText);
// if HideOnlyTargetOfWikilink is not set, pipes of links e.g. [[target|pipe]] will be hidden
// if set then don't mask the pipe of a link so that typo fixing can be done on it
if (!HideOnlyTargetOfWikilink)
{
ReplaceMore(WikiRegexes.WikiLinksOnly.Matches(ArticleText), ref ArticleText);
ReplaceMore(WikiRegexes.SimpleWikiLink.Matches(ArticleText), ref ArticleText);
}
ReplaceMore(WikiRegexes.Cites.Matches(ArticleText), ref ArticleText);
ReplaceMore(WikiRegexes.Refs.Matches(ArticleText), ref ArticleText);
// this hides only the target of a link, leaving the pipe exposed
ReplaceMore(WikiRegexes.WikiLink.Matches(ArticleText), ref ArticleText);
//TODO: replace with gallery-only regex, all normal images should be hidden by now as simple wikilinks
ReplaceMore(WikiRegexes.Images.Matches(ArticleText), ref ArticleText);
// hide untemplated quotes between some form of quotation marks (most particularly for typo fixing)
ReplaceMore(WikiRegexes.UntemplatedQuotes.Matches(ArticleText), ref ArticleText);
return(ArticleText);
}