geminispace.info

gemini search engine
git clone https://git.clttr.info/geminispace.info.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit b2026faac6ad331e3f0c70ab3512b25b32bb6798
parent 4136079b4e38f5d072e1aa61baa8c28e5df6409b
Author: Natalie Pendragon <natpen@natpen.net>
Date:   Sat, 16 May 2020 08:22:57 -0400

[serve] Update how num_results is displayed

Diffstat:
Mgus/serve.py | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gus/serve.py b/gus/serve.py @@ -242,12 +242,12 @@ def _render_results(results): return data -def _render_results_header(query, num_results): +def _render_results_header(query): return [ "", "# Search GUS", "", - "## \"{}\" - {} hits".format(query, num_results), + "## \"{}\"".format(query), "" ] @@ -260,7 +260,7 @@ def _render_results_footer(num_results, requested_page, query): current_page = min(requested_page, num_pages) if num_results == 0: current_page = 0 - data.append("Page {} of {}".format(current_page, num_pages)) + data.append("Page {} of {} ({} results)".format(current_page, num_pages, num_results)) if current_page > 2: data.append("=> /search?{} First Page".format(query)) if current_page > 1: @@ -285,7 +285,7 @@ def search(request): if request.query: requested_page = compute_requested_results_page(request.path) num_results, results = _search_index(request.query, requested_page) - data.extend(_render_results_header(request.query, num_results)) + data.extend(_render_results_header(request.query)) if num_results > 0: data.extend(_render_results(results)) else: