lib/html2wt/WikitextEscapeHandlers.js
function hasBlocksOnLine(node, first) {

	// special case for firstNode:
	// we're at sol so ignore possible \n at first char
	if (first) {
		if (node.textContent.substring(1).match(/\n/)) {
			return false;
		}
		node = node.nextSibling;
	}

	while (node) {
		if (DOMUtils.isElt(node)) {
			if (DOMUtils.isBlockNode(node)) {
				return !startsOnANewLine(node);
			}
			if (node.hasChildNodes()) {
				if (hasBlocksOnLine(node.firstChild, false)) {
					return true;
				}
			}
		} else {
			if (node.textContent.match(/\n/)) {
				return false;
			}
		}
		node = node.nextSibling;
	}
	return false;
}
function hasBlocksOnLine(node, first) {

	// special case for firstNode:
	// we're at sol so ignore possible \n at first char
	if (first) {
		if (node.textContent.substring(1).match(/\n/)) {
			return false;
		}
		node = node.nextSibling;
	}

	while (node) {
		if (DOMUtils.isElt(node)) {
			if (DOMUtils.isBlockNode(node)) {
				return !startsOnANewLine(node);
			}
			if (node.hasChildNodes()) {
				if (hasBlocksOnLine(node.firstChild, false)) {
					return true;
				}
			}
		} else {
			if (node.textContent.match(/\n/)) {
				return false;
			}
		}
		node = node.nextSibling;
	}
	return false;
}
function hasBlocksOnLine ( node , first ) { // special case for firstNode: // we're at sol so ignore possible \n at first char if ( first ) { if ( node . textContent . substring ( 1 ) . match ( / \n / ) ) { return false ; } node = node . nextSibling ; } while ( node ) { if ( DOMUtils . isElt ( node ) ) { if ( DOMUtils . isBlockNode ( node ) ) { return ! startsOnANewLine ( node ) ; } if ( node . hasChildNodes ( ) ) { if ( hasBlocksOnLine ( node . firstChild , false ) ) { return true ; } } } else { if ( node . textContent . match ( / \n / ) ) { return false ; } } node = node . nextSibling ; } return false ; }
look ahead on current line for block content
look ahead on current line for block content