当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.escape函数代码示例

本文整理汇总了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";
 });
开发者ID:textlint,项目名称:textlint,代码行数:13,代码来源:junit.ts

示例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 ''
}
开发者ID:TrystalNet,项目名称:trystup,代码行数:7,代码来源:render-text.ts

示例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 ''
}
开发者ID:TrystalNet,项目名称:trystup,代码行数:7,代码来源:render-html.ts

示例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>';
  }
开发者ID:madshall,项目名称:grafana,代码行数:29,代码来源:renderer.ts

示例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;
  }
开发者ID:madshall,项目名称:grafana,代码行数:32,代码来源:renderer.ts

示例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 );
}
开发者ID:micurs,项目名称:relaxjs,代码行数:7,代码来源:internals.ts

示例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>';
    }
  }
开发者ID:smur89,项目名称:grafana,代码行数:26,代码来源:renderer.ts

示例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>';
  }
开发者ID:madshall,项目名称:grafana-custom,代码行数:33,代码来源:renderer.ts

示例9: sanitizeString

 function sanitizeString(str) {
   try {
     return $sanitize(str);
   } catch (err) {
     console.log('Could not sanitize annotation string, html escaping instead');
     return _.escape(str);
   }
 }
开发者ID:ArcticSnowman,项目名称:grafana,代码行数:8,代码来源:annotation_tooltip.ts

示例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);
            });
开发者ID:grafana,项目名称:grafana,代码行数:12,代码来源:sql_part_editor.ts


注:本文中的lodash.escape函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。