jenkins-bot has submitted this change and it was merged.
Change subject: Try to put TemplateData in an existing noinclude at bottom of
the page
......................................................................
Try to put TemplateData in an existing noinclude at bottom of the page
Bug: T96537
Change-Id: I947577179fa05c8f095906d6a36743c94dfc7b78
---
M modules/ext.templateDataGenerator.ui.js
1 file changed, 7 insertions(+), 2 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
Jforrester: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/modules/ext.templateDataGenerator.ui.js
b/modules/ext.templateDataGenerator.ui.js
index a9f9096..a3ee0fb 100644
--- a/modules/ext.templateDataGenerator.ui.js
+++ b/modules/ext.templateDataGenerator.ui.js
@@ -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 +
--
To view, visit https://gerrit.wikimedia.org/r/263641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I947577179fa05c8f095906d6a36743c94dfc7b78
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/TemplateData
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits