WikiCrawler/MediaWiki/WikiUtils.cs
/// <summary>
/// Get the sortkey of the fetched article.
/// </summary>
Get the sortkey of the fetched article.
Get the sortkey of the fetched article .
public static string GetSortkey(Article article)
		{
			if (!Article.IsNullOrEmpty(article))
			{
				string key = "{{DEFAULTSORT:";
				int defaultSort = article.revisions[0].text.IndexOf(key);
				if (defaultSort >= 0)
				{
					int defaultEnd = article.revisions[0].text.IndexOf("}}", defaultSort);
					return article.revisions[0].text.Substring(defaultSort, defaultEnd - defaultSort - key.Length - 1);
				}
				else
				{
					return article.GetTitle();
				}
			}
			else
			{
				return "";
			}
		}
public static string GetSortkey ( Article article ) { if ( ! Article . IsNullOrEmpty ( article ) ) { string key = " " ; int defaultSort = article . revisions [ 0 ] . text . IndexOf ( key ) ; if ( defaultSort >= 0 ) { int defaultEnd = article . revisions [ 0 ] . text . IndexOf ( " " , defaultSort ) ; return article . revisions [ 0 ] . text . Substring ( defaultSort , defaultEnd - defaultSort - key . Length - 1 ) ; } else { return article . GetTitle ( ) ; } } else { return " " ; } }
Get the sortkey of the fetched article.
Get the sortkey of the fetched article .
//TODO: support template transclusions
article
Article