Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
selfthinker committed Apr 9, 2012
1 parent d5acc30 commit 91b05b6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
16 changes: 10 additions & 6 deletions inc/html.php
Expand Up @@ -323,11 +323,11 @@ function html_search(){
flush();

//show progressbar
print '<div class="centeralign" id="dw__loading">'.NL;
print '<div id="dw__loading">'.NL;
print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL;
print 'showLoadBar();'.NL;
print '//--><!]]></script>'.NL;
print '<br /></div>'.NL;
print '</div>'.NL;
flush();

//do quick pagesearch
Expand Down Expand Up @@ -363,20 +363,24 @@ function html_search(){
//do fulltext search
$data = ft_pageSearch($QUERY,$regex);
if(count($data)){
print '<dl class="search_results">';
$num = 1;
foreach($data as $id => $cnt){
print '<div class="search_result">';
print '<dt>';
print html_wikilink(':'.$id,useHeading('navigation')?null:$id,$regex);
if($cnt !== 0){
print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />';
print ': '.$cnt.' '.$lang['hits'].'';
}
print '</dt>';
if($cnt !== 0){
if($num < FT_SNIPPET_NUMBER){ // create snippets for the first number of matches only
print '<div class="search_snippet">'.ft_snippet($id,$regex).'</div>';
print '<dd>'.ft_snippet($id,$regex).'</dd>';
}
$num++;
}
print '</div>';
flush();
}
print '</dl>';
}else{
print '<div class="nothing">'.$lang['nothingfound'].'</div>';
}
Expand Down
14 changes: 11 additions & 3 deletions lib/tpl/default/design.css
Expand Up @@ -706,12 +706,20 @@ div.insitu-footnote {
}

/* --------------- search result formating --------------- */
div.dokuwiki .search_result {
margin-bottom: 6px;
#dw__loading {
text-align: center;
margin-bottom: 1em;
}

div.dokuwiki .search_results {
padding: 0 10px 0 30px;
}

div.dokuwiki .search_snippet {
div.dokuwiki .search_results dt {
margin-bottom: 3px;
}
div.dokuwiki .search_results dd {
margin-bottom: 6px;
color: __text_other__;
font-size: 12px;
margin-left: 20px;
Expand Down
20 changes: 14 additions & 6 deletions lib/tpl/dokuwiki/css/_search.css
Expand Up @@ -8,6 +8,8 @@

/* loading gif */
#dw__loading {
text-align: center;
margin-bottom: 1.4em;
}

/*____________ matching pagenames ____________*/
Expand All @@ -31,14 +33,20 @@

/*____________ search results ____________*/

/* container for one search result */
.dokuwiki div.search_result {
margin-bottom: 1.4em;
.dokuwiki dl.search_results {
margin-bottom: 1.2em;
}

/* search heading */
.dokuwiki dl.search_results dt {
font-weight: normal;
margin-bottom: .2em;
}
/* search snippet */
.dokuwiki div.search_result div.search_snippet {
.dokuwiki dl.search_results dd {
color: __text_alt__;
background-color: inherit;
margin: 0 0 1.2em 0;
}

/* search hit in normal text */
Expand All @@ -47,11 +55,11 @@
background-color: __highlight__;
}
/* search hit in search results */
.dokuwiki div.search_result strong.search_hit {
.dokuwiki .search_results strong.search_hit {
font-weight: normal;
}
/* ellipsis separating snippets */
.dokuwiki div.search_result .search_sep {
.dokuwiki .search_results .search_sep {
color: __text__;
background-color: inherit;
}
Expand Down

0 comments on commit 91b05b6

Please sign in to comment.