Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

readabilitySAX

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readabilitySAX - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

node/getMultipaged.js

2

package.json
{
"name": "readabilitySAX",
"version": "1.4.1",
"version": "1.4.2",
"description": "the readability script ported to a sax parser",

@@ -5,0 +5,0 @@ "author": "Felix Boehm <me@feedic.com>",

@@ -75,3 +75,6 @@ /*

if(this.children.length === 0) return ret + "/>";
if(this.children.length === 0){
if(this.name in formatTags) return ret + "/>";
else return ret + "></" + this.name + ">";
}

@@ -141,4 +144,4 @@ return ret + ">" + this.getInnerHTML() + "</" + this.name + ">";

unpackDivs = {__proto__:embeds,div:true,img:true},
noContent = {__proto__:null,br:new Element("br"),font:false,hr:new Element("hr"),input:false,link:false,meta:false,span:false},
tagsToScore = {__proto__:null,p:true,pre:true,td:true},
noContent = {__proto__:formatTags,font:false,input:false,link:false,meta:false,span:false},
formatTags = {__proto__:null,br:new Element("br"),hr:new Element("hr")},
headerTags = {__proto__:null,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true},

@@ -372,3 +375,3 @@ newLinesAfter = {__proto__:headerTags,br:true,li:true,p:true},

if(name in noContent){
if(noContent[name]) this._currentElement.children.push(noContent[name]);
if(name in formatTags) this._currentElement.children.push(formatTags[name]);
}

@@ -526,3 +529,3 @@ else this._currentElement = new Element(name, this._currentElement);

//should node be scored?
if(tagName in tagsToScore);
if(tagName === "p" || tagName === "pre" || tagName === "td");
else if(tagName === "div"){

@@ -559,7 +562,7 @@ //check if div should be converted to a p

if(childs[i] === candidate);
else if(candidate.attributes["class"] === childs[i].attributes["class"]){
else if(candidate.elementData === childs[i].elementData){ //TODO: just the class name should be checked
if((childs[i].totalScore + candidate.totalScore * .2) >= siblingScoreThreshold){
if(childs[i].name !== "p") childs[i].name = "div";
}
else continue;
else continue;
} else if(childs[i].name === "p"){

@@ -566,0 +569,0 @@ if(childs[i].info.textLength >= 80 && childs[i].info.density < .25);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc