Skip to content

Commit 91b05b6

Browse files
committed
improved HTML for search results
Attention: Template authors need to adjust their CSS! Original structure: div.search_result > a.wikilink1 > span.search_cnt br div.search_snippet New structure: dl.search_results > dt > a.wikilink1 dd
1 parent d5acc30 commit 91b05b6

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

inc/html.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ function html_search(){
323323
flush();
324324

325325
//show progressbar
326-
print '<div class="centeralign" id="dw__loading">'.NL;
326+
print '<div id="dw__loading">'.NL;
327327
print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
328328
print 'showLoadBar();'.NL;
329329
print '//--><!]]></script>'.NL;
330-
print '<br /></div>'.NL;
330+
print '</div>'.NL;
331331
flush();
332332

333333
//do quick pagesearch
@@ -363,20 +363,24 @@ function html_search(){
363363
//do fulltext search
364364
$data = ft_pageSearch($QUERY,$regex);
365365
if(count($data)){
366+
print '<dl class="search_results">';
366367
$num = 1;
367368
foreach($data as $id => $cnt){
368-
print '<div class="search_result">';
369+
print '<dt>';
369370
print html_wikilink(':'.$id,useHeading('navigation')?null:$id,$regex);
370371
if($cnt !== 0){
371-
print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />';
372+
print ': '.$cnt.' '.$lang['hits'].'';
373+
}
374+
print '</dt>';
375+
if($cnt !== 0){
372376
if($num < FT_SNIPPET_NUMBER){ // create snippets for the first number of matches only
373-
print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>';
377+
print '<dd>'.ft_snippet($id,$regex).'</dd>';
374378
}
375379
$num++;
376380
}
377-
print '</div>';
378381
flush();
379382
}
383+
print '</dl>';
380384
}else{
381385
print '<div class="nothing">'.$lang['nothingfound'].'</div>';
382386
}

lib/tpl/default/design.css

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,12 +706,20 @@ div.insitu-footnote {
706706
}
707707

708708
/* --------------- search result formating --------------- */
709-
div.dokuwiki .search_result {
710-
margin-bottom: 6px;
709+
#dw__loading {
710+
text-align: center;
711+
margin-bottom: 1em;
712+
}
713+
714+
div.dokuwiki .search_results {
711715
padding: 0 10px 0 30px;
712716
}
713717

714-
div.dokuwiki .search_snippet {
718+
div.dokuwiki .search_results dt {
719+
margin-bottom: 3px;
720+
}
721+
div.dokuwiki .search_results dd {
722+
margin-bottom: 6px;
715723
color: __text_other__;
716724
font-size: 12px;
717725
margin-left: 20px;

lib/tpl/dokuwiki/css/_search.css

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
/* loading gif */
1010
#dw__loading {
11+
text-align: center;
12+
margin-bottom: 1.4em;
1113
}
1214

1315
/*____________ matching pagenames ____________*/
@@ -31,14 +33,20 @@
3133

3234
/*____________ search results ____________*/
3335

34-
/* container for one search result */
35-
.dokuwiki div.search_result {
36-
margin-bottom: 1.4em;
36+
.dokuwiki dl.search_results {
37+
margin-bottom: 1.2em;
38+
}
39+
40+
/* search heading */
41+
.dokuwiki dl.search_results dt {
42+
font-weight: normal;
43+
margin-bottom: .2em;
3744
}
3845
/* search snippet */
39-
.dokuwiki div.search_result div.search_snippet {
46+
.dokuwiki dl.search_results dd {
4047
color: __text_alt__;
4148
background-color: inherit;
49+
margin: 0 0 1.2em 0;
4250
}
4351

4452
/* search hit in normal text */
@@ -47,11 +55,11 @@
4755
background-color: __highlight__;
4856
}
4957
/* search hit in search results */
50-
.dokuwiki div.search_result strong.search_hit {
58+
.dokuwiki .search_results strong.search_hit {
5159
font-weight: normal;
5260
}
5361
/* ellipsis separating snippets */
54-
.dokuwiki div.search_result .search_sep {
62+
.dokuwiki .search_results .search_sep {
5563
color: __text__;
5664
background-color: inherit;
5765
}

0 commit comments

Comments
 (0)