diff options
author | Daniel Jones <daniel@danieljon.es> | 2024-11-03 00:52:31 +1100 |
---|---|---|
committer | Daniel Jones <daniel@danieljon.es> | 2024-11-03 00:52:31 +1100 |
commit | 5af96ff5769b604cd726b5e53610f2870063f456 (patch) | |
tree | a2508f3e6f5a2ffd2f188922c33c2d1c71c822b1 | |
parent | cc57c4112ace6bc70af1d3f5314980fa8df587f7 (diff) | |
download | websitegenerator-5af96ff5769b604cd726b5e53610f2870063f456.tar.gz websitegenerator-5af96ff5769b604cd726b5e53610f2870063f456.zip |
post titles
make post titles links to the direct page as it isn't obvious the number girls are a link
-rw-r--r-- | pages.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -657,9 +657,37 @@ writeposts(const int *posts, size_t totalposts, const char *outfile, int current return 0; } char c; + int in_title = 1; while ((c = fgetc(postfile)) != EOF) { - fputc(c, tmp); + // first line has to be the title + // 1 = start + // 2 = writing + // 3 = end + // -1 = not in title + if (in_title == 1) + { + fprintf(tmp, "<a href='direct/%d.html'>", post); + fputc(c, tmp); + in_title = 2; + } + else if (in_title == 3) + { + + fprintf(tmp, "</a>"); + fputc(c, tmp); + in_title = -1; + } + else if (in_title == 2 && c == '\n') + { + // check if we are finished title (new line) + in_title = 3; + fputc(c, tmp); + } + else + { + fputc(c, tmp); + } } fprintf(tmp, "<hr>\n"); fclose(postfile); |