Fix clipping of table captions where there are trailing spaces on the line

This commit is contained in:
david parsons
2012-08-23 21:02:58 -07:00
parent ff86dcfbf6
commit 3abc2a6754
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -1535,7 +1535,7 @@ printtable(Paragraph *pp, MMIOT *f)
Qstring("<table>\n", f);
if ( caption ) {
Qstring("<caption>", 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("</caption>\n", f);
}
Qstring("<thead>\n", f);
+3 -3
View File
@@ -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)] == ']');
}
+1
View File
@@ -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 *);