How to use the html-entities.XmlEntities function in html-entities

To help you get started, we’ve selected a few html-entities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ioBroker / ioBroker.sonos / node_modules / sonos-discovery / lib / player.js View on Github external
function Player(roomName, descriptorUrl, uuid, discovery) {
  var _this = this;
  var positionInfoTimeout;
  //var sids = {};
  var subscriptions = {};
  var xmlEntities = new XmlEntities();
  // for prototype access
  this.discovery = discovery;
  this.address = descriptorUrl.replace(/http:\/\/([\d\.]+).*/, "$1");
  this.roomName = xmlEntities.decode(roomName);
  this.zoneType = 0;
  this.uuid = uuid;
  this.state = {
    currentTrack: {
      artist: "",
      title: "",
      album: "",
      albumArtURI: "",
      duration: 0,
      uri: ""
    },
    nextTrack: {
github jishi / node-sonos-http-api / lib / tts-providers / microsoft.js View on Github external
'use strict';
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
const fileDuration = require('../helpers/file-duration');
const request = require('sonos-discovery/lib/helpers/request');
const logger = require('sonos-discovery/lib/helpers/logger');
const globalSettings = require('../../settings');
const XmlEntities = require('html-entities').XmlEntities;

const xmlEntities = new XmlEntities();

const APP_ID = '9aa44d9e6ec14da99231a9166fd50b0f';
const INSTANCE_ID = crypto.randomBytes(16).toString('hex');
const TOKEN_EXPIRATION = 590000; // 9:50 minutes in ms
const DEFAULT_SETTINGS = {
  name: 'ZiraRUS'
};

let bearerToken;
let bearerExpires = Date.now();

function generateBearerToken(apiKey) {
  return request({
    uri: 'https://api.cognitive.microsoft.com/sts/v1.0/issueToken',
    method: 'POST',
    type: 'raw',
github ndaidong / feed-reader / src / utils / normalize.js View on Github external
// utils --> normalize

const Entities = require('html-entities').XmlEntities;
const Entity = new Entities();

const {
  isString,
  ucwords,
  stripTags,
  truncate,
} = require('bellajs');

const {
  utc,
} = require('bella-date');

const normalize = ({link, title, pubDate, author = '', contentSnippet = '', content = ''}) => {
  if (!link || !title || !isString(link) || !isString(title)) {
    return false;
  }
github jishi / node-sonos-discovery / lib / models / Player.js View on Github external
'use strict';
const url = require('url');
const Subscriber = require('../Subscriber');
const soap = require('../helpers/soap');
const streamer = require('../helpers/streamer');
const TYPE = soap.TYPE;
const flow = require('xml-flow');
const XmlEntities = require('html-entities').XmlEntities;
const path = require('path');
const requireDir = require('../helpers/require-dir');
const logger = require('../helpers/logger');
const musicServices = require('../musicservices');
const xmlEntities = new XmlEntities();
const util = require('util');
const EventEmitter = require('events').EventEmitter;

const EMPTY_STATE = require('../types/empty-state');
const PLAY_MODE = require('../types/play-mode');
const REPEAT_MODE = require('../types/repeat-mode');
const URI_TYPE = require('../types/uri-type');

function reversePlayMode() {
  let lookup = {};
  for (let key in PLAY_MODE) {
    lookup[PLAY_MODE[key]] = key;
  }

  return lookup;
}
github appleple / lite-editor / src / core / index.js View on Github external
import aTemplate from 'a-template';
import extend from 'deep-extend';
import Upndown from 'upndown';
import 'custom-event-polyfill';
import 'ie-array-find-polyfill';
import editorHtml from './editor.html';
import btnHtml from './btn.html';
import tooltipHtml from './tooltip.html';
import * as util from '../lib/util';

const Entities = require('html-entities').XmlEntities;

const entities = new Entities();
const und = new Upndown({ decodeEntities: false });

const defaultbtnOptions = [
  {
    label: '<i class="lite-editor-font-back"></i>',
    action: 'undo',
    group: 'action'
  },
  {
    label: '<i class="lite-editor-font-go"></i>',
    action: 'redo',
    group: 'action'
  },
  {
    label: '<i class="lite-editor-font-link"></i>',
    tag: 'a',
github twostairs / snoo / UI / ArticlesList.js View on Github external
const UI = require('./UI').default;
const Entities = require('html-entities').XmlEntities;
const entities = new Entities();
const _ = require('lodash');

/**
 * ArticlesList Class
 */
module.exports.default = class ArticlesList extends UI {
    /**
     * Constructs the ArticlesList object.
     *
     * @param      {Object}  args    The arguments object
     */
    constructor(args) {
        super(args);

        this._widget = this.driver.listtable({
            'parent': this.screen,
github goemonjs / goemon / src / routes / utilities / ssr-renderer.tsx View on Github external
import React from 'react';
import { matchRoutes } from 'react-router-config';
import { renderToString } from 'react-dom/server';
const XmlEntities = require('html-entities').XmlEntities;
const xmlEntities = new XmlEntities();
import { generateNumberFromTimestamp } from '../../base/utilities/file';
import { isProductionMode } from '../../base/utilities/debug';
import i18n from '../../client/localization/i18n';
import { logger } from '../../base/utilities/logger';

/**
 * Server side renderer utility class
 */
export class ServerSideRenderer {
  /**
   * Constructor
   * @param bundleFilePath builde file path of webpack
   */
  constructor(public bundleFilePath: string) {
  }
github twostairs / snoo / Snoo.js View on Github external
const packageJson = require('./package.json');
const blessed = require('blessed');
const Reddit = require('./lib/reddit').default;
const Entities = require('html-entities').XmlEntities;
const entities = new Entities();
const _ = require('lodash');
const bunyan = require('bunyan');
const fs = require('fs');

const MessageBox = require('./UI/MessageBox').default;
const ArticlesList = require('./UI/ArticlesList').default;
const ArticleView = require('./UI/ArticleView').default;
const PopupList = require('./UI/PopupList').default;

const SUBREDDITS_FIXED = [
    'hot',
    'new',
    'top'
];

/**
github Rekseto / VMotion / controllers / articleController.js View on Github external
addArticle: function (title, author, tags, content, picture) {
        entities = new Entities();
        const dom = new JSDOM(entities.decode(content));
        let articleData = new Article({
            author: author,
            title: title,
            content: content,
            images: picture,
            tagList: tags,
            created_at: new Date(),
            shavedContent:dom.window.document.querySelector("p").textContent
        });

        articleData.save();
    },
    findArticleById: function (id) {
github zhuzhuyule / HexoEditor / views / main / hexo / plugins / filter / before_post_render / highlightEx / highlight.js View on Github external
'use strict';

var hljs = require('highlight.js/lib/highlight');
var Entities = require('html-entities').XmlEntities;
var entities = new Entities();
var alias = require('./highlight_alias.json');

hljs.configure({
    classPrefix: ''
});

function highlightUtil(str, options) {
    if (typeof str !== 'string') throw new TypeError('str must be a string!');
    options = options || {};

    var gutter = options.hasOwnProperty('gutter') ? options.gutter : true;
    var wrap = options.hasOwnProperty('wrap') ? options.wrap : true;
    var firstLine = options.hasOwnProperty('firstLine') ? +options.firstLine : 1;
    var diff = options.hasOwnProperty('diff') ? options.diff : false;
    var caption = options.caption;
    var mark = options.hasOwnProperty('mark') ? options.mark : [];