From 8b688d142875aa547b7fd7a55f052fc5dbcc2b18 Mon Sep 17 00:00:00 2001 From: Stephen Cochrane Date: Sun, 3 May 2020 20:47:39 +0200 Subject: [PATCH] Blog Software done --- .gitignore | 1 + Makefile | 5 ++++- blogs/preamble/end.html | 2 +- blogs/preamble/start.html | 2 +- index.html | 2 +- setup.html | 2 +- src/GenBlog.c | 14 +++++++++++++- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index d84b057..8475f1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp bin/ obj/ +blogs.html diff --git a/Makefile b/Makefile index 60b072d..a78c93f 100644 --- a/Makefile +++ b/Makefile @@ -16,20 +16,23 @@ install: mkdir -p blogs clean: + rm -rf blogs/*.html + rm -rf ./blogs.html rm -rf obj rm -rf bin blog: all @# Reset all blogs to start build. - -rm -rf blogs/*.html @# Setup boilerplate html files for blog files -@for blog in ./blogs/RawBlogs/*.blog ; do \ blog=$$(echo $$blog | cut -c 17- | cut -d "." -f 1); \ cp ./blogs/preamble/start.html ./blogs/$$blog.html; \ done + -@cp ./blogs/preamble/start.html ./blogs.html ./bin/GenBlog @# Append the end of the file once done -@for blog in ./blogs/RawBlogs/*.blog ; do \ blog=$$(echo $$blog | cut -c 17- | cut -d "." -f 1); \ cat ./blogs/preamble/end.html >> ./blogs/$$blog.html; \ done + -@cat ./blogs/preamble/end.html >> ./blogs.html diff --git a/blogs/preamble/end.html b/blogs/preamble/end.html index fcaaf94..b9f882b 100644 --- a/blogs/preamble/end.html +++ b/blogs/preamble/end.html @@ -1,4 +1,4 @@ -View page source +View page source diff --git a/blogs/preamble/start.html b/blogs/preamble/start.html index db9536a..71a6a83 100644 --- a/blogs/preamble/start.html +++ b/blogs/preamble/start.html @@ -32,6 +32,6 @@
 
- 🅱️ HOME 🅱️
+ 🅱️ HOME 🅱️
 
 
diff --git a/index.html b/index.html
index 442079b..42e552c 100644
--- a/index.html
+++ b/index.html
@@ -33,7 +33,7 @@
 	}
 
 
-HOME  My Setup  Blog  Install dotfiles  Projects  My Github
+HOME  My Setup  Blog  Install dotfiles  Projects  My Github
 
 My Git Server  IRC Webclient (Channel: #club45)
 
diff --git a/setup.html b/setup.html
index 41ff65d..6260135 100644
--- a/setup.html
+++ b/setup.html
@@ -32,7 +32,7 @@
 	}
 
 
- 🅱️ HOME 🅱️
+ 🅱️ HOME 🅱️
 
 
 +-------------------------------------------------------+
diff --git a/src/GenBlog.c b/src/GenBlog.c
index 1847362..317b150 100644
--- a/src/GenBlog.c
+++ b/src/GenBlog.c
@@ -19,6 +19,7 @@ int main() {
 	struct dirent *ent;
 	char buff[256];
 	char htmlName[256];
+	char link[256];
 	char cat[2];
 	char *c;
 	int i;
@@ -27,6 +28,7 @@ int main() {
 		while ((ent = readdir(dir)) != NULL) {
 			if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, "..")) {
 				sprintf(htmlName, "./blogs/");
+				sprintf(link, "");
 
 				c = ent->d_name;
 				i = 0;
@@ -34,15 +36,25 @@ int main() {
 					cat[0] = c[i];
 					cat[1] = '\0';
 					strcat(htmlName, cat);
+					strcat(link, cat);
 					i++;
 				}
 				strcat(htmlName, ".html");
+
 				printf("%s\n", htmlName);
 				sprintf(buff, "./blogs/RawBlogs/");
 				strcat(buff, ent->d_name);
-				printf("opening, %s, %s|\n", buff, htmlName);
+				printf("opening, %s, %s, %s\n", buff, htmlName, link);
 				chtml = fopen(htmlName, "a+");
 				genBP(buff);
+				// Add links now
+				chtml = fopen("./blogs.html", "a+");
+				append_html("
"); + append_html(link); + append_html("
\n"); + fclose(chtml); } } }