Try to put TemplateData in an existing noinclude at bottom of the page

Bug: T96537
Change-Id: I947577179fa05c8f095906d6a36743c94dfc7b78
This commit is contained in:
Alex Monk 2016-01-12 18:44:23 +00:00
parent 334b9661b0
commit 317e9a9e84

View file

@ -147,6 +147,7 @@
replaceTemplateData = function ( newTemplateData ) {
var finalOutput,
fullWikitext = $textbox.val(),
endNoIncludeLength = '</noinclude>'.length,
parts = fullWikitext.match(
/<templatedata>([\s\S]*?)<\/templatedata>/i
);
@ -159,12 +160,16 @@
);
} else {
finalOutput = fullWikitext;
if ( fullWikitext.substr( -1 ) !== '\n' ) {
if ( finalOutput.substr( -1 ) !== '\n' ) {
finalOutput += '\n';
}
if ( !isPageSubLevel ) {
finalOutput += '<noinclude>\n';
if ( finalOutput.substr( -endNoIncludeLength - 1 ) === '</noinclude>\n' ) {
finalOutput = finalOutput.substr( 0, finalOutput.length - endNoIncludeLength - 1 );
} else {
finalOutput += '<noinclude>\n';
}
}
finalOutput += '<templatedata>\n' +
newTemplateData +