You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"sourcePage": "Asian relations with Northeast India",
6
6
"targetPage": "Foreign relations of India",
7
7
"nominationName": "Asian relations with Northeast India (2nd nomination)",
8
8
"dateOfClosure": "April 2026",
9
9
"expectedWikicode": "{{Being merged from|Asian relations with Northeast India|afd=Asian relations with Northeast India (2nd nomination)|date=April 2026}}\nTest"
"sourcePage": "Asian relations with Northeast India",
14
14
"targetPage": "Foreign relations of India",
15
15
"nominationName": "Asian relations with Northeast India (2nd nomination)",
16
16
"dateOfClosure": "April 2026",
17
17
"expectedWikicode": "{{Being merged from|Asian relations with Northeast India|afd=Asian relations with Northeast India (2nd nomination)|date=April 2026}}\nTest"
// test: does not contain any of {{Merge}}, {{Merge from}}, {{Being merged}}, {{Being merged from}}, {{Merge portions from}}
177
-
// place {{Being merged from|Source article|afd=NominationName|date=Date of the closure}} at top
178
-
// remove all of {{Merge to}}, {{Being merged to}}, {{Articles for deletion/dated}}, and {{Articles for deletion/dated}}'s hidden comments
179
-
180
-
// case sensitive version of the above
181
-
// various parameter counts for the above (0, 1, 2)
182
-
// test for some common redirects of the above templates
183
-
// test for no "remove all of"'s being present
184
-
// first nomination (blank), second nomination (not blank)
185
-
186
-
// test: contains 2 or more of {{Merge}}, {{Merge from}}, {{Being merged}}, {{Being merged from}}, {{Merge portions from}}
187
-
// remove all but the bottom one
188
-
// then perform the steps in the next test
189
-
190
-
// test: contains exactly 1 of {{Merge}}, {{Merge from}}, {{Being merged}}, {{Being merged from}}, {{Merge portions from}}, and has the correct |1= and |afd= parameters
191
-
// remove template
192
-
// replace with {{Being merged from|Source article|afd=NominationName|date=Date of the closure}} in the same spot
193
-
194
-
// test: contains exactly 1 of {{Merge}}, {{Merge from}}, {{Being merged}}, {{Being merged from}}, {{Merge portions from}}, and has a mismatch of any of the following parameters: |1= and |afd= parameters
195
-
// remove template (including hidden comments around {{Articles for deletion/dated}})
196
-
// place {{Being merged from|Source article|afd=NominationName|date=Date of the closure}} at the top of the article, but below hatnotes
197
-
198
-
// aliases of the parameter afd (discuss, discussion, talk)
"Merge from",/* aliases: */"Merge-from","Include","Mergefrom-multiple","Multiplemergefrom","Mergefrommulti","Mergefrommultiple","Multimergefrom","Mergefrom-category","MergeFrom","Mergefrom","Merge from draft","Merge from AfD",
// if present, delete {{Merge to}}, {{being merged to}}, {{Article for deletion/dated}}, or one of their redirects. When removing {{Article for deletion/dated}} or its redirects, also remove the <! -- hidden comments -- > around it -- > (XFDcloser already does this, but only on the source article)
// remove all of them except the last one (when removing {{Article for deletion/dated}}, also remove the hidden comments as above).
135
+
// remove all of them except the last one
117
136
}
118
-
constsourceArticleMatches=/* TODO */false;// check whether the existing |1="Source article" matches the article that was nominated
119
-
constnominationNameMatches=/* TODO */false;// check whether the |afd= parameter (or one of its aliases: discuss, discussion, talk) contains the correct NominationName (e.g., Earth (8th nomination))
137
+
constsourceArticleMatches=/* TODO */false;// check whether the existing |1="Source article" matches the article that was nominated. missing parameter = mismatch.
138
+
constnominationNameMatches=/* TODO */false;// check whether the |afd= parameter (or one of its aliases: discuss, discussion, talk) contains the correct NominationName (e.g., Earth (8th nomination)). missing parameter = mismatch.
120
139
if(sourceArticleMatches&&nominationNameMatches){
121
140
// replace template with {{Being merged from|Source article|afd=NominationName|date=Date of the closure}} on the exact same line
122
141
}else{
123
-
// replace template with {{Being merged from|Source article|afd=NominationName|date=Date of the closure}} at the top of the article, but below hatnotes
142
+
// remove template
143
+
// add {{Being merged from|Source article|afd=NominationName|date=Date of the closure}} at the top of the article, but below hatnotes
124
144
}
125
145
}
126
146
returnnewWikicode;
127
147
}
128
148
149
+
/**
150
+
* @param {string|array} templateNames
151
+
*/
152
+
deleteTemplatesIfPresent(templateNames,wikicode){
153
+
if(typeoftemplateNames==="string"){
154
+
templateNames=[templateNames];
155
+
}
156
+
for(consttemplateNameoftemplateNames){
157
+
// if it's on its own line, also delete the line break at the end
0 commit comments