aboutsummaryrefslogtreecommitdiff
path: root/src/clog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/clog.c')
-rw-r--r--src/clog.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/clog.c b/src/clog.c
index 87129e5..80906d3 100644
--- a/src/clog.c
+++ b/src/clog.c
@@ -240,17 +240,29 @@ int post_entry_form(struct http_request *req) {
// continue;
// }
+ http_response_header(req, "content-type", "text/html; charset=utf-8");
+
+ kore_buf_append(resp_buf, asset_form_begin_html, asset_len_form_begin_html);
+
// Append rendered MD entry.
- kore_buf_appendf(
+ size_t len = 0;
+ char *str = NULL;
+ str = kore_buf_stringify(html_buf, &len);
+ kore_buf_append(
resp_buf,
- (const char *) asset_entry_html,
- id,
- title,
- "1981-12-23 06:02:00",
- kore_buf_stringify(html_buf, NULL)
+ str,
+ len
+ );
+
+ kore_buf_append(resp_buf, asset_form_end_html, asset_len_form_end_html);
+
+ http_response(
+ req,
+ HTTP_STATUS_OK,
+ resp_buf->data,
+ resp_buf->offset
);
- http_ok_resp(req, HTTP_STATUS_OK, resp_buf);
kore_buf_free(html_buf);
kore_buf_free(resp_buf);
@@ -692,7 +704,10 @@ static int render_md(const char *in, struct kore_buf *out) {
int err = 0;
static unsigned parser_flags = 0;
- static unsigned renderer_flags = MD_HTML_FLAG_DEBUG;
+ static unsigned renderer_flags = 0;
+
+ parser_flags |= MD_FLAG_TABLES;
+ // render_flags |= MD_HTML_FLAG_DEBUG;
err = md_html(
in,