diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js index b8f4e01f89..a4acb11fdc 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js @@ -193,5 +193,13 @@ ve.ui.MWExtensionInspector.prototype.getTeardownProcess = function ( data ) { * @param {Object} mwData MediaWiki data object */ ve.ui.MWExtensionInspector.prototype.updateMwData = function ( mwData ) { - mwData.body.extsrc = this.whitespace[0] + this.input.getValue() + this.whitespace[1]; + var tagName = mwData.name, + value = this.input.getValue(); + + // XML-like tags in wikitext are not actually XML and don't expect their contents to be escaped. + // This means that it is not possible for a tag '' to contain the string ''. + // Prevent that by escaping the first angle bracket '<' to '<'. (bug 57429) + value = value.replace( new RegExp( '<(/' + tagName + '\\s*>)', 'gi' ), '<$1' ); + + mwData.body.extsrc = this.whitespace[0] + value + this.whitespace[1]; };