site

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

commit 852660d63b5cfff1f564de1cd58a776b6b3d0560
parent 8c801c65d2b6ab724438a5bacbbad2a4ccecd6ae
Author: Henry Unite <unitehenry@gmail.com>
Date:   Thu,  9 Apr 2026 03:48:36 +0000

refactor: to write path

Diffstat:
Msrc/main.c | 20++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -58,19 +58,23 @@ void run_pandoc(FILE *fp, char *content_path) { fp = popen(command, "w"); } -void generate_pages(StringList *list) { - int i = 0; +void to_write_path(char *write_path, char* read_path) { + char replace_path[strlen(read_path)]; - while (list->strings[i] != NULL) { - char replace_path[strlen(list->strings[i])]; + strcpy(replace_path, read_path); + + strcpy(write_path, str_replace(replace_path, ".md", ".html")); - strcpy(replace_path, list->strings[i]); + strcpy(write_path, str_replace(write_path, "content/", "static/")); +} - char *write_path; +void generate_pages(StringList *list) { + int i = 0; - write_path = str_replace(replace_path, ".md", ".html"); + while (list->strings[i] != NULL) { + char write_path[40]; - write_path = str_replace(write_path, "content/", "static/"); + to_write_path(write_path, list->strings[i]); printf("filepath: %s\n", write_path);