From 64003835f0446d05b5a53a527e29d5634a9b80be Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 11 Jun 2021 19:05:54 -0400 Subject: Generate navigation for search pages --- html.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index 5eb2f29..6b25996 100644 --- a/html.c +++ b/html.c @@ -545,12 +545,40 @@ int htmlSearchHead(FILE *file, const char *name) { return error; } -int htmlSearchOpen(FILE *file, const char *name) { +static int htmlSearchNav( + FILE *file, const char *name, char *searches[const], size_t len +) { + if (len < 2 || strcmp(name, "index")) return 0; + int error = templateRender(file, Q(), NULL, NULL); +} + +int htmlSearchOpen( + FILE *file, const char *name, char *searches[const], size_t len +) { + char *index = htmlSearchURL("index", "html"); char *atom = htmlSearchURL(name, "atom"); const char *template = Q(

[+name][name] - [-][title]

+ ); + const char *tail = Q(
    @@ -566,12 +596,17 @@ int htmlSearchOpen(FILE *file, const char *name) { struct Variable vars[] = { { "name", (strcmp(name, "index") ? name : NULL) }, { "title", baseTitle }, + { "index", index }, { "atom", atom }, { "subscribe", baseSubscribe }, { "mailto", baseMailto }, {0}, }; - int error = templateRender(file, template, vars, escapeXML); + int error = 0 + || templateRender(file, template, vars, escapeXML) + || htmlSearchNav(file, name, searches, len) + || templateRender(file, tail, NULL, NULL); + free(index); free(atom); return error; } -- cgit 1.4.1