mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-23 23:43:54 +00:00
Try to put TemplateData in an existing noinclude at bottom of the page
Bug: T96537 Change-Id: I947577179fa05c8f095906d6a36743c94dfc7b78
This commit is contained in:
parent
334b9661b0
commit
317e9a9e84
|
@ -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 +
|
||||
|
|
Loading…
Reference in a new issue