aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael McVady <femtonaut@gmail.com>2023-04-20 23:15:47 -0500
committerMichael McVady <femtonaut@gmail.com>2023-04-20 23:15:47 -0500
commit900010b413359b77658e42eacf488cd6301fff67 (patch)
tree45b242779fb893544f876c079551974dffebb959
parentf6bc52181033e982cf5088e121af5d6e616cf8cd (diff)
Hack in Mermaid JS rendering
-rw-r--r--Makefile5
-rw-r--r--assets/index_end.html2
-rw-r--r--src/queries.h16
3 files changed, 9 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index a7f7cc1..2b48b13 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,6 @@ build:
clean:
kodev clean
rm -rf lib
- rm -f assets/static/js/*
docker-build:
DOCKER_BUILDKIT=1 docker build -t clog .
@@ -28,10 +27,6 @@ fetch-dependencies: clean
curl -L https://github.com/mity/md4c/archive/refs/tags/release-0.4.8.tar.gz -o lib/md4c-0.4.8.tar.gz
tar xf lib/md4c-0.4.8.tar.gz -C lib
mv lib/md4c-release-0.4.8 lib/md4c
- # mermaidjs
- curl -L https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js -o lib/mermaid.min.js
- mkdir -p assets/static/js
- cp lib/mermaid.min.js assets/static/js
run:
kodev run
diff --git a/assets/index_end.html b/assets/index_end.html
index 5c93d38..ba83da5 100644
--- a/assets/index_end.html
+++ b/assets/index_end.html
@@ -7,7 +7,7 @@
<hr class="hdiv">
-<script src="/static/js/mermaid.min.js"></script>
+<script src="https://cdn.jsdelivr.net/npm/mermaid@9.4.3/dist/mermaid.min.js"></script>
<script>
mermaid.initialize({theme: "dark"});
mermaid.init(undefined, ".language-mermaid");
diff --git a/src/queries.h b/src/queries.h
index 6230f41..2334874 100644
--- a/src/queries.h
+++ b/src/queries.h
@@ -1,48 +1,48 @@
-const char *q_select_html_post = \
+const char *q_select_html_post =
"SELECT id, title, created_at::DATE, body "
"FROM posts "
"WHERE id = $1;";
-const char *q_select_html_posts = \
+const char *q_select_html_posts =
"SELECT id, title, created_at::DATE, body "
"FROM posts "
"ORDER BY updated_at DESC;";
-const char *q_select_json_post = \
+const char *q_select_json_post =
"SELECT JSON_AGG(ROW_TO_JSON(row)) FROM ("
"SELECT id, title, body, created_at, updated_at "
"FROM posts "
"WHERE id = $1"
") row;";
-const char *q_select_json_posts = \
+const char *q_select_json_posts =
"SELECT JSON_AGG(ROW_TO_JSON(row)) FROM ("
"SELECT id, title, body, created_at, updated_at "
"FROM posts "
"ORDER BY updated_at DESC"
") row;";
-const char *q_insert_posts = \
+const char *q_insert_posts =
"INSERT INTO posts "
"(title, body) "
"VALUES "
"($1, $2) "
"RETURNING id;";
-const char *q_insert_posts_with_id = \
+const char *q_insert_posts_with_id =
"INSERT INTO posts "
"(id, title, body) "
"VALUES "
"($1, $2, $3) "
"RETURNING id;";
-const char *q_update_posts = \
+const char *q_update_posts =
"UPDATE posts "
"SET title = $1, body = $2, updated_at = NOW() "
"WHERE id = $3 "
"RETURNING id;";
-const char *q_delete_posts = \
+const char *q_delete_posts =
"DELETE "
"FROM posts "
"WHERE id = $1 "