From 334b9661b0d5062900513e0268f1eb35c9caa889 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Tue, 12 Jan 2016 18:21:46 +0000 Subject: [PATCH] Avoid adding an extra blank line before Bug: T86917 Change-Id: I44209ca4549f6eb40f5ba5d94d81b59f8a75fa79 --- modules/ext.templateDataGenerator.ui.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/modules/ext.templateDataGenerator.ui.js b/modules/ext.templateDataGenerator.ui.js index 0aa98f42..a9f90967 100644 --- a/modules/ext.templateDataGenerator.ui.js +++ b/modules/ext.templateDataGenerator.ui.js @@ -158,16 +158,19 @@ '\n' + newTemplateData + '\n' ); } else { - if ( isPageSubLevel ) { - // Add the - finalOutput = fullWikitext + '\n\n' + + finalOutput = fullWikitext; + if ( fullWikitext.substr( -1 ) !== '\n' ) { + finalOutput += '\n'; + } + + if ( !isPageSubLevel ) { + finalOutput += '\n'; + } + finalOutput += '\n' + newTemplateData + '\n\n'; - } else { - // If we are not in a subpage, add tags - finalOutput = fullWikitext + '\n\n\n' + - newTemplateData + - '\n\n\n'; + if ( !isPageSubLevel ) { + finalOutput += '\n'; } } return finalOutput;