nihdoc

WIP markup parser (txt -> html)
git clone git://git.alexkarle.com.com/blag
Log | Files | Refs | README | LICENSE

commit 262f0252386c62ef7fe27f0cf52f39b5b198adde (patch)
parent c1f15729f4502e5f6179266b508f02ac3e3b301e
Author: Alex Karle <alex@alexkarle.com>
Date:   Thu, 23 Dec 2021 21:23:17 -0500

refactor: Move CODE/link check into fmt_disabled

This just reads better.

Diffstat:
Mblag.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blag.c b/blag.c @@ -117,7 +117,7 @@ void handle_lf(state *s) { bool fmt_disabled(state *s) { /* `` blocks disable all but the next `, likewise CODE makes all disabled */ - if (s->in == CODE) { + if (s->in == CODE || s->in_link == URL_PARSE) { return true; } else { return s->fmts['`'] && s->c != '`'; @@ -125,7 +125,7 @@ bool fmt_disabled(state *s) { } void toggle_format(state *s) { - if (!fmt_disabled(s) && s->in_link != URL_PARSE && s->in != CODE) { + if (!fmt_disabled(s)) { maybe_startp(s); printf("<%s%s>", s->fmts[s->c] ? "/" : "", FMT_STRS[s->c]); s->fmts[s->c] ^= true;