HTMLify
search-result.html
Views: 470 | Author: abh
1 2 3 4 5 6 7 8 9 10 11 | <!-- search-result.html --> <form class="search-form" action="/search" method="GET" style="margin:20p;"> <input type="text" name="q" value="{{ q }}"/> <input type="submit" value="Search" /> </form> {% for result in results %} <div class="search-result" style="border:1px solid black;margin:5px;padding:5px;"> <span>{{ result.name }}</span> | <span>Owner: {{ result.owner }} | <a href="{{ result.path }}">Open</a>{% if session.get("user") and result.owner == session["user"]["username"] %} | <a href="/edit?filepath={{ result.path[result.owner|length + 1:] }}">Edit</a>{% endif %}</a></span><br> <p>{{ result.content.replace("<", "<").replace(">", ">")[result.content.find(q)-100:result.content.find(q)+100].replace(q, "<b>" + q + "</b>")|safe }}</p> </div> {% endfor %} |