From 7c15eaa29640023b3e82c2bbe675d667837b955e Mon Sep 17 00:00:00 2001 From: Anika Henke <anika@selfthinker.org> Date: Sun, 15 Apr 2018 15:06:12 +0100 Subject: [PATCH] Fix invalid HTML in search results Recent changes to the search results page added various divs to the pre-existing description list, which is invalid. This fixes that by a) removing a couple of unnecessary elements and b) interpret the 'last modified' line as another 'dd'. --- inc/Ui/Search.php | 12 ++++-------- lib/tpl/dokuwiki/css/_search.less | 7 ++++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/inc/Ui/Search.php b/inc/Ui/Search.php index f430a2ae1..eef7dfa19 100644 --- a/inc/Ui/Search.php +++ b/inc/Ui/Search.php @@ -584,18 +584,16 @@ class Search extends Ui if ($cnt !== 0) { $resultHeader[] = $cnt . ' ' . $lang['hits']; if ($num < FT_SNIPPET_NUMBER) { // create snippets for the first number of matches only - $snippet = '<dd>' . ft_snippet($id, $highlight) . '</dd>'; - $lastMod = '<span class="search_results__lastmod">' . $lang['lastmod'] . ' '; + $snippet = '<dd class="snippet">' . ft_snippet($id, $highlight) . '</dd>'; + $lastMod = $lang['lastmod'] . ' '; $lastMod .= '<time datetime="' . date_iso8601($mtime) . '" title="'.dformat($mtime).'">' . dformat($mtime, '%f') . '</time>'; - $lastMod .= '</span>'; } $num++; } - $metaLine = '<div class="search_results__metaLine">'; + $metaLine = '<dd class="lastmod">'; $metaLine .= $lastMod; - $metaLine .= '</div>'; - + $metaLine .= '</dd>'; $eventData = [ 'resultHeader' => $resultHeader, @@ -603,10 +601,8 @@ class Search extends Ui 'page' => $id, ]; trigger_event('SEARCH_RESULT_FULLPAGE', $eventData); - $html .= '<div class="search_fullpage_result">'; $html .= '<dt>' . implode(' ', $eventData['resultHeader']) . '</dt>'; $html .= implode('', $eventData['resultBody']); - $html .= '</div>'; } $html .= '</dl>'; diff --git a/lib/tpl/dokuwiki/css/_search.less b/lib/tpl/dokuwiki/css/_search.less index ad41ac581..f3c3fd8dc 100644 --- a/lib/tpl/dokuwiki/css/_search.less +++ b/lib/tpl/dokuwiki/css/_search.less @@ -136,8 +136,13 @@ margin-bottom: .2em; } + /* last modified line */ + dd.lastmod { + margin: 0 0 .2em 0; + } + /* search snippet */ - dd { + dd.snippet { color: @ini_text_alt; background-color: inherit; margin: 0 0 1.2em 0; -- GitLab