sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 5a3995ae274b7fa19823a5fae72afe1c493a4c44
parent 827b00dc552c1c1087c8bfb36d6aba7399960878
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat,  6 Apr 2019 14:46:41 +0200

sfeed_frames/sfeed_html: improve HTML output a bit

declare UTF-8 before <title>

Diffstat:
Msfeed_frames.c | 26+++++++++++++++++---------
Msfeed_html.c | 2+-
2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/sfeed_frames.c b/sfeed_frames.c @@ -109,9 +109,13 @@ main(int argc, char *argv[]) if (pledge(argc == 1 ? "stdio" : "stdio rpath", NULL) == -1) err(1, "pledge"); - fputs("<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head>" - "<body class=\"frame\"><div id=\"items\"><pre>", fpitems); + fputs("<!DOCTYPE HTML>\n" + "<html>\n" + "\t<head>\n" + "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" + "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n" + "</head>\n" + "<body class=\"frame\"><div id=\"items\"><pre>\n", fpitems); if (argc == 1) { if (!(feeds[0] = calloc(1, sizeof(struct feed)))) @@ -136,10 +140,13 @@ main(int argc, char *argv[]) fputs("</pre>\n</div></body>\n</html>\n", fpitems); /* div items */ if (showsidebar) { - fputs("<html><head>" - "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n" - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" - "</head><body class=\"frame\"><div id=\"sidebar\">", fpmenu); + fputs("<!DOCTYPE HTML>\n" + "<html>\n" + "<head>\n" + "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" + "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n" + "</head>\n" + "<body class=\"frame\">\n<div id=\"sidebar\">\n", fpmenu); for (i = 1; i < argc; i++) { f = feeds[i - 1]; @@ -159,10 +166,11 @@ main(int argc, char *argv[]) } fputs("</div></body></html>\n", fpmenu); } - fputs("<!DOCTYPE html><html><head>\n\t<title>Newsfeed (", fpindex); + fputs("<!DOCTYPE html>\n<html>\n<head>\n" + "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" + "\t<title>Newsfeed (", fpindex); fprintf(fpindex, "%lu", totalnew); fputs(")</title>\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n" - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" "</head>\n", fpindex); if (showsidebar) { fputs("<frameset framespacing=\"0\" cols=\"250,*\" frameborder=\"1\">\n" diff --git a/sfeed_html.c b/sfeed_html.c @@ -103,7 +103,7 @@ main(int argc, char *argv[]) fputs("\t\t<div id=\"items\">\n", stdout); else fputs("\t\t<div id=\"items\" class=\"nosidebar\">\n", stdout); - fputs("<pre>", stdout); + fputs("<pre>\n", stdout); if (argc == 1) { if (!(feeds[0] = calloc(1, sizeof(struct feed))))