Wikipedia/assets/codemirror/resources/mode/mediawiki/mediawiki.js
/**
		 * Remembers position and status for rollbacking.
		 * It needed for change bold to italic with apostrophe before it if required
		 *
		 * see https://phabricator.wikimedia.org/T108455
		 *
		 * @param {Object} stream CodeMirror.StringStream
		 */
Remembers position and status for rollbacking.
It needed for change bold to italic with apostrophe before it if required




Remembers position and status for rollbacking . It needed for change bold to italic with apostrophe before it if required
function prepareItalicForCorrection( stream ) {
			var end = stream.pos,
				str = stream.string.substr( 0, end - 3 ),
				x1 = str.substr( -1, 1 ),
				x2 = str.substr( -2, 1 );
			if ( x1 === ' ' ) {
				if ( firstmultiletterword || firstspace ) {
					return;
				}
				firstspace = end;
			} else if ( x2 === ' ' ) {
				firstsingleletterword = end;
			} else if ( firstmultiletterword ) {
				return;
			} else {
				firstmultiletterword = end;
			}
			mBold = isBold;
			mItalic = isItalic;
		}
function prepareItalicForCorrection ( stream ) { var end = stream . pos , str = stream . string . substr ( 0 , end - 3 ) , x1 = str . substr ( - 1 , 1 ) , x2 = str . substr ( - 2 , 1 ) ; if ( x1 === ' ' ) { if ( firstmultiletterword || firstspace ) { return ; } firstspace = end ; } else if ( x2 === ' ' ) { firstsingleletterword = end ; } else if ( firstmultiletterword ) { return ; } else { firstmultiletterword = end ; } mBold = isBold ; mItalic = isItalic ; }
Remembers position and status for rollbacking.
Remembers position and status for rollbacking .
// see Parser::doQuotes() in MediaWiki core, it works similar // firstsingleletterword has maximum priority // firstmultiletterword has medium priority // firstspace has low priority // firstsingleletterword olways is undefined here // remember bold and italic state for restore