How to use the entities.decodeHTML5 function in entities

To help you get started, we’ve selected a few 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 5d-jh / school-menu-api / api / neis.js View on Github external
$('td div').each(function () {
        const text = entities.decodeHTML5($(this).html());

        const date = text.split(/\[조식\]|\[중식\]|\[석식\]/)[0].replace('<br>', '').trim();
          /*
          [예시]
          '3 <br>[중식]고등어' =(1)=&gt; '3 <br>' =(2)=&gt; '3 ' =(3)=&gt; '3'
          [설명]
          (1) 텍스트 '[조식]' 또는 '[중식]' 또는 '[석식]' 중 하나를 기준으로 나눈 배열의 첫 번째 원소를 고름
          (2) 첫 번째 원소의 <br> 태그를 제거함
          (3) 문자의 공백을 제거함
          */
        if (date/* 날짜 정보가 있는 경우에만 배열에 식단을 저장함 */) {
          const breakfast = /\[조식\](.*?)(\[|$)/g.exec(text) &amp;&amp; /\[조식\](.*?)(\[|$)/g.exec(text)[1];
            /*
            [예시]
            '[조식]고등어<br>참치[' =&gt; '고등어<br>참치'
            [설명]
github itteco / iframely / lib / iframely-meta.js View on Github external
function encodeAllStrings(obj) {
                for (var k in obj) {
                    if (typeof obj[k] == "object") {
                        encodeAllStrings(obj[k]);
                    } else {
                        if (!obj.hasOwnProperty(k)) {
                            continue;       // skip this property
                        }
                        if (typeof(obj[k]) == 'string'){
                            // decode HTML entities after decoding the charset
                            // otherwise we would end up with a string with mixed encoding
                            obj[k] = decodeHTML5(encodeText(charset, obj[k]));
                        }
                    }
                }
            }
github itteco / iframely / plugins / links / embedURL / embedURL.js View on Github external
$aScope.find('[itemprop]').each(function() {
                var $el = cheerio(this);

                var scope = $el.attr('itemscope');
                if (typeof scope !== 'undefined') {
                    return;
                }

                var $parentScope = $el.parents('[itemscope]');
                if (!($parentScope.attr('itemtype').indexOf(videoObjectSchema) > -1)) {
                    return;
                }

                var key = $el.attr('itemprop');
                if (key) {
                    var value = decodeHTML5(decode($el.attr('content') || $el.attr('href')));
                    result[key] = value;
                }
            });
github ashi009 / node-fast-html-parser / index.js View on Github external
get attributes() {
    if (this._attrs)
      return this._attrs;
    this._attrs = {};
    var attrs = this.rawAttributes;
    for (var key in attrs) {
      this._attrs[key] = entities.decodeHTML5(attrs[key]);
    }
    return this._attrs;
  },
github 5d-jh / school-menu-api / api / db.js View on Github external
          breakfast: day.breakfast.map(menu => entities.decodeHTML5(menu)),
          lunch: day.lunch.map(menu => entities.decodeHTML5(menu)),
github ashi009 / node-fast-html-parser / index.js View on Github external
get text() {
    return entities.decodeHTML5(this.rawText);
  },
github itteco / iframely / plugins / domains / dailymail.co.uk / dailymail.video.js View on Github external
getMeta: function(dailymailVideo, decode) {
        return {
            title: decodeHTML5(decode(dailymailVideo.title)),
            description: decodeHTML5(decode(dailymailVideo.descr))
        }
    },
github kof / kiipost / api / extractor / article.js View on Github external
parser.write(data)

    for(
        var skipLevel = 1;
        readability._getCandidateNode().info.textLength &lt; 250 &amp;&amp; skipLevel &lt; 4;
        skipLevel++
    ){
        readability.setSkipLevel(skipLevel)
        handler.restart()
    }

    var article = readability.getArticle()
    article.url = url
    article.title = entities.decodeHTML5(article.title).trim()
    article.html = entities.decodeHTML5(article.html.replace(/\s+/g, ' ')).trim()
    article.text = readability.getText(readability._getCandidateNode()).trim()

    return article
}
github itteco / iframely / plugins / domains / xkcd.com.js View on Github external
getData: function(cheerio, decode) {

        var $img = cheerio('#comic img');
        var $a = cheerio('#comic a');

        return {
            xkcd_data: {
                image: $img.attr('src'),
                has_large_image: $a.length,
                description: decodeHTML5(decode($img.attr('title')))
            }
        };
    },
github itteco / iframely / plugins / domains / google.com / docs.google.com.js View on Github external
$aScope.find('[itemprop]').each(function() {
                var $el = cheerio(this);

                var scope = $el.attr('itemscope');
                if (typeof scope !== 'undefined') {
                    return;
                }

                var key = $el.attr('itemprop');
                if (key) {
                    var value = decodeHTML5(decode($el.attr('content') || $el.attr('href')));
                    result[key] = value;
                }
            });