Skip to content

Commit

Permalink
Backport Upskirt changes
Browse files Browse the repository at this point in the history
- More lax support for table headers
  • Loading branch information
vmg committed May 2, 2011
1 parent 16b0562 commit 37c80d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions ext/markdown.c
Expand Up @@ -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++;
}

Expand Down
2 changes: 1 addition & 1 deletion upskirt
Submodule upskirt updated from e2a306 to 35a580

0 comments on commit 37c80d3

Please sign in to comment.