本文整理汇总了C#中WikiFunctions.Parse.Parsers.SortMetaData方法的典型用法代码示例。如果您正苦于以下问题:C# Parsers.SortMetaData方法的具体用法?C# Parsers.SortMetaData怎么用?C# Parsers.SortMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiFunctions.Parse.Parsers
的用法示例。
在下文中一共展示了Parsers.SortMetaData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMissingReflist
/// <summary>
/// First checks for a <references< missing '/' to correct, otherwise:
/// if the article uses cite references but has no recognised template to display the references, add {{Reflist}} in the appropriate place
/// </summary>
/// <param name="articleText">The wiki text of the article</param>
/// <returns>The updated article text</returns>
public static string AddMissingReflist(string articleText)
{
if (!IsMissingReferencesDisplay(articleText) || !Variables.LangCode.Equals("en"))
return articleText;
if (ReferencesMissingSlash.IsMatch(articleText))
return ReferencesMissingSlash.Replace(articleText, @"<references/>");
// Rename ==Links== to ==External links==
articleText = LinksHeading.Replace(articleText, "$1External links$2");
// add to any existing references section if present
if (ReferencesHeadingLevel2.IsMatch(articleText))
articleText = ReferencesHeadingLevelLower.Replace(articleText, "$1\r\n{{Reflist}}");
else
{
articleText += "\r\n==References==\r\n{{Reflist}}";
// now sort metadata in case Category at top of article
Parsers p = new Parsers();
articleText = p.SortMetaData(articleText, "A", false);
// try to move just above external links
if (ExternalLinksHeading.IsMatch(articleText))
articleText = ExternalLinksToReferences.Replace(articleText, "$2\r\n$1");
else if (Category.IsMatch(articleText))
// try to move just above categories
articleText = CategoryToReferences.Replace(articleText, "$3\r\n$1$2");
else // not moved, so extra blank line required before heading
articleText = articleText.Replace("\r\n==References==", "\r\n\r\n==References==");
}
return articleText;
}