From: Eduardo Date: Sat, 25 Nov 2023 14:12:38 +0000 (+0100) Subject: setup same line logic in lists and fixed problems with a links inside those X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=d55b8760d0e3c4aa19b77f92a2c7a2f1680e1614;p=thericegoat.com.git setup same line logic in lists and fixed problems with a links inside those --- diff --git a/page-generator/generator.php b/page-generator/generator.php index f5e1de2..04d3675 100644 --- a/page-generator/generator.php +++ b/page-generator/generator.php @@ -328,7 +328,16 @@ class CodeGenerator private function form_list(string $text, array $class, string $url, string $title): string { - $html = "is_li_same_line = false; + else + $this->is_li_same_line = true; + + if (isset($this->was_li_same_line) && !$this->was_li_same_line) + $html = "filter_meta_classes($class); @@ -336,18 +345,27 @@ class CodeGenerator $html .= ' class="' . implode(' ', $filtered_classes) . '"'; // if has title and url = a with title - if (!empty($title) && !empty($url)) { - $html .= '>'; - $html .= $this->a($url, $text, $title, null); + if (!empty($url)) { + if (!$this->was_li_same_line) + $html .= '>'; + $html .= $this->a($url, $text, $title, $filtered_classes); + + if (in_array("no-space", $class)) + $html = trim($html); } // if has only title = span with title elseif (!empty($title)) { $html .= " title='$title'>$text"; - } else - $html .= ">$text"; + } else { + if (isset($this->was_li_same_line) && !$this->was_li_same_line) + $html .= '>'; + $html .= "$text"; + } - $html .= ""; + if (!$this->is_li_same_line) + $html .= ''; + $this->was_li_same_line = $this->is_li_same_line; return $html; }