fix classes acting weidly in p open-close logic when an a was involved
authorEduardo <[email protected]>
Sat, 25 Nov 2023 13:32:27 +0000 (14:32 +0100)
committerEduardo <[email protected]>
Sat, 25 Nov 2023 13:32:27 +0000 (14:32 +0100)
page-generator/generator.php

index b94d946315fcf02d459c62704d71c2ddc5199338..f5e1de22e0e2faa9e0c8a59e8f131b1ce12894ab 100644 (file)
@@ -191,9 +191,11 @@ class CodeGenerator
                         $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;
+                    } elseif ($i != 0 && empty($url)) { // need to check if url is empty cause if not then the classes will go in the a tag
+                        if (empty($this->str_val_or_empty($data[$i - 1], 'url')) && 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);