How to use the ent.decode function in ent

To help you get started, we’ve selected a few ent 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 oaeproject / Hilary / node_modules / oae-preview-processor / lib / processors / link / util.js View on Github external
return callback(err);
    }

    // Check if we can update the main content metadata (displayName, description, ..)
    opts = opts || {};
    if (
      opts.displayName &&
      ctx.content.displayName === ctx.content.link &&
      typeof opts.displayName === 'string'
    ) {
      ctx.addContentMetadata('displayName', ent.decode(opts.displayName));
      log().trace({ contentId: ctx.contentId }, 'Updating the content displayName.');
    }

    if (opts.description && !ctx.content.description && typeof opts.description === 'string') {
      ctx.addContentMetadata('description', ent.decode(opts.description));
      log().trace({ contentId: ctx.contentId }, 'Updating the content description.');
    }

    return callback();
  });
};
github fedspendingtransparency / data-act-broker-web-app / src / js / helpers / helpHelper.js View on Github external
const unescapeInlineHtml = (html) => {
    let tmpHtml = html;
    // find any inline HTML (as denoted by ```!inline-html [CODE] !inline-html```)
    const regex = /<p><code>!inline-html\n[\s\S]*\n!inline-html&lt;\/code&gt;&lt;\/p&gt;/;
    const results = regex.exec(tmpHtml);

    // we found inline HTML, unescape it and insert it into the parsed Markdown output
    if (results &amp;&amp; results.length &gt; 0) {
        const rawHtml = results[0].substring(21, results[0].length - 23);
        const decodedHtml = ent.decode(rawHtml);
        tmpHtml = tmpHtml.replace(regex, decodedHtml);
    }

    return tmpHtml;
};
</code></p>
github apostrophecms / apostrophe / apostrophe.js View on Github external
self.htmlToPlaintext = function(html) {
    // The awesomest HTML renderer ever (look out webkit):
    // block element opening tags = newlines, closing tags and non-container tags just gone
    html = html.replace(/&lt;\/.*?\&gt;/g, '');
    html = html.replace(/&lt;(h1|h2|h3|h4|h5|h6|p|br|blockquote).*?\&gt;/gi, '\n');
    html = html.replace(/&lt;.*?\&gt;/g, '');
    return ent.decode(html);
  };
github TimBeyer / html-to-vdom / lib / htmlparser-to-vdom.js View on Github external
convert: function (node, getVNodeKey) {
            if (node.type === 'tag' || node.type === 'script' || node.type === 'style') {
                return converter.convertTag(node, getVNodeKey);
            } else if (node.type === 'text') {
                return new VText(decode(node.data));
            } else {
                // converting an unsupported node, return an empty text node instead.
                return new VText('');
            }
        },
        convertTag: function (tag, getVNodeKey) {
github pubpub / pubpub / src / markdown / markdown.js View on Github external
renderer.br = function (text) {
  var id = inlineIds++;
  inlines[id] = React.createElement(options.br || 'br', {key: keys++}, ent.decode(text));
  return '{$' + id + '$}';
};
github googleapis / google-cloud-node / packages / common / src / util.js View on Github external
this.response = errorBody.response;

  try {
    this.errors = JSON.parse(this.response.body).error.errors;
  } catch (e) {}

  var messages = [];

  if (errorBody.message) {
    messages.push(errorBody.message);
  }

  if (this.errors && this.errors.length === 1) {
    messages.push(this.errors[0].message);
  } else if (this.response && this.response.body) {
    messages.push(ent.decode(errorBody.response.body.toString()));
  } else if (!errorBody.message) {
    messages.push('Error during request.');
  }

  this.message = uniq(messages).join(' - ');
});
github jonschlinkert / templates / examples / helper-render.js View on Github external
app.helper('md', function(str, options) {
  var md = new Remarkable();
  var res = md.render(str, options);
  return ent.decode(res);
});
github mitchdenny / ecdc / src / lib / htmlentities.ts View on Github external
public transform(input: string): string {
		let output = ent.decode(input);
		return output;
	}
}
github christianalfoni / EmptyBox / common / markdownRenderer.js View on Github external
renderer.link = function (href, title, text) {
  var id = inlineIds++;
  inlines[id] = React.createElement('a', {
    href: href,
    title: title,
    key: keys++,
    target: 'new'
  }, ent.decode(text));
  return '{{' + id + '}}';
};

ent

Encode and decode HTML entities

MIT
Latest version published 6 days ago

Package Health Score

78 / 100
Full package analysis