From cf867034323b72a1fab1b516cc693667b92d875a Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Mon, 10 Mar 2025 15:42:31 -0400 Subject: figcaption at bottom, print none if no display text --- main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 267c56f..0d10fc6 100644 --- a/main.c +++ b/main.c @@ -164,7 +164,7 @@ LineType line_init(Line *l, Str txt, LineType t) { c = str_cut(str_trim(str_skip(txt, 2)), ' '); c.tail = str_trim(c.tail); l->url = c.head; - l->txt = c.tail.n > 0 ? c.tail : c.head; + l->txt = c.tail; return has_image_ext(l->url) ? LN_IMG : LN_LINK; case LN_HDR1: l->txt = str_trim(str_skip(txt, 1)); @@ -270,16 +270,17 @@ void str_cat_blk(Str *out, Block *blk, Arena *perm, Arena *scratch) { : str_replace_end(l->url, S(".gmi"), S(".html"), scratch), perm); - Ot(">", l->txt, "\n"); + Ot(">", l->txt.n > 0 ? l->txt : l->url, "\n"); } Os(""); break; case LN_IMG: for (Line *l = blk->lines; l; l = l->next) { - Os("
\n"); - Ot("
", l->txt, "
\n\n\n"); + Os(">\n"); + if (l->txt.n > 0) Ot("
", l->txt, "
\n"); + Os("
"); if (l->next) Os("\n"); } break; -- cgit 1.4.1-2-gfad0