本文整理汇总了C#中WikiFunctions.Parse.HideText.AddBackUnformatted方法的典型用法代码示例。如果您正苦于以下问题:C# HideText.AddBackUnformatted方法的具体用法?C# HideText.AddBackUnformatted怎么用?C# HideText.AddBackUnformatted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFunctions.Parse.HideText
的用法示例。
在下文中一共展示了HideText.AddBackUnformatted方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tagger
//.........这里部分代码省略.........
}
}
}
// add underlinked/wikify tag, don't add underlinked/wikify if {{dead end}} already present
// Dont' tag SIA pages, may create wikilinks from templates
else if (wikiLinkCount < 3 && underlinked && !WikiRegexes.Wikify.IsMatch(articleText)
&& !WikiRegexes.MultipleIssues.Match(articleText).Value.ToLower().Contains("wikify")
&& !WikiRegexes.DeadEnd.IsMatch(articleText)
&& !WikiRegexes.SIAs.IsMatch(articleText)
&& !WikiRegexes.NonDeadEndPageTemplates.IsMatch(articleText)
&& !WikiRegexes.MeaningsOfMinorPlanetNames.IsMatch(articleTitle))
{
// Avoid excess newlines between templates
string templateEnd = "}}\r\n" + (articleText.TrimStart().StartsWith(@"{{") ? "" : "\r\n");
if (Variables.LangCode.Equals("ar"))
{
articleText = "{{ويكي|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText.TrimStart();
tagsAdded.Add("[[وب:ويكي|ويكي]]");
}
else if (Variables.LangCode.Equals("arz"))
{
articleText = "{{ويكى|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[قالب:ويكى|ويكى]]");
}
else if (Variables.LangCode.Equals("sv"))
{
articleText = "{{Ickewiki|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[WP:PW|ickewiki]]");
}
else
{
articleText = "{{Underlinked|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[CAT:UL|underlinked]]");
}
}
else if (wikiLinkCount > 3 && !underlinked &&
WikiRegexes.Wikify.IsMatch(articleText))
{
if (Variables.LangCode.Equals("ar") || Variables.LangCode.Equals("arz"))
articleText = WikiRegexes.Wikify.Replace(articleText, "");
else
// remove wikify, except section templates or wikify tags with reason parameter specified
articleText = WikiRegexes.Wikify.Replace(articleText, m => Tools.IsSectionOrReasonTemplate(m.Value, articleText) ? m.Value : m.Groups[1].Value).TrimStart();
if (!WikiRegexes.Wikify.IsMatch(articleText))
{
if (Variables.LangCode.Equals("ar"))
{
tagsRemoved.Add("ويكي");
}
else if (Variables.LangCode.Equals("arz"))
{
tagsRemoved.Add("ويكى");
}
else
{
tagsRemoved.Add("underlinked");
}
}
}
// rename unreferenced --> refimprove if has existing refs, update date
if (WikiRegexes.Unreferenced.IsMatch(commentsCategoriesStripped)
&& (TotalRefsNotGrouped(commentsCategoriesStripped) + Tools.NestedTemplateRegex("sfn").Matches(articleText).Count) > 0)
{
articleText = Unreferenced.Replace(articleText, m2 => Tools.UpdateTemplateParameterValue(Tools.RenameTemplate(m2.Value, "refimprove"), "date", "{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}"));
// update tag in old-style multiple issues
Match m = WikiRegexes.MultipleIssues.Match(articleText);
if (m.Success && Tools.GetTemplateParameterValue(m.Value, "unreferenced").Length > 0)
{
string newValue = Tools.RenameTemplateParameter(m.Value, "unreferenced", "refimprove");
newValue = Tools.UpdateTemplateParameterValue(newValue, "refimprove", "{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}");
if (!newValue.Equals(m.Value))
articleText = articleText.Replace(m.Value, newValue);
}
}
if (tagsAdded.Count > 0 || tagsRemoved.Count > 0 || tagsrenamed > 0)
{
Parsers p = new Parsers();
HideText hider = new HideText();
articleText = hider.HideUnformatted(articleText);
articleText = p.MultipleIssues(articleText);
articleText = Conversions(articleText);
articleText = hider.AddBackUnformatted(articleText);
// sort again in case tag removal requires whitespace cleanup
// Don't sort interwikis, we can't specify the correct InterWikiSortOrder
p.SortInterwikis = false;
articleText = p.Sorter.Sort(articleText, articleTitle);
}
summary = PrepareTaggerEditSummary();
return articleText;
}
示例2: TagUpdater
/// <summary>
/// Sets the date (month & year) for undated cleanup tags that take a date
/// Avoids changing tags in unformatted text areas (wiki comments etc.)
/// </summary>
/// <param name="articleText">The wiki text of the article.</param>
/// <returns>The updated article text</returns>
public static string TagUpdater(string articleText)
{
HideText ht = new HideText();
articleText = ht.HideUnformatted(articleText);
foreach (KeyValuePair<Regex, string> k in RegexTagger)
{
articleText = k.Key.Replace(articleText, k.Value);
}
return ht.AddBackUnformatted(articleText);
}
示例3: Tagger
//.........这里部分代码省略.........
articleText = Tools.NestedTemplateRegex("underlinked").Replace(articleText, "").TrimStart();
tagsRemoved.Add("underlinked");
}
}
}
// add wikify tag, don't add underlinked/wikify if {{dead end}} already present
// Dont' tag SIA pages, may create wikilinks from templates
else if (wikiLinkCount < 3 && underlinked && !WikiRegexes.Wikify.IsMatch(articleText)
&& !WikiRegexes.MultipleIssues.Match(articleText).Value.ToLower().Contains("wikify")
&& !WikiRegexes.DeadEnd.IsMatch(articleText)
&& !WikiRegexes.SIAs.IsMatch(articleText))
{
// Avoid excess newlines between templates
string templateEnd = "}}\r\n" + (articleText.StartsWith(@"{{") ? "" : "\r\n");
if (Variables.LangCode.Equals("ar"))
{
articleText = "{{ويكي|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[وب:ويكي|ويكي]]");
}
else if (Variables.LangCode.Equals("arz"))
{
articleText = "{{ويكى|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[قالب:ويكى|ويكى]]");
}
else if (Variables.LangCode.Equals("sv"))
{
articleText = "{{Wikify|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[WP:WFY|wikify]]");
}
else
{
articleText = "{{Underlinked|" + WikiRegexes.DateYearMonthParameter + templateEnd + articleText;
tagsAdded.Add("[[CAT:UL|underlinked]]");
}
}
else if (wikiLinkCount > 3 && !underlinked &&
WikiRegexes.Wikify.IsMatch(articleText))
{
if (Variables.LangCode.Equals("ar") || Variables.LangCode.Equals("arz"))
articleText = WikiRegexes.Wikify.Replace(articleText, "");
else
// remove wikify, except section templates or wikify tags with reason parameter specified
articleText = WikiRegexes.Wikify.Replace(articleText, m => Tools.IsSectionOrReasonTemplate(m.Value, articleText) ? m.Value : m.Groups[1].Value).TrimStart();
if (!WikiRegexes.Wikify.IsMatch(articleText))
{
if (Variables.LangCode.Equals("ar"))
{
tagsRemoved.Add("ويكي");
}
else if (Variables.LangCode.Equals("arz"))
{
tagsRemoved.Add("ويكى");
}
else
{
tagsRemoved.Add("underlinked");
}
}
}
// rename unreferenced --> refimprove if has existing refs, update date
if (WikiRegexes.Unreferenced.IsMatch(commentsCategoriesStripped)
&& (TotalRefsNotGrouped(commentsCategoriesStripped) + Tools.NestedTemplateRegex("sfn").Matches(articleText).Count) > 0)
{
articleText = Unreferenced.Replace(articleText, m2 => Tools.UpdateTemplateParameterValue(Tools.RenameTemplate(m2.Value, "refimprove"), "date", "{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}"));
// update tag in old-style multiple issues
Match m = WikiRegexes.MultipleIssues.Match(articleText);
if (m.Success && Tools.GetTemplateParameterValue(m.Value, "unreferenced").Length > 0)
{
string newValue = Tools.RenameTemplateParameter(m.Value, "unreferenced", "refimprove");
newValue = Tools.UpdateTemplateParameterValue(newValue, "refimprove", "{{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}");
if (!newValue.Equals(m.Value))
articleText = articleText.Replace(m.Value, newValue);
}
}
if (tagsAdded.Count > 0 || tagsRemoved.Count > 0)
{
Parsers p = new Parsers();
HideText ht = new HideText();
articleText = ht.HideUnformatted(articleText);
articleText = p.MultipleIssues(articleText);
articleText = Conversions(articleText);
articleText = ht.AddBackUnformatted(articleText);
// sort again in case tag removal requires whitespace cleanup
// Don't sort interwikis, we can't specify the correct InterWikiSortOrder
p.SortInterwikis = false;
articleText = p.Sorter.Sort(articleText, articleTitle);
}
summary = PrepareTaggerEditSummary();
return articleText;
}
示例4: Tagger
//.........这里部分代码省略.........
// nl wiki doesn't use {{Uncategorized}} template
// prevent wictionary redirects from being tagged as uncategorised
if (words > 6 && totalCategories == 0
&& !WikiRegexes.Uncat.IsMatch(articleText)
&& Variables.LangCode != "nl"
&& !Tools.NestedTemplateRegex("cat improve").IsMatch(articleText)
// category count is from API; don't add uncat tag if genfixes added person categories
&& !WikiRegexes.DeathsOrLivingCategory.IsMatch(articleText)
&& !WikiRegexes.BirthsCategory.IsMatch(articleText))
{
if (WikiRegexes.Stub.IsMatch(commentsStripped))
{
// add uncategorized stub tag
articleText += Tools.Newline("{{Uncategorized stub|", 2) + WikiRegexes.DateYearMonthParameter +
@"}}";
tagsAdded.Add("[[CAT:UNCATSTUBS|uncategorised]]");
}
else
{
// add uncategorized tag
articleText += Tools.Newline("{{Uncategorized|", 2) + WikiRegexes.DateYearMonthParameter + @"}}";
tagsAdded.Add("[[CAT:UNCAT|uncategorised]]");
}
}
// remove {{Uncategorized}} if > 0 real categories (stub categories not counted)
// rename {{Uncategorized}} to {{Uncategorized stub}} if stub with zero categories (stub categories not counted)
if (WikiRegexes.Uncat.IsMatch(articleText))
{
if (totalCategories > 0)
{
articleText = WikiRegexes.Uncat.Replace(articleText, "");
tagsRemoved.Add("uncategorised");
}
else if (totalCategories == 0 && WikiRegexes.Stub.IsMatch(commentsStripped))
{
string uncatname = WikiRegexes.Uncat.Match(articleText).Groups[1].Value;
if (!uncatname.Contains("stub"))
articleText = Tools.RenameTemplate(articleText, uncatname, "Uncategorized stub");
}
}
if (linkCount == 0 && !WikiRegexes.DeadEnd.IsMatch(articleText) && Variables.LangCode != "sv"
&& !Regex.IsMatch(WikiRegexes.MultipleIssues.Match(articleText).Value.ToLower(), @"\bdead ?end\b"))
{
// add dead-end tag
articleText = "{{dead end|" + WikiRegexes.DateYearMonthParameter + "}}\r\n\r\n" + articleText;
tagsAdded.Add("[[:Category:Dead-end pages|deadend]]");
}
if (linkCount < 3 && underlinked && !WikiRegexes.Wikify.IsMatch(articleText)
&& !WikiRegexes.MultipleIssues.Match(articleText).Value.ToLower().Contains("wikify"))
{
// add wikify tag
articleText = "{{Wikify|" + WikiRegexes.DateYearMonthParameter + "}}\r\n\r\n" + articleText;
tagsAdded.Add("[[WP:WFY|wikify]]");
}
else if (linkCount > 3 && !underlinked &&
WikiRegexes.Wikify.IsMatch(articleText))
{
articleText = WikiRegexes.Wikify.Replace(articleText, new MatchEvaluator(SectionTagME));
if(!WikiRegexes.Wikify.IsMatch(articleText))
tagsRemoved.Add("wikify");
}
// rename unreferenced --> refimprove if has existing refs
if (WikiRegexes.Unreferenced.IsMatch(commentsCategoriesStripped)
&& WikiRegexes.Refs.Matches(commentsCategoriesStripped).Count > 0)
{
articleText = Tools.RenameTemplate(articleText, "unreferenced", "refimprove", true);
Match m = WikiRegexes.MultipleIssues.Match(articleText);
if(m.Success)
{
string newValue = Tools.RenameTemplateParameter(m.Value, "unreferenced", "refimprove");
if(!newValue.Equals(m.Value))
articleText = articleText.Replace(m.Value, newValue);
}
}
if (tagsAdded.Count > 0 || tagsRemoved.Count > 0)
{
Parsers p = new Parsers();
HideText ht = new HideText();
articleText = ht.HideUnformatted(articleText);
articleText = p.MultipleIssues(articleText);
articleText = Conversions(articleText);
articleText = ht.AddBackUnformatted(articleText);
// sort again in case tag removal requires whitespace cleanup
articleText = p.Sorter.Sort(articleText, articleTitle);
}
summary = PrepareTaggerEditSummary();
return articleText;
}
示例5: TagUpdater
/// <summary>
/// Sets the date (month & year) for undated cleanup tags that take a date
/// Avoids changing tags in unformatted text areas (wiki comments etc.)
/// Note: bugzilla 2700 means {{ssubst}} within ref tags doesn't work, AWB doesn't do anything about it
/// </summary>
/// <param name="articleText">The wiki text of the article.</param>
/// <returns>The updated article text</returns>
public static string TagUpdater(string articleText)
{
HideText ht = new HideText();
articleText = ht.HideUnformatted(articleText);
foreach (KeyValuePair<Regex, string> k in RegexTagger)
{
articleText = k.Key.Replace(articleText,
m => (Tools.GetTemplateParameterValue(m.Value, "Date").Length > 0 ?
Tools.RenameTemplateParameter(m.Value, "Date", "date") : k.Value.Replace("$1", m.Groups[1].Value)));
}
return ht.AddBackUnformatted(articleText);
}