site

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

commit b0a0bcdcc6bf3c31217965ac9a7db8a59847ea6c
parent a9037853fdddec0a4623d5dc265e8e7e319051e9
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sun, 12 Apr 2026 04:39:52 +0000

chore: format

Diffstat:
Msrc/generate.c | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/generate.c b/src/generate.c @@ -144,7 +144,7 @@ void to_write_path(char **write_path, char *read_path) { *write_path = str_replace(*write_path, from_dir, to_dir); } -void get_content_metadata(StringMap **metadata, char* content_path) { +void get_content_metadata(StringMap **metadata, char *content_path) { FILE *content_fp = fopen(content_path, "r"); char *content_line = NULL; @@ -155,7 +155,8 @@ void get_content_metadata(StringMap **metadata, char* content_path) { bool metadata_start = false; - while((content_read = getline(&content_line, &content_len, content_fp)) != -1) { + while ((content_read = getline(&content_line, &content_len, content_fp)) != + -1) { if (strcmp(trim_whitespace(content_line), "---") == 0) { if (metadata_start) { break; @@ -170,8 +171,8 @@ void get_content_metadata(StringMap **metadata, char* content_path) { token = strtok(content_line, ":"); - char* metadata_key = NULL; - char* metadata_value = NULL; + char *metadata_key = NULL; + char *metadata_value = NULL; while (token != NULL) { if (metadata_key != NULL && metadata_value != NULL) { @@ -192,7 +193,8 @@ void get_content_metadata(StringMap **metadata, char* content_path) { } if (metadata_key != NULL && metadata_value != NULL) { - string_map_put(*metadata, trim_whitespace(metadata_key), trim_whitespace(metadata_value)); + string_map_put(*metadata, trim_whitespace(metadata_key), + trim_whitespace(metadata_value)); } } } @@ -247,7 +249,8 @@ void generate_pages(StringList *list) { if (string_map_contains(metadata, "title")) { char *title_tag; - asprintf(&title_tag, "<title>%s</title>", string_map_get(metadata, "title")); + asprintf(&title_tag, "<title>%s</title>", + string_map_get(metadata, "title")); fputs(title_tag, write_fp); }