diff options
Diffstat (limited to '')
-rw-r--r-- | html.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/html.c b/html.c index 1757fd9..25c9118 100644 --- a/html.c +++ b/html.c @@ -362,6 +362,24 @@ int htmlMessageClose(FILE *file) { return templateRender(file, Q(</article>), NULL, NULL); } +static int htmlStylesheet(FILE *file) { + if (baseStylesheet) { + const char *template = Q(<link rel="stylesheet" href="[href]">); + struct Variable vars[] = { + { "href", baseStylesheet }, + {0}, + }; + return templateRender(file, template, vars, escapeXML); + } else { + const char *template = Q(<style>[style]</style>); + struct Variable vars[] = { + { "style", Stylesheet }, + {0}, + }; + return templateRender(file, template, vars, NULL); + } +} + static char *htmlThreadURL(const struct Envelope *envelope, const char *type) { struct Variable vars[] = { { "messageID", envelope->messageID }, @@ -381,6 +399,7 @@ int htmlThreadHead(FILE *file, const struct Envelope *envelope) { <title>[subject]</title> <link rel="alternate" type="application/atom+xml" href="[atom]"> <link rel="alternate" type="application/mbox" href="[mbox]"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> ); struct Variable vars[] = { { "generator", GENERATOR_URL }, @@ -389,7 +408,9 @@ int htmlThreadHead(FILE *file, const struct Envelope *envelope) { { "mbox", mbox }, {0}, }; - int error = templateRender(file, template, vars, escapeXML); + int error = 0 + || templateRender(file, template, vars, escapeXML) + || htmlStylesheet(file); free(atom); free(mbox); return error; @@ -488,13 +509,16 @@ int htmlIndexHead(FILE *file) { <meta name="generator" content="[generator]"> <title>[title]</title> <link rel="alternate" type="application/atom+xml" href="index.atom"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> ); struct Variable vars[] = { { "generator", GENERATOR_URL }, { "title", baseTitle }, {0}, }; - return templateRender(file, template, vars, escapeXML); + return 0 + || templateRender(file, template, vars, escapeXML) + || htmlStylesheet(file); } int htmlIndexOpen(FILE *file) { |