More lax support for Table headers

The separation row can now be separated with spaces from the column
borders.
This commit is contained in:
Vicent Marti 2011-05-03 00:05:24 +03:00
parent e2a3063b6e
commit 35a580ffce

View file

@ -1755,20 +1755,34 @@ parse_table_header(struct buf *ob, struct render *rndr, char *data, size_t size,
under_end++;
for (col = 0; col < *columns && i < under_end; ++col) {
size_t dashes = 0;
while (i < under_end && (data[i] == ' ' || data[i] == '\t'))
i++;
if (data[i] == ':') {
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_L;
dashes++;
}
while (i < under_end && data[i] == '-')
i++;
while (i < under_end && data[i] == '-') {
i++; dashes++;
}
if (i < under_end && data[i] == ':') {
i++; (*column_data)[col] |= MKD_TABLE_ALIGN_R;
dashes++;
}
while (i < under_end && (data[i] == ' ' || data[i] == '\t'))
i++;
if (i < under_end && data[i] != '|')
break;
if (dashes < 3)
break;
i++;
}