site

A custom static site generator written in C.
git clone https://unitehenry.com/git/site.git
Log | Files | Refs | README

commit 8014d719cb540c58d515abfe2d2534f264ba8717
parent 2f79e5b9ed935de02826b2e4342cfd6c9e4a3e09
Author: Henry Unite <unitehenry@gmail.com>
Date:   Thu,  9 Apr 2026 03:04:38 +0000

feat: generate pages iterator

Diffstat:
Mcontent/blog/nested/nested-1.md | 1+
Msrc/main.c | 27+++++++++++++++++++++------
2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/content/blog/nested/nested-1.md b/content/blog/nested/nested-1.md @@ -0,0 +1 @@ +nested content diff --git a/src/main.c b/src/main.c @@ -45,6 +45,26 @@ void get_content_files(StringList *list, char *content_path) { closedir(dr); } +void generate_pages(StringList *list) { + int i = 0; + + while (list->strings[i] != NULL) { + size_t command_len = strlen(list->strings[i]) + strlen("pandoc ") + 2; + + char command[command_len]; + + snprintf(command, sizeof(command), "pandoc %s", list->strings[i]); + + printf("%s\n", command); + + FILE *fp = popen(command, "w"); + + fclose(fp); + + i++; + } +} + int main(int argc, char **args) { if (argc < 2) { fprintf(stderr, "Must provide content directory\n"); @@ -56,12 +76,7 @@ int main(int argc, char **args) { get_content_files(list, args[1]); - int i = 0; - - while (list->strings[i] != NULL) { - printf("filepath: %s\n", list->strings[i]); - i++; - } + generate_pages(list); return 0; }