Skip to content

Commit 187d34c

Browse files
author
Rob Wilmshurst
committed
T385306 Don't pull interwikis out of template calls
git-svn-id: https://svn.code.sf.net/p/autowikibrowser/code/AWB@12771 5227b50d-9349-4574-b055-4b0a7525e11c
1 parent c7b5f44 commit 187d34c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

UnitTests/SorterTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,12 @@ The following links are here to prevent the interwiki bot from adding them to th
17601760
[[fr:Canadien National]]";
17611761
// TODO: Seemingly broken during UnitTest migration
17621762
// Assert.That(parser2.Sorter.Interwikis(ref a), Is.EqualTo(a + "\r\n"), "first letter casing retained for jbo-wiki links");
1763+
1764+
string i = @"{{Canadianmetros|
1765+
[[it:CN]]
1766+
[[sv:CN]]
1767+
}}";
1768+
Assert.That(parser2.Sorter.Interwikis(ref i), Is.Empty, "interwikis not taken out of templates");
17631769
}
17641770

17651771
[Test]

WikiFunctions/Parse/MetaDataSorter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,12 +1170,14 @@ private List<string> RemoveInterWikis(ref string articleText)
11701170

11711171
List<Match> goodMatches = new List<Match>();
11721172
List<string> interWikiListLinksOnly = new List<string>();
1173+
List<string> allTemplates = Parsers.GetAllTemplateDetail(articleText);
11731174

11741175
foreach (Match m in WikiRegexes.PossibleInterwikis.Matches(articleText))
11751176
{
11761177
string site = m.Groups[1].Value.Trim().ToLower();
11771178

1178-
if (!PossibleInterwikis.Contains(site))
1179+
// ignore interwikis in template calls
1180+
if (!PossibleInterwikis.Contains(site) || allTemplates.Any((t => t.Contains((m.Value)))))
11791181
continue;
11801182

11811183
if (unformattedText.Contains(m.Value))

0 commit comments

Comments
 (0)