Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{frame.map(line => {
// Check if there are any ansi colors/styles
const doubleSpace = line.match(/ {2}/g);
if (ansiRegex().test(line)) {
const newLine = ansiUp.ansi_to_html(line);
return doubleSpace && doubleSpace.length ? (
<div>
) :
<div>;
} else if (doubleSpace && doubleSpace.length) {
return <div>{line}</div>;
}
return <div>{line}</div>;
})}
</div></div>
function generateErrorScript (err) {
let errorBox = errorTemplate({
name: err.name,
message: ansiUp.ansi_to_html(escapeHtml(err.message))
})
// if it's not a string, and just included as a function that's interpolated by the returned string
// it'll get mucked up during coverage testing
let bundleJs = `function bundleError () {
var template = ${JSON.stringify(errorBox)}
if (typeof document === 'undefined') return
document.addEventListener('DOMContentLoaded', function print () {
var container = document.createElement('div')
container.innerHTML = template
document.body.appendChild(container)
})
}`
return `;(${bundleJs})()\n`
}
Vue.nextTick(() => {
this.updatePending = false;
// set the text content, regardless of the format. if the format is ansi,
// we want to use this method to escape html tags
this.$el.textContent = this.logs;
if (this.format === constants.CONTAINERS.LOGS.FORMAT.ANSI) {
var logsEscaped = this.$el.innerHTML;
if (logsEscaped) {
this.$el.innerHTML = ansi.ansi_to_html(logsEscaped);
}
}
if (scrolledToBottom) {
this.$el.scrollTop = this.$el.scrollHeight;
}
});
}
function processLine (line) {
return ansi_to_html(line)
}
prepareRow: function(row) {
return ansiUp.ansi_to_html(utils.escapeHtml(row.replace('\r', '')));
},
prepareOutput: function(output) {
constructor(options: RenderMime.IRenderOptions) {
super();
let source = Private.getSource(options);
let data = escape_for_html(source);
let pre = document.createElement('pre');
pre.innerHTML = ansi_to_html(data, {use_classes: true});
this.node.appendChild(pre);
this.addClass(TEXT_CLASS);
if (options.mimeType === 'application/vnd.jupyter.stderr') {
this.addClass(ERROR_CLASS);
}
}
}
} else {
while (node.lastChild) {
node.removeChild(node.lastChild);
}
}
var p = msg.lastIndexOf('\u001b[2K');
if (p !== -1) {
line = '';
msg = msg.substring(p + 4);
}
line += msg;
msg = sm.line(consumer, line, offset);
msg = ansi.escape_for_html(msg);
msg = msg.replace(/\u001b\[0G/g, '');
msg = msg.replace(/ /g, ' ');
div.innerHTML = ansi.ansi_to_html(msg, {
use_classes : true
});
Array.prototype.slice.call(div.childNodes).forEach(node.appendChild, node);
}