@@ -463,19 +463,21 @@ private function resolveChildUrls(DOMElement $el) {
463463 }
464464 }
465465
466- /**
467- * The following two methods implements plain text parsing.
468- * @see https://wiki.zegnat.net/media/textparsing.html
469- **/
470- public function textContent (DOMElement $ element )
466+ /**
467+ * The following two methods implements plain text parsing.
468+ * @param DOMElement $element
469+ * @param bool $implied
470+ * @see https://wiki.zegnat.net/media/textparsing.html
471+ **/
472+ public function textContent (DOMElement $ element , $ implied =false )
471473 {
472474 return preg_replace (
473475 '/(^[\t\n\f\r ]+| +(?=\n)|(?<=\n) +| +(?= )|[\t\n\f\r ]+$)/ ' ,
474476 '' ,
475- $ this ->elementToString ($ element )
477+ $ this ->elementToString ($ element, $ implied )
476478 );
477479 }
478- private function elementToString (DOMElement $ input )
480+ private function elementToString (DOMElement $ input, $ implied = false )
479481 {
480482 $ output = '' ;
481483 foreach ($ input ->childNodes as $ child ) {
@@ -488,7 +490,7 @@ private function elementToString(DOMElement $input)
488490 } else if ($ tagName === 'IMG ' ) {
489491 if ($ child ->hasAttribute ('alt ' )) {
490492 $ output .= ' ' . trim ($ child ->getAttribute ('alt ' ), "\t\n\f\r " ) . ' ' ;
491- } else if ($ child ->hasAttribute ('src ' )) {
493+ } else if (! $ implied && $ child ->hasAttribute ('src ' )) {
492494 $ output .= ' ' . $ this ->resolveUrl (trim ($ child ->getAttribute ('src ' ), "\t\n\f\r " )) . ' ' ;
493495 }
494496 } else if ($ tagName === 'BR ' ) {
0 commit comments