本文整理匯總了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;
}