md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit 2d2086aa05aeea49ec3706ccb0d3a3cce702a606
parent 4468c7aad755ca4f3d4a310adc0003878b87a5b3
Author: Martin Mitas <mity@morous.org>
Date:   Wed, 23 Nov 2016 11:20:25 +0100

md_is_table_underline: Check there is at least one pipe on the line.

Diffstat:
Mmd4c/md4c.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -4070,9 +4070,11 @@ static int md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count) { OFF off = beg; + int found_pipe = FALSE; unsigned col_count = 0; if(off < ctx->size && CH(off) == _T('|')) { + found_pipe = TRUE; off++; while(off < ctx->size && ISWHITESPACE(off)) off++; @@ -4100,6 +4102,7 @@ md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count) off++; if(off < ctx->size && CH(off) == _T('|')) { delimited = TRUE; + found_pipe = TRUE; off++; while(off < ctx->size && ISWHITESPACE(off)) off++; @@ -4113,6 +4116,9 @@ md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count) return FALSE; } + if(!found_pipe) + return FALSE; + *p_end = off; *p_col_count = col_count; return TRUE;