// 日本語版みたいに、#REDIRECTと言語固有の#転送みたいなのがあると思われるので、
// 翻訳元言語とデフォルトの設定でチェック
- string lower = s.ToLower();
+ string trim = s.TrimStart();
+ string lower = trim.ToLower();
for (int i = 0; i < 2; i++)
{
string format = this.Website.Redirect;
if (!String.IsNullOrEmpty(format)
&& lower.StartsWith(format.ToLower()))
{
- if (this.LinkParser.TryParse(s.Substring(format.Length).TrimStart(), out result))
+ // "#REDIRECT "の部分をカットして後ろの[[~]]の部分のリンクを解析
+ if (this.LinkParser.TryParse(trim.Substring(format.Length).TrimStart(), out result))
{
return true;
}
Assert.AreEqual("Test", link.Title);
Assert.AreEqual("Section", link.Section);
+ // リダイレクトの前にスペースや空行があってもOK
+ Assert.IsTrue(parser.TryParseToEndCondition(" \r\n \r\n#REDIRECT [[ Test2 ]] \r\n \r\n", null, out element));
+ Assert.IsInstanceOf(typeof(MediaWikiLink), element);
+ link = (MediaWikiLink)element;
+ Assert.AreEqual("Test2", link.Title);
+ Assert.IsNull(link.Section);
+
// 普通の記事
Assert.IsFalse(parser.TryParseToEndCondition("'''Example''' may refer to:", null, out element));
Assert.IsNull(element);