本文整理汇总了TypeScript中lodash.escape函数的典型用法代码示例。如果您正苦于以下问题:TypeScript escape函数的具体用法?TypeScript escape怎么用?TypeScript escape使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了escape函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getMessageType
messages.forEach(function(message) {
const type = (message as any).fatal ? "error" : "failure";
output += '<testcase time="0" name="org.eslint.' + (message.ruleId || "unknown") + '">';
output += "<" + type + ' message="' + lodash.escape(message.message || "") + '">';
output += "<![CDATA[";
output += "line " + (message.line || 0) + ", col ";
output += (message.column || 0) + ", " + getMessageType(message);
output += " - " + lodash.escape(message.message || "");
output += message.ruleId ? " (" + message.ruleId + ")" : "";
output += "]]>";
output += "</" + type + ">";
output += "</testcase>\n";
});
示例2: render
function render(token:Token, options:Options) : string {
if(token instanceof FormulaToken) return renderFormula(token, options)
if(token instanceof LinkToken) return renderLink(token, options)
if(token instanceof FormatToken) return token.children.map(child => render(child, options)).join('')
if(token instanceof StrToken) return _.escape(token.str || '')
return ''
}
示例3: render
function render(token:Token, options:Options) : string {
if(token instanceof FormulaToken) return renderFormula(token, options)
if(token instanceof LinkToken) return renderLink(token, options)
if(token instanceof FormatToken) return renderFormat(token, options)
if(token instanceof StrToken) return _.escape(token.str || '')
return ''
}
示例4: renderCell
renderCell(columnIndex, value, addWidthHack = false, rowLink = '') {
value = this.formatColumnValue(columnIndex, value);
if (value !== undefined) {
value = _.escape(value);
}
var style = this.compileStyles();
// because of the fixed table headers css only solution
// there is an issue if header cell is wider the cell
// this hack adds header content to cell (not visible)
var widthHack = '';
if (addWidthHack) {
widthHack = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].text + '</div>';
}
if (value === undefined) {
style = ' style="display:none;"';
this.table.columns[columnIndex].hidden = true;
} else {
this.table.columns[columnIndex].hidden = false;
if (rowLink !== '') {
value = '<a href="' + rowLink + '" target="_new">' + value + '</a>';
}
}
return '<td' + style + ' align="' + this.alignState + '">' + value + widthHack + '</td>';
}
示例5: render
render(page) {
let pageSize = this.panel.pageSize || 100;
let startPos = page * pageSize;
let endPos = Math.min(startPos + pageSize, this.table.rows.length);
var html = "";
for (var y = startPos; y < endPos; y++) {
let row = this.table.rows[y];
let cellHtml = '';
let rowStyle = '';
let rowLink = this.panel.rowLink;
if (rowLink) {
for (var i = 0; i < this.table.columns.length; i++) {
rowLink = rowLink.replace('$' + this.table.columns[i].text, _.escape(row[i]));
}
}
for (var i = 0; i < this.table.columns.length; i++) {
cellHtml += this.renderCell(i, row[i], y === startPos, rowLink);
}
if (this.colorState.row) {
rowStyle = ' style="background-color:' + this.colorState.row + ';color: white"';
this.colorState.row = null;
}
html += '<tr ' + rowStyle + '>' + cellHtml + '</tr>';
}
return html;
}
示例6: emitCompileViewError
export function emitCompileViewError( content: string, err: TypeError, filename: string ) : relaxjs.RxError {
var errTitle = '[error] Compiling View: %s'+ filename ;
var errMsg = err.message;
var code = format('<h4>Content being compiled</h4><pre>{0}</pre>', _.escape(content));
_log.error(errTitle);
return new relaxjs.RxError(errMsg, errTitle, 500, code );
}
示例7: renderCell
renderCell(columnIndex, value, addWidthHack = false) {
value = this.formatColumnValue(columnIndex, value);
value = _.escape(value);
var style = '';
if (this.colorState.cell) {
style = ' style="background-color:' + this.colorState.cell + ';color: white"';
this.colorState.cell = null;
} else if (this.colorState.value) {
style = ' style="color:' + this.colorState.value + '"';
this.colorState.value = null;
}
// because of the fixed table headers css only solution
// there is an issue if header cell is wider the cell
// this hack adds header content to cell (not visible)
var widthHack = '';
if (addWidthHack) {
widthHack = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].text + '</div>';
}
if (value.indexOf("http") > -1) {
return '<td' + style + '><a href=\"' + value + '\" target=\"_blank\">' + value + widthHack + '</a></td>';
} else {
return '<td' + style + '>' + value + widthHack + '</td>';
}
}
示例8: renderCell
renderCell(columnIndex, value, addWidthHack = false) {
value = this.formatColumnValue(columnIndex, value);
if (value !== undefined) {
value = _.escape(value);
}
var style = '';
if (this.colorState.cell) {
style = ' style="background-color:' + this.colorState.cell + ';color: white"';
this.colorState.cell = null;
} else if (this.colorState.value) {
style = ' style="color:' + this.colorState.value + '"';
this.colorState.value = null;
}
// because of the fixed table headers css only solution
// there is an issue if header cell is wider the cell
// this hack adds header content to cell (not visible)
var widthHack = '';
if (addWidthHack) {
widthHack = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].text + '</div>';
}
if (value === undefined) {
style = ' style="display:none;"';
this.table.columns[columnIndex].hidden = true;
} else {
this.table.columns[columnIndex].hidden = false;
}
return '<td' + style + '>' + value + widthHack + '</td>';
}
示例9: sanitizeString
function sanitizeString(str) {
try {
return $sanitize(str);
} catch (err) {
console.log('Could not sanitize annotation string, html escaping instead');
return _.escape(str);
}
}
示例10: callback
$scope.handleEvent({ $event: { name: 'get-param-options', param: param } }).then((result: any) => {
const dynamicOptions = _.map(result, op => {
return _.escape(op.value);
});
// add current value to dropdown if it's not in dynamicOptions
if (_.indexOf(dynamicOptions, part.params[paramIndex]) === -1) {
dynamicOptions.unshift(_.escape(part.params[paramIndex]));
}
callback(dynamicOptions);
});