{% extends "wiki/base.html" %}
{% load i18n %}
{% load markup %}
{% load paginator %}
{% load wiki %}

{% block contents %}
    <h1>Search results</h1>

<h3>Wikis</h3>
{% if wikis %}
    <table>
	<tr>
	  <th>Name</th>
	  <th>Description</th>
	  <th>Long description</th>
	</tr>
        {% for obj in wikis %}
        <tr>
          <td><a href="{{ obj.get_absolute_url }}">{{ obj.absolutename }}</a></td>
          <td>{{ obj.desc }}</td>
          <td><span style="align: center; font-size: 75%;">{{ obj.long_desc|default:"--"|truncatewords_html:4 }}</span></td>
        </tr>
        {% endfor %}
    </table>
{% else %}
    <p>No wikis found.</p>
{% endif %}

<h3>Pages</h3>
{% if pages %}
    <table>
	<tr>
	  <th>Name</th>
	  <th>Description</th>
	  <th>Title</th>
	  <th>Text</th>
	</tr>
        {% for obj in pages %}
        <tr>
          <td><a href="{{ obj.get_absolute_url }}">{{ obj.absolutename }}</a></td>
          <td>{{ obj.desc }}</td>
          <td>{{ obj.title }}</td>
          <td><span style="align: center; font-size: 75%;">{{ obj.get_content|wiki|truncatewords_html:4 }}</span></td>
        </tr>
        {% endfor %}
    </table>
{% else %}
    <p>No pages found.</p>
{% endif %}

<h3>Page contents</h3>
{% if pagecontents %}
    <table>
	<tr>
	  <th>Name</th>
	  <th>Description</th>
	  <th>Revision</th>
	  <th>Title</th>
	  <th>Text</th>
	</tr>
        {% for pc in pagecontents %}
        <tr>
          <td><a href="{{ pc.page.get_absolute_url }}?rev={{ pc.rev }}">{{ pc.page.absolutename }}</a></td>
          <td>{{ pc.page.desc }}</td>
          <td>r{{ pc.rev }}</td>
          <td>{{ pc.title|default:"--"|truncatewords_html:4 }}</td>
          <td><span style="align: center; font-size: 75%;">{{ pc|wiki|truncatewords_html:4 }}</span></td>
        </tr>
        {% endfor %}
    </table>
{% else %}
    <p>No page contents found.</p>
{% endif %}

<br>

{% endblock contents %}
