commit 70926b9a88101487939cb9e974dae2dc1b2403e7
parent e348382c18b7b3f9a0ca9f713b864d9c6b5a2f48
Author: krasjet
Date: 2020-07-12 08:47Z

clean up meta headers

Diffstat:
Mstagit.c | 25++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/stagit.c b/stagit.c @@ -341,9 +341,12 @@ printtimeshort(FILE *fp, const git_time *intime) void writeheader(FILE *fp, const char *title) { - fputs("<!DOCTYPE html>\n" - "<html>\n<head>\n" - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" + fputs("<!doctype html>\n" + "<html lang=\"en\">\n<head>\n" + "<meta charset=\"utf-8\" />\n" + "<meta name=\"format-detection\" content=\"telephone=no\" />\n" + "<meta name=\"robots\" content=\"noindex\" />\n" + "<meta name=\"referrer\" content=\"no-referrer\" />\n" "<title>", fp); xmlencode(fp, title, strlen(title)); if (title[0] && strippedname[0]) @@ -352,10 +355,10 @@ writeheader(FILE *fp, const char *title) if (description[0]) fputs(" - ", fp); xmlencode(fp, description, strlen(description)); - fputs("</title>\n<link rel=\"icon\" type=\"image/png\" href=\"/favicon.png\" />", fp); - fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n", - name, relpath); - fputs("<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\" />", fp); + fputs("</title>\n", fp); + fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s atom feed\" href=\"%satom.xml\" />\n", + strippedname, relpath); + fputs("<link rel=\"stylesheet\" href=\"/style.css\" />\n", fp); fputs("</head>\n<body>\n<table><tr><td>", fp); fputs("<a href=\"/\"><img src=\"/logo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>", fp); fputs("</td><td><h1>", fp); @@ -1142,8 +1145,12 @@ main(int argc, char *argv[]) fpread = fopen(path, "r"); } if (fpread) { - if (!fgets(description, sizeof(description), fpread)) - description[0] = '\0'; + if (fgets(description, sizeof(description), fpread)) { + /* strip line break at the end */ + description[strcspn(description, "\r\n")] = '\0'; + } else { + description[0] = '\0'; + } fclose(fpread); }