Fix footnote parsing

Consecutive footnotes do not need to be surrounded by blank lines,
courtesy of @microjo. For example, this is now possible:

[^1]: footnote1
[^2]: footnote2
This commit is contained in:
Sami A 2013-09-19 15:26:46 -05:00 committed by Devin Torres
parent d3aaea3300
commit 71af174519

View file

@ -2459,13 +2459,6 @@ is_footnote(const uint8_t *data, size_t beg, size_t end, size_t *last, struct fo
i++;
if (i >= end || data[i] != ':') return 0;
i++;
while (i < end && data[i] == ' ') i++;
if (i < end && (data[i] == '\n' || data[i] == '\r')) {
i++;
if (i < end && data[i] == '\n' && data[i - 1] == '\r') i++;
}
while (i < end && data[i] == ' ') i++;
if (i >= end || data[i] == '\n' || data[i] == '\r') return 0;
/* getting content buffer */
contents = bufnew(64);
@ -2495,8 +2488,9 @@ is_footnote(const uint8_t *data, size_t beg, size_t end, size_t *last, struct fo
/* joining only indented stuff after empty lines;
* note that now we only require 1 space of indentation
* to continue, just like lists */
if (in_empty && ind == 0) {
break;
if (ind == 0) {
if (start == id_end + 2 && data[start] == '\t') {}
else break;
}
else if (in_empty) {
bufputc(contents, '\n');