@@ -26,7 +26,7 @@ class Readability implements LoggerAwareInterface
2626 public const MIN_NODE_LENGTH = 80 ;
2727 public const MAX_LINK_DENSITY = 0.25 ;
2828 public $ convertLinksToFootnotes = false ;
29- public $ revertForcedParagraphElements = true ;
29+ public $ revertForcedParagraphElements = false ;
3030 public $ articleTitle ;
3131 public $ articleContent ;
3232 public $ original_html ;
@@ -991,9 +991,9 @@ protected function grabArticle(DOMElement $page = null)
991991 $ p ->appendChild ($ childNode );
992992 } elseif ('' !== $ this ->getInnerText ($ childNode , true , true )) {
993993 $ p = $ this ->dom ->createElement ('p ' );
994- $ p ->setInnerHtml ($ childNode ->nodeValue );
995994 $ p ->setAttribute ('data-readability-styled ' , 'true ' );
996- $ childNode ->parentNode ->replaceChild ($ p , $ childNode );
995+ $ node ->replaceChild ($ p , $ childNode );
996+ $ p ->appendChild ($ childNode );
997997 }
998998 } elseif (null !== $ p ) {
999999 while ($ p ->lastChild && '' === $ this ->getInnerText ($ p ->lastChild , true , true )) {
@@ -1465,8 +1465,8 @@ private function getAncestors(DOMElement $node, int $maxDepth = 0): array
14651465 private function isPhrasingContent ($ node ): bool
14661466 {
14671467 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 ) {
14701470 return $ this ->isPhrasingContent ($ c );
14711471 }, iterator_to_array ($ node ->childNodes )), true ));
14721472 }
0 commit comments