nieuws: split intro before nested figure containers
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 2 Mar 2019 18:10:52 +0000 (19:10 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 2 Mar 2019 18:10:52 +0000 (19:10 +0100)
Fix invalid html due to captured consecutive <figure> from contents.

nieuws.inc.php

index a0fa821b93647356efe421eb9db95198ee997197..1a68993f42bcd2387ad5e14257d5059c149d41f6 100644 (file)
@@ -78,7 +78,9 @@ class ArchiveArticle
        {
                $this->title;
                $rest = fread($this->file, filesize($this->page));
-               if ( preg_match('{\n < (?: p | figure [^>]* ) > (<img\ [^>]*>) | \n <hr\ />}x', $rest, $img, PREG_OFFSET_CAPTURE) ) {
+               if ( preg_match('{
+                       \n (?: < (?: p | figure [^>]* ) >\s* )+ (<img\ [^>]*>) | \n <hr\ />
+               }x', $rest, $img, PREG_OFFSET_CAPTURE) ) {
                        if (isset($img[1])) {
                                $this->img = $img[1][0];
                        }