File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ class Readability implements LoggerAwareInterface
6161 // constants
6262 const SCORE_CHARS_IN_PARAGRAPH = 100 ;
6363 const SCORE_WORDS_IN_PARAGRAPH = 20 ;
64- const GRANDPARENT_SCORE_DIVISOR = 2.2 ;
64+ const GRANDPARENT_SCORE_DIVISOR = 2 ;
6565 const MIN_PARAGRAPH_LENGTH = 20 ;
6666 const MIN_COMMAS_IN_PARAGRAPH = 6 ;
6767 const MIN_ARTICLE_LENGTH = 200 ;
@@ -1115,7 +1115,7 @@ protected function grabArticle(\DOMElement $page = null)
11151115 // Add the score to the parent. The grandparent gets half.
11161116 $ parentNode ->getAttributeNode ('readability ' )->value += $ contentScore ;
11171117 if ($ grandParentNode ) {
1118- $ grandParentNode ->getAttributeNode ('readability ' )->value += $ contentScore / self ::GRANDPARENT_SCORE_DIVISOR ;
1118+ $ grandParentNode ->getAttributeNode ('readability ' )->value += round ( $ contentScore / self ::GRANDPARENT_SCORE_DIVISOR ) ;
11191119 }
11201120 }
11211121
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ public function testWithAside()
193193 $ this ->assertEmpty ($ readability ->getTitle ()->getInnerHtml ());
194194 $ this ->assertContains ('This is an awesome text with some links, here there are ' , $ readability ->getContent ()->getInnerHtml ());
195195 $ this ->assertNotContains ('<aside> ' , $ readability ->getContent ()->getInnerHtml ());
196- $ this ->assertContains ('<footer readability="4 "/> ' , $ readability ->getContent ()->getInnerHtml ());
196+ $ this ->assertContains ('<footer readability="5 "/> ' , $ readability ->getContent ()->getInnerHtml ());
197197 }
198198
199199 public function testWithClasses ()
You can’t perform that action at this time.
0 commit comments