diff --git a/inc/Form/ButtonElement.php b/inc/Form/ButtonElement.php index 77c30ed4ff8439350f354a8cd22dc85d4d806f9b..e2afe9c972b3a36b4f29eda3b1bbe45fcbde4a3d 100644 --- a/inc/Form/ButtonElement.php +++ b/inc/Form/ButtonElement.php @@ -28,7 +28,7 @@ class ButtonElement extends Element { * @return string */ public function toHTML() { - return '<button ' . buildAttributes($this->attrs()) . '>'.$this->content.'</button>'; + return '<button ' . buildAttributes($this->attrs(), true) . '>'.$this->content.'</button>'; } } diff --git a/inc/Ui/Search.php b/inc/Ui/Search.php index f430a2ae15c3de3441e240bfc02a90b79730335c..3e40b835df359614f95663bf7c5eab9aaa931c5b 100644 --- a/inc/Ui/Search.php +++ b/inc/Ui/Search.php @@ -522,7 +522,7 @@ class Search extends Ui global $lang; $html = '<div class="search_quickresult">'; - $html .= '<h3>' . $lang['quickhits'] . ':</h3>'; + $html .= '<h2>' . $lang['quickhits'] . ':</h2>'; $html .= '<ul class="search_quickhits">'; foreach ($data as $id => $title) { $name = null; @@ -562,12 +562,14 @@ class Search extends Ui } $html = '<div class="search_fulltextresult">'; - $html .= '<h3>' . $lang['search_fullresults'] . ':</h3>'; + $html .= '<h2>' . $lang['search_fullresults'] . ':</h2>'; $html .= '<dl class="search_results">'; - $num = 1; + $num = 0; + $position = 0; foreach ($data as $id => $cnt) { + $position += 1; $resultLink = html_wikilink(':' . $id, null, $highlight); $resultHeader = [$resultLink]; @@ -578,34 +580,32 @@ class Search extends Ui $resultHeader[] = $restrictQueryToNSLink; } - $snippet = ''; - $lastMod = ''; + $resultBody = []; $mtime = filemtime(wikiFN($id)); + $lastMod = '<span class="lastmod">' . $lang['lastmod'] . '</span> '; + $lastMod .= '<time datetime="' . date_iso8601($mtime) . '" title="'.dformat($mtime).'">' . dformat($mtime, '%f') . '</time>'; + $resultBody['meta'] = $lastMod; 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'] . ' '; - $lastMod .= '<time datetime="' . date_iso8601($mtime) . '" title="'.dformat($mtime).'">' . dformat($mtime, '%f') . '</time>'; - $lastMod .= '</span>'; - } $num++; + $hits = '<span class="hits">' . $cnt . ' ' . $lang['hits'] . '</span>, '; + $resultBody['meta'] = $hits . $resultBody['meta']; + if ($num <= FT_SNIPPET_NUMBER) { // create snippets for the first number of matches only + $resultBody['snippet'] = ft_snippet($id, $highlight); + } } - $metaLine = '<div class="search_results__metaLine">'; - $metaLine .= $lastMod; - $metaLine .= '</div>'; - - $eventData = [ 'resultHeader' => $resultHeader, - 'resultBody' => [$metaLine, $snippet], + 'resultBody' => $resultBody, 'page' => $id, + 'position' => $position, ]; trigger_event('SEARCH_RESULT_FULLPAGE', $eventData); $html .= '<div class="search_fullpage_result">'; $html .= '<dt>' . implode(' ', $eventData['resultHeader']) . '</dt>'; - $html .= implode('', $eventData['resultBody']); + foreach ($eventData['resultBody'] as $class => $htmlContent) { + $html .= "<dd class=\"$class\">$htmlContent</dd>"; + } $html .= '</div>'; } $html .= '</dl>'; diff --git a/inc/Ui/SearchState.php b/inc/Ui/SearchState.php index f45156d282e18594d9be8fdc4aa8ec801c1b389f..eb3f7faebbc67ad394b1af9a5c4bb7e08455b2df 100644 --- a/inc/Ui/SearchState.php +++ b/inc/Ui/SearchState.php @@ -136,6 +136,6 @@ class SearchState } $href = wl($ID, $hrefAttributes, false, '&'); - return "<a href='$href' " . buildAttributes($tagAttributes) . ">$label</a>"; + return "<a href='$href' " . buildAttributes($tagAttributes, true) . ">$label</a>"; } } diff --git a/lib/tpl/dokuwiki/css/_search.less b/lib/tpl/dokuwiki/css/_search.less index ad41ac58193453401f58965cacf7c007bbdc0909..59400f9760e47e1114d158e9b4e093f4a548d704 100644 --- a/lib/tpl/dokuwiki/css/_search.less +++ b/lib/tpl/dokuwiki/css/_search.less @@ -108,8 +108,6 @@ .dokuwiki div.search_quickresult { margin-bottom: 1.4em; - h3 { - } ul { padding: 0; @@ -136,8 +134,13 @@ margin-bottom: .2em; } + /* last modified line */ + dd.meta { + margin: 0 0 .2em 0; + } + /* search snippet */ - dd { + dd.snippet { color: @ini_text_alt; background-color: inherit; margin: 0 0 1.2em 0;