/* MIT License http://www.opensource.org/licenses/mit-license.php */ "use strict"; // Stands in the output for text only an asynchronous caller can supply, until // {@link PrintContext.substitute} puts the answer in its place. A NUL delimits // it because both the CSS and the HTML preprocessor turn one in the input into // U+FFFD, so printed output never holds one of its own account. const DEFERRED_MARKER = "\u0000"; // The infix this print marks its writes with, chosen so that `NUL infix` occurs // nowhere in the input — a NUL the source carried then spells no write of ours. let deferredInfix = "0:"; /** * The text to print in place of a deferred write. * @param {number} id the write's index among this print's deferred writes * @returns {string} the marker to emit */ const deferredWrite = (id) => `${DEFERRED_MARKER}${deferredInfix}${id}${DEFERRED_MARKER}`; /** * An infix no NUL run in `input` already carries, so only this print can have * written one. An RCDATA element (`