mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-27 17:20:01 +00:00
Merge "Try to put TemplateData in an existing noinclude at bottom of the page"
This commit is contained in:
commit
a99d959959
|
@ -149,6 +149,7 @@
|
|||
replaceTemplateData = function ( newTemplateData ) {
|
||||
var finalOutput,
|
||||
fullWikitext = $textbox.val(),
|
||||
endNoIncludeLength = '</noinclude>'.length,
|
||||
parts = fullWikitext.match(
|
||||
/<templatedata>([\s\S]*?)<\/templatedata>/i
|
||||
);
|
||||
|
@ -161,12 +162,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