cld-ssg

The static site generator (to be) used for hellocld.com
git clone git://git.hellocld.com/cld-ssg
Log | Files | Refs

commit ebddfcf28d8272c64543b262a7adb879675b4396
parent 93f949d3e9379c48debcc59e440f75d1d39f446a
Author: Christopher Ray Langford <chris@hellocld.com>
Date:   Wed, 11 Sep 2019 22:03:52 -0400

Stubbed out functions for generation; added config.h

Diffstat:
Aconfig.h | 15+++++++++++++++
Mmain.c | 45+++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/config.h b/config.h @@ -0,0 +1,15 @@ +/* + * config.h + * + * Configuration for cld-ssg. Define stuff like directory paths, max posts on + * index.html, char* lengths, etc. + */ + +#define HTMLDIR "" +#define INDEX_POSTS 10 + +/* I should probably use some system defaults for these */ +#define MAX_CONTENT_CHARS 10000000 +#define MAX_TITLE_CHARS 1000 +#define MAX_URL_CHARS 1000 + diff --git a/main.c b/main.c @@ -2,11 +2,26 @@ #include <dirent.h> #include <stdlib.h> #include <string.h> +#include "config.h" int md_filter(const struct dirent *); +struct post { + char *title; + char *url; + char * content; + struct tm *time; +}; + +struct post *create_post(const char *path); +int create_all_posts(struct post *posts); +int create_index(struct post *posts, int totalPosts); +int create_archive(struct post *posts, int totalPosts); +int create_rss(struct post *posts, int totalPosts); + int main() { + printf("*** cmark testing ***\n\n"); char *md = "This is a *test* of some `markdown`"; @@ -41,3 +56,33 @@ int md_filter(const struct dirent *d) return 1; return 0; } + +/* Returns a pointer to a post struct from a .md file */ +struct post *create_post(const char *path) +{ + +} + +/* Generates all posts found in ./_posts; returns total number of posts */ +int create_all_posts(struct post *posts) +{ + +} + +/* Generates index.html using the latest posts */ +int create_index(struct post *posts, int totalPosts) +{ + +} + +/* Generates archive.html using all posts */ +int create_arcive(struct post *posts, int totalPosts) +{ + +} + +/* Creates an rss feed from all posts */ +int create_rss(struct post *posts, int totalPosts) +{ + +}