diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-06-01 14:58:58 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-06-01 14:58:58 -0700 |
commit | 60bd289c18e06e199260ee374ef29e3017bc4a90 (patch) | |
tree | 0785dcf68fc575fbc5bb9a73b7872c2ccd4d1b5a | |
parent | be020e1928f2d0750573730483dd4cb40140935a (diff) |
renderer: no_linebreaks instead of no_wrap.
We generally want this option to prohibit any breaking
in things like headers (not just wraps, but softbreaks).
-rw-r--r-- | src/commonmark.c | 10 | ||||
-rw-r--r-- | src/render.c | 2 | ||||
-rw-r--r-- | src/render.h | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/commonmark.c b/src/commonmark.c index 9f971b2..42a5f19 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -258,9 +258,9 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, } LIT(" "); renderer->begin_content = true; - renderer->no_wrap = true; + renderer->no_linebreaks = true; } else { - renderer->no_wrap = false; + renderer->no_linebreaks = false; BLANKLINE(); } break; @@ -343,8 +343,10 @@ static int S_render_node(cmark_renderer *renderer, cmark_node *node, if (CMARK_OPT_HARDBREAKS & options) { LIT(" "); CR(); - } else if (renderer->width == 0 && !(CMARK_OPT_HARDBREAKS & options) && - !(CMARK_OPT_NOBREAKS & options)) { + } else if (!renderer->no_linebreaks && + renderer->width == 0 && + !(CMARK_OPT_HARDBREAKS & options) && + !(CMARK_OPT_NOBREAKS & options)) { CR(); } else { OUT(" ", allow_wrap, LITERAL); diff --git a/src/render.c b/src/render.c index 50f03e6..9e59fa3 100644 --- a/src/render.c +++ b/src/render.c @@ -28,7 +28,7 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, cmark_chunk remainder = cmark_chunk_literal(""); int k = renderer->buffer->size - 1; - wrap = wrap && !renderer->no_wrap; + wrap = wrap && !renderer->no_linebreaks; if (renderer->in_tight_list_item && renderer->need_cr > 1) { renderer->need_cr = 1; diff --git a/src/render.h b/src/render.h index 479936a..c3acf6b 100644 --- a/src/render.h +++ b/src/render.h @@ -20,7 +20,7 @@ struct cmark_renderer { bufsize_t last_breakable; bool begin_line; bool begin_content; - bool no_wrap; + bool no_linebreaks; bool in_tight_list_item; void (*outc)(struct cmark_renderer *, cmark_escaping, int32_t, unsigned char); void (*cr)(struct cmark_renderer *); |