From 3abc2a6754521a5dcbebddf20e12384a2969885b Mon Sep 17 00:00:00 2001 From: david parsons Date: Thu, 23 Aug 2012 21:02:58 -0700 Subject: [PATCH] Fix clipping of table captions where there are trailing spaces on the line --- generate.c | 2 +- markdown.c | 6 +++--- markdown.h | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/generate.c b/generate.c index 632acf5..f81681d 100644 --- a/generate.c +++ b/generate.c @@ -1535,7 +1535,7 @@ printtable(Paragraph *pp, MMIOT *f) Qstring("\n", f); if ( caption ) { Qstring("\n", f); } Qstring("\n", f); diff --git a/markdown.c b/markdown.c index f00eb0a..f348892 100644 --- a/markdown.c +++ b/markdown.c @@ -82,8 +82,8 @@ mkd_firstnonblank(Line *p) /* find the last nonblank character on the line */ -static int -lastnonblank(Line *p) +int +mkd_lastnonblank(Line *p) { int i; @@ -1175,7 +1175,7 @@ ___mkd_tablecaption(Line *pp) { return pp && S(pp->text) && (T(pp->text)[pp->dle] == '[') - && (T(pp->text)[lastnonblank(pp)] == ']'); + && (T(pp->text)[mkd_lastnonblank(pp)] == ']'); } diff --git a/markdown.h b/markdown.h index 775948a..2bc15c3 100644 --- a/markdown.h +++ b/markdown.h @@ -166,6 +166,7 @@ struct string_stream { extern int mkd_firstnonblank(Line *); +extern int mkd_lastnonblank(Line *); extern int mkd_compile(Document *, DWORD); extern int mkd_document(Document *, char **); extern int mkd_generatehtml(Document *, FILE *);
", f); - ___mkd_reparse(T(caption->text)+1, S(caption->text)-2, 0, f, 0); + ___mkd_reparse(T(caption->text)+1, mkd_lastnonblank(caption)-1, 0, f, 0); Qstring("