public SortMetaData ( string articleText, string articleTitle ) : string | ||
articleText | string | The wiki text of the article. |
articleTitle | string | The article title. |
Результат | string |
/// <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; }