Merge "Avoid adding an extra blank line before <noinclude>"

This commit is contained in:
jenkins-bot 2016-01-12 20:00:45 +00:00 committed by Gerrit Code Review
commit 89b3889005

View file

@ -158,16 +158,19 @@
'<templatedata>\n' + newTemplateData + '\n</templatedata>'
);
} else {
if ( isPageSubLevel ) {
// Add the <templatedata>
finalOutput = fullWikitext + '\n<templatedata>\n' +
finalOutput = fullWikitext;
if ( fullWikitext.substr( -1 ) !== '\n' ) {
finalOutput += '\n';
}
if ( !isPageSubLevel ) {
finalOutput += '<noinclude>\n';
}
finalOutput += '<templatedata>\n' +
newTemplateData +
'\n</templatedata>\n';
} else {
// If we are not in a subpage, add <noinclude> tags
finalOutput = fullWikitext + '\n<noinclude>\n<templatedata>\n' +
newTemplateData +
'\n</templatedata>\n</noinclude>\n';
if ( !isPageSubLevel ) {
finalOutput += '</noinclude>\n';
}
}
return finalOutput;