lib/html2wt/separators.js
function getSepNlConstraints(state, nodeA, aCons, nodeB, bCons) {
	const env = state.env;

	const nlConstraints = {
		min: aCons.min,
		max: aCons.max,
		force: aCons.force || bCons.force,
	};

	// now figure out if this conflicts with the nlConstraints so far
	if (bCons.min !== undefined) {
		if (nlConstraints.max !== undefined && nlConstraints.max < bCons.min) {
			// Conflict, warn and let nodeB win.
			env.log("info/html2wt", "Incompatible constraints 1:", nodeA.nodeName,
					nodeB.nodeName, loggableConstraints(nlConstraints));
			nlConstraints.min = bCons.min;
			nlConstraints.max = bCons.min;
		} else {
			nlConstraints.min = Math.max(nlConstraints.min || 0, bCons.min);
		}
	}

	if (bCons.max !== undefined) {
		if (nlConstraints.min !== undefined && nlConstraints.min > bCons.max) {
			// Conflict, warn and let nodeB win.
			env.log("info/html2wt", "Incompatible constraints 2:", nodeA.nodeName,
					nodeB.nodeName, loggableConstraints(nlConstraints));
			nlConstraints.min = bCons.max;
			nlConstraints.max = bCons.max;
		} else if (nlConstraints.max !== undefined) {
			nlConstraints.max = Math.min(nlConstraints.max, bCons.max);
		} else {
			nlConstraints.max = bCons.max;
		}
	}

	if (nlConstraints.max === undefined) {
		// Anything more than two lines will trigger paragraphs, so default to
		// two if nothing is specified.
		nlConstraints.max = 2;
	}

	return nlConstraints;
}
function getSepNlConstraints(state, nodeA, aCons, nodeB, bCons) {
	const env = state.env;

	const nlConstraints = {
		min: aCons.min,
		max: aCons.max,
		force: aCons.force || bCons.force,
	};

	// now figure out if this conflicts with the nlConstraints so far
	if (bCons.min !== undefined) {
		if (nlConstraints.max !== undefined && nlConstraints.max < bCons.min) {
			// Conflict, warn and let nodeB win.
			env.log("info/html2wt", "Incompatible constraints 1:", nodeA.nodeName,
					nodeB.nodeName, loggableConstraints(nlConstraints));
			nlConstraints.min = bCons.min;
			nlConstraints.max = bCons.min;
		} else {
			nlConstraints.min = Math.max(nlConstraints.min || 0, bCons.min);
		}
	}

	if (bCons.max !== undefined) {
		if (nlConstraints.min !== undefined && nlConstraints.min > bCons.max) {
			// Conflict, warn and let nodeB win.
			env.log("info/html2wt", "Incompatible constraints 2:", nodeA.nodeName,
					nodeB.nodeName, loggableConstraints(nlConstraints));
			nlConstraints.min = bCons.max;
			nlConstraints.max = bCons.max;
		} else if (nlConstraints.max !== undefined) {
			nlConstraints.max = Math.min(nlConstraints.max, bCons.max);
		} else {
			nlConstraints.max = bCons.max;
		}
	}

	if (nlConstraints.max === undefined) {
		// Anything more than two lines will trigger paragraphs, so default to
		// two if nothing is specified.
		nlConstraints.max = 2;
	}

	return nlConstraints;
}
function getSepNlConstraints ( state , nodeA , aCons , nodeB , bCons ) { const env = state . env ; const nlConstraints = { min : aCons . min , max : aCons . max , force : aCons . force || bCons . force , } ; // now figure out if this conflicts with the nlConstraints so far if ( bCons . min !== undefined ) { if ( nlConstraints . max !== undefined && nlConstraints . max < bCons . min ) { // Conflict, warn and let nodeB win. env . log ( "info/html2wt" , "Incompatible constraints 1:" , nodeA . nodeName , nodeB . nodeName , loggableConstraints ( nlConstraints ) ) ; nlConstraints . min = bCons . min ; nlConstraints . max = bCons . min ; } else { nlConstraints . min = Math . max ( nlConstraints . min || 0 , bCons . min ) ; } } if ( bCons . max !== undefined ) { if ( nlConstraints . min !== undefined && nlConstraints . min > bCons . max ) { // Conflict, warn and let nodeB win. env . log ( "info/html2wt" , "Incompatible constraints 2:" , nodeA . nodeName , nodeB . nodeName , loggableConstraints ( nlConstraints ) ) ; nlConstraints . min = bCons . max ; nlConstraints . max = bCons . max ; } else if ( nlConstraints . max !== undefined ) { nlConstraints . max = Math . min ( nlConstraints . max , bCons . max ) ; } else { nlConstraints . max = bCons . max ; } } if ( nlConstraints . max === undefined ) { // Anything more than two lines will trigger paragraphs, so default to // two if nothing is specified. nlConstraints . max = 2 ; } return nlConstraints ; }
Helper for updateSeparatorConstraints.

Collects, checks and integrates separator newline requirements to a simple
min, max structure.
@param {SerializerState} state
@param {Node} nodeA
@param {Object} aCons
@param {Node} nodeB
@param {Object} bCons
@return {Object}
@return {Object} [return.a]
@return {Object} [return.b]
@private
Helper for updateSeparatorConstraints .