[MediaWiki-commits] [Gerrit] Mask templates in table style definitions - change (mediawiki...BlueSpiceExtensions)
Robert Vogel has submitted this change and it was merged. Change subject: Mask templates in table style definitions .. Mask templates in table style definitions This masks templates in table, tr, td, and th style definitions, as they cannot be rendered in TinyMCE. Change-Id: I7ce5b2109049f8991b883852f704e17aa6f2b9c7 --- M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js 1 file changed, 31 insertions(+), 0 deletions(-) Approvals: Robert Vogel: Verified; Looks good to me, approved Tweichart: Checked; Looks good to me, but someone else must approve diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js index f6595ce..ffcbe9e 100644 --- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js +++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js @@ -2197,6 +2197,34 @@ text = text.replace(/span class=toggletext([\s\S]*?)\/span/gmi, '$1'); } + // mark templates in table headers, as they cannot be rendered + var i = 0; + while (text.match(/^(\{\|.*?)(\{\{(.*?)\}\})(.*?)$/gmi)) { + text = text.replace(/^(\{\|.*?)(\{\{(.*?)\}\})(.*?)$/gmi, '$1 data-bs-table-tpl'+i+'=$3$4'); + i++; + } + + // mark templates in row definitions, as they cannot be rendered + var i = 0; + while (text.match(/^(\|-.*?)(\{\{(.*?)\}\})(.*?)$/gmi)) { + text = text.replace(/^(\|-.*?)(\{\{(.*?)\}\})(.*?)$/gmi, '$1 data-bs-tr-tpl'+i+'=$3$4'); + i++; + } + + // mark templates in header definitions, as they cannot be rendered + var i = 0; + while (text.match(/^(!.*?)(\{\{(.*?)\}\})(.*?\|)/gmi)) { + text = text.replace(/^(!.*?)(\{\{(.*?)\}\})(.*?\|)/gmi, '$1 data-bs-th-tpl'+i+'=$3$4'); + i++; + } + + // mark templates in cell definitions, as they cannot be rendered + var i = 0; + while (text.match(/^(\|.*?)(\{\{(.*?)\}\})(.*?\|)/gmi)) { + text = text.replace(/^(\|.*?)(\{\{(.*?)\}\})(.*?\|)/gmi, '$1 data-bs-td-tpl'+i+'=$3$4'); + i++; + } + //special tags before pres prevents spaces in special tags like GeSHi to take effect text = _preserveSpecialTags(text); @@ -2280,6 +2308,9 @@ } e.content = _recoverSpecialTags(e.content); + + // cleanup templates in table markers + e.content = e.content.replace(/data-bs-t.*?-tpl.*?=(.*?)/gmi, {{$1}}); } } -- To view, visit https://gerrit.wikimedia.org/r/195581 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7ce5b2109049f8991b883852f704e17aa6f2b9c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: master Gerrit-Owner: Mglaser gla...@hallowelt.biz Gerrit-Reviewer: Pigpen reym...@hallowelt.biz Gerrit-Reviewer: Robert Vogel vo...@hallowelt.biz Gerrit-Reviewer: Tweichart weich...@hallowelt.biz Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Mask templates in table style definitions - change (mediawiki...BlueSpiceExtensions)
Mglaser has uploaded a new change for review. https://gerrit.wikimedia.org/r/195581 Change subject: Mask templates in table style definitions .. Mask templates in table style definitions This masks templates in table, tr, td, and th style definitions, as they cannot be rendered in TinyMCE. Change-Id: I7ce5b2109049f8991b883852f704e17aa6f2b9c7 --- M VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js 1 file changed, 31 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions refs/changes/81/195581/1 diff --git a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js index f6595ce..ffcbe9e 100644 --- a/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js +++ b/VisualEditor/resources/tiny_mce_plugins/bswikicode/plugin.js @@ -2197,6 +2197,34 @@ text = text.replace(/span class=toggletext([\s\S]*?)\/span/gmi, '$1'); } + // mark templates in table headers, as they cannot be rendered + var i = 0; + while (text.match(/^(\{\|.*?)(\{\{(.*?)\}\})(.*?)$/gmi)) { + text = text.replace(/^(\{\|.*?)(\{\{(.*?)\}\})(.*?)$/gmi, '$1 data-bs-table-tpl'+i+'=$3$4'); + i++; + } + + // mark templates in row definitions, as they cannot be rendered + var i = 0; + while (text.match(/^(\|-.*?)(\{\{(.*?)\}\})(.*?)$/gmi)) { + text = text.replace(/^(\|-.*?)(\{\{(.*?)\}\})(.*?)$/gmi, '$1 data-bs-tr-tpl'+i+'=$3$4'); + i++; + } + + // mark templates in header definitions, as they cannot be rendered + var i = 0; + while (text.match(/^(!.*?)(\{\{(.*?)\}\})(.*?\|)/gmi)) { + text = text.replace(/^(!.*?)(\{\{(.*?)\}\})(.*?\|)/gmi, '$1 data-bs-th-tpl'+i+'=$3$4'); + i++; + } + + // mark templates in cell definitions, as they cannot be rendered + var i = 0; + while (text.match(/^(\|.*?)(\{\{(.*?)\}\})(.*?\|)/gmi)) { + text = text.replace(/^(\|.*?)(\{\{(.*?)\}\})(.*?\|)/gmi, '$1 data-bs-td-tpl'+i+'=$3$4'); + i++; + } + //special tags before pres prevents spaces in special tags like GeSHi to take effect text = _preserveSpecialTags(text); @@ -2280,6 +2308,9 @@ } e.content = _recoverSpecialTags(e.content); + + // cleanup templates in table markers + e.content = e.content.replace(/data-bs-t.*?-tpl.*?=(.*?)/gmi, {{$1}}); } } -- To view, visit https://gerrit.wikimedia.org/r/195581 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ce5b2109049f8991b883852f704e17aa6f2b9c7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions Gerrit-Branch: master Gerrit-Owner: Mglaser gla...@hallowelt.biz ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits