summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'format.c')
-rw-r--r--format.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/format.c b/format.c
index 7b18909..e3f20c2 100644
--- a/format.c
+++ b/format.c
@@ -278,6 +278,7 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag
278 xs_str *s = xs_str_new(NULL); 278 xs_str *s = xs_str_new(NULL);
279 int in_pre = 0; 279 int in_pre = 0;
280 int in_blq = 0; 280 int in_blq = 0;
281 int in_ul = 0;
281 xs *list; 282 xs *list;
282 char *p; 283 char *p;
283 const char *v; 284 const char *v;
@@ -361,11 +362,30 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag
361 continue; 362 continue;
362 } 363 }
363 364
365 if (xs_startswith(ss, "* ") || xs_startswith(ss, "- ")) {
366 /* unsorted list */
367 ss = xs_strip_i(xs_crop_i(ss, 1, 0));
368
369 if (!in_ul) {
370 s = xs_str_cat(s, "<ul>");
371 in_ul = 1;
372 }
373
374 s = xs_str_cat(s, "<li>", ss);
375
376 continue;
377 }
378
364 if (in_blq) { 379 if (in_blq) {
365 s = xs_str_cat(s, "</blockquote>"); 380 s = xs_str_cat(s, "</blockquote>");
366 in_blq = 0; 381 in_blq = 0;
367 } 382 }
368 383
384 if (in_ul) {
385 s = xs_str_cat(s, "</ul>");
386 in_ul = 0;
387 }
388
369 s = xs_str_cat(s, ss); 389 s = xs_str_cat(s, ss);
370 s = xs_str_cat(s, "<br>"); 390 s = xs_str_cat(s, "<br>");
371 } 391 }
@@ -379,6 +399,7 @@ xs_str *not_really_markdown(const char *content, xs_list **attach, xs_list **tag
379 s = xs_replace_i(s, "<br><br><blockquote>", "<br><blockquote>"); 399 s = xs_replace_i(s, "<br><br><blockquote>", "<br><blockquote>");
380 s = xs_replace_i(s, "</blockquote><br>", "</blockquote>"); 400 s = xs_replace_i(s, "</blockquote><br>", "</blockquote>");
381 s = xs_replace_i(s, "</pre><br>", "</pre>"); 401 s = xs_replace_i(s, "</pre><br>", "</pre>");
402 s = xs_replace_i(s, "</ul><br>", "</ul>");
382 s = xs_replace_i(s, "</h2><br>", "</h2>"); //anzu ??? 403 s = xs_replace_i(s, "</h2><br>", "</h2>"); //anzu ???
383 s = xs_replace_i(s, "</h3><br>", "</h3>"); //anzu ??? 404 s = xs_replace_i(s, "</h3><br>", "</h3>"); //anzu ???
384 405