Commits

lastmc  committed 3cc47fa

update search results formatting

  • Participants
  • Parent commits c044021

Comments (0)

Files changed (1)

File c5t/core/templates/search.mak

 <%inherit file="local:templates.master"/>
+<%! from c5t.core.lib import helpers as h %>
 
 <%def name="title()">Search Results</%def>
 <h2>${title()}</h2>
 
 %if slug_pages:
     <h3>Results in Name</h3>
-    <table>
-        <tr><th>Name</th><th>Path</th><th>Excerpt</th></tr>
         %for page in slug_pages:
-        <tr>
-            <td><a href="../${page.path()}/">${page.title}</a></td>
-            <td>${page.path()}</td>
-            <td>${page.text[:50] |n}...</td>
-        ##    <td>${page.template}</td>
-        ##    <td>${page.docstring}</td>
-        ##    <td>${str([tag for tag in page.tags])}</td>
-        </tr>
+        <div class="search_results_box">
+          <span class="search_results_title"><a href="../${page.path()}/">${page.title}</a></span>
+          <span class="search_results_path">${page.path()}</span>
+          <% thetext = h.strip_tags(page.text) %>
+          <span class="search_results_text">${thetext[:350]}...</span>
+          </div>
         %endfor
-    </table>
+
+##    <table>
+##        <tr><th>Name</th>
+##       ## <th>Path</th>
+##       <th>Excerpt</th></tr>
+##        %for page in slug_pages:
+##        <tr>
+##            <td><a href="../${page.path()}/">${page.title}</a></td>
+##        ##    <td>${page.path()}</td>
+##            <td>${page.text[:50] |n}...</td>
+##        ##    <td>${page.template}</td>
+##        ##    <td>${page.docstring}</td>
+##        ##    <td>${str([tag for tag in page.tags])}</td>
+##        </tr>
+##        %endfor
+##    </table>
 %endif
 
 <br/>
 
 % if text_pages:
     <h3>Results in Text</h3>
-    <table>
-    <tr><th>Name</th><th>Path</th><th>Excerpt</th></tr>
-    %for page in text_pages:
-    <tr>
-        <td><a href="../${page.path()}/">${page.title}</a></td>
-        <td>${page.path()}</td>
-        <td>${page.text[:50]}...</td>
-    ##    <td>${page.template}</td>
-    ##    <td>${page.docstring}</td>
-    ##    <td>${str([tag for tag in page.tags])}</td>
-    </tr>
-    %endfor
-    </table>
+        %for page in text_pages:
+        <div class="search_results_box">
+          <span class="search_results_title"><a href="../${page.path()}/">${page.title}</a></span>
+          <span class="search_results_path">${page.path()}</span>
+          <% thetext = h.strip_tags(page.text) %>
+          <span class="search_results_text">${thetext[:350]}...</span>
+          </div>
+        %endfor
+##    <table>
+##    <tr><th>Name</th>
+##    ## <th>Path</th>
+##    <th>Excerpt</th></tr>
+##    %for page in text_pages:
+##    <tr>
+##        <td><a href="../${page.path()}/">${page.title}</a></td>
+##    ##    <td>${page.path()}</td>
+##    <% thetext = h.strip_tags(page.text) %>
+##        <td>${thetext}...</td>
+##    ##    <td>${page.template}</td>
+##    ##    <td>${page.docstring}</td>
+##    ##    <td>${str([tag for tag in page.tags])}</td>
+##    </tr>
+##    %endfor
+##    </table>
 % endif
 
 <br/>
     % endfor
     </table>
 %endif
+
+<style>
+.search_results_title{
+font-size: 1.5em;
+display:block;
+}
+.search_results_path{
+font-size: 1em;
+color:#7E7E7E;
+display:block;
+}
+.search_results_text{
+font-size: 1.3em;
+}
+.search_results_box{
+margin: 10px 0;
+}
+</style>