aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/entry_edit.html17
-rw-r--r--src/clog.c16
2 files changed, 17 insertions, 16 deletions
diff --git a/assets/entry_edit.html b/assets/entry_edit.html
index bc2a5e4..492735a 100644
--- a/assets/entry_edit.html
+++ b/assets/entry_edit.html
@@ -1,12 +1,9 @@
<form action="/form" method="post">
-<dl>
-<dt><h3>id</h3></dt>
-<dd><input type="text" id="id" name="id" value="%s"></input></dd>
-<dt><h3>title</h3></dt>
-<dd><input type="text" id="title" name="title" value="%s"></input></dd>
-<dt><h3>body</h3></dt>
-<dd><textarea id="body" name="body" rows="50" cols="100">%s</textarea></dd>
-<dd><input type="submit" value="Preview"></dd>
-<dd><input type="submit" value="Save (N/A)"></dd>
-</dl>
+<input type="text" id="id" name="id" value="%s" placeholder="uuid"/>
+<input type="text" id="title" name="title" value="%s" placeholder="title"/>
+<textarea id="body" name="body" rows="50" cols="100">%s</textarea>
+<br>
+<input type="submit" value="Preview">
+<input type="submit" value="Save (N/A)">
</form>
+
diff --git a/src/clog.c b/src/clog.c
index 24e08d0..2705558 100644
--- a/src/clog.c
+++ b/src/clog.c
@@ -184,7 +184,9 @@ int get_entry_form(struct http_request *req) {
int post_entry_form(struct http_request *req) {
- struct kore_buf *resp_buf = kore_buf_alloc(0);
+ int err = 0;
+
+ struct kore_buf *resp_buf = NULL;
char *id = NULL;
char *title = NULL;
@@ -204,6 +206,8 @@ int post_entry_form(struct http_request *req) {
kore_log(LOG_INFO, "form body %s.", body);
}
+ resp_buf = kore_buf_alloc(0);
+
// Append form.
kore_buf_appendf(
resp_buf, (const char *) asset_entry_edit_html,
@@ -211,11 +215,11 @@ int post_entry_form(struct http_request *req) {
);
// Render MD.
- (void) render_md(body, resp_buf);
- // if (err == KORE_RESULT_ERROR) {
- // kore_log(LOG_ERR, "Error rendering markdown for entry %s.", id);
- // continue;
- // }
+ err = render_md(body, resp_buf);
+ if (err == KORE_RESULT_ERROR) {
+ kore_buf_append(resp_buf, "Error rendering markdown.", 25);
+ kore_log(LOG_ERR, "Error rendering markdown.");
+ }
http_ok_resp(req, HTTP_STATUS_OK, resp_buf);