change p if same section but diferent classes
authorEduardo <[email protected]>
Sat, 25 Nov 2023 13:22:11 +0000 (14:22 +0100)
committerEduardo <[email protected]>
Sat, 25 Nov 2023 13:22:11 +0000 (14:22 +0100)
page-generator/generator.php

index c9a72e76103159ec117afca73617d1dd6659125d..b94d946315fcf02d459c62704d71c2ddc5199338 100644 (file)
@@ -189,6 +189,11 @@ class CodeGenerator
                     if ($i != 0 && $data[$i - 1]['section'] != $section) {
                         [$closing_tag, $is_p_closed] = $this->open_or_close_p($is_p_closed, $class, CLOSE);
                         $html .= $closing_tag;
+
+                        // if previous iteration was diferent class close p
+                    } elseif ($i != 0 && array_map('trim', explode(",", $this->str_val_or_empty($data[$i - 1], 'class'))) != $class) {
+                        [$closing_tag, $is_p_closed] = $this->open_or_close_p($is_p_closed, $class, CLOSE);
+                        $html .= $closing_tag;
                     }
 
                     $html .= $this->form_h2_title($data, $i, $section, $url, $title, $class);