@@ -26,7 +26,7 @@ class Readability implements LoggerAwareInterface
26
26
public const MIN_NODE_LENGTH = 80 ;
27
27
public const MAX_LINK_DENSITY = 0.25 ;
28
28
public $ convertLinksToFootnotes = false ;
29
- public $ revertForcedParagraphElements = true ;
29
+ public $ revertForcedParagraphElements = false ;
30
30
public $ articleTitle ;
31
31
public $ articleContent ;
32
32
public $ original_html ;
@@ -991,9 +991,9 @@ protected function grabArticle(DOMElement $page = null)
991
991
$ p ->appendChild ($ childNode );
992
992
} elseif ('' !== $ this ->getInnerText ($ childNode , true , true )) {
993
993
$ p = $ this ->dom ->createElement ('p ' );
994
- $ p ->setInnerHtml ($ childNode ->nodeValue );
995
994
$ p ->setAttribute ('data-readability-styled ' , 'true ' );
996
- $ childNode ->parentNode ->replaceChild ($ p , $ childNode );
995
+ $ node ->replaceChild ($ p , $ childNode );
996
+ $ p ->appendChild ($ childNode );
997
997
}
998
998
} elseif (null !== $ p ) {
999
999
while ($ p ->lastChild && '' === $ this ->getInnerText ($ p ->lastChild , true , true )) {
@@ -1465,8 +1465,8 @@ private function getAncestors(DOMElement $node, int $maxDepth = 0): array
1465
1465
private function isPhrasingContent ($ node ): bool
1466
1466
{
1467
1467
return \XML_TEXT_NODE === $ node ->nodeType
1468
- || \in_array ($ node ->nodeName , $ this ->phrasingElements , true )
1469
- || (\in_array ($ node ->nodeName , ['a ' , 'del ' , 'ins ' ], true ) && !\in_array (false , array_map (function ($ c ) {
1468
+ || \in_array (strtoupper ( $ node ->nodeName ) , $ this ->phrasingElements , true )
1469
+ || (\in_array (strtoupper ( $ node ->nodeName ) , ['A ' , 'DEL ' , 'INS ' ], true ) && !\in_array (false , array_map (function ($ c ) {
1470
1470
return $ this ->isPhrasingContent ($ c );
1471
1471
}, iterator_to_array ($ node ->childNodes )), true ));
1472
1472
}
0 commit comments