Skip to content

Commit 17a6992

Browse files
committed
document: Move list typechecking logic to right location (fixes vmg#102)
1 parent 646c8de commit 17a6992

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/document.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -1837,21 +1837,21 @@ parse_listitem(hoedown_buffer *ob, hoedown_document *doc, uint8_t *data, size_t
18371837
has_next_oli = prefix_oli(data + beg + i, end - beg - i);
18381838
}
18391839

1840-
/* checking for ul/ol switch */
1841-
if (in_empty && (
1842-
((*flags & HOEDOWN_LIST_ORDERED) && has_next_uli) ||
1843-
(!(*flags & HOEDOWN_LIST_ORDERED) && has_next_oli))){
1844-
*flags |= HOEDOWN_LI_END;
1845-
break; /* the following item must have same list type */
1846-
}
1847-
18481840
/* checking for a new item */
18491841
if ((has_next_uli && !is_hrule(data + beg + i, end - beg - i)) || has_next_oli) {
18501842
if (in_empty)
18511843
has_inside_empty = 1;
18521844

1853-
if (pre <= orgpre) /* the following item must have */
1854-
break; /* the same (or less) indentation */
1845+
/* the following item must have the same (or less) indentation */
1846+
if (pre <= orgpre) {
1847+
/* if the following item has different list type, we end this list */
1848+
if (in_empty && (
1849+
((*flags & HOEDOWN_LIST_ORDERED) && has_next_uli) ||
1850+
(!(*flags & HOEDOWN_LIST_ORDERED) && has_next_oli)))
1851+
*flags |= HOEDOWN_LI_END;
1852+
1853+
break;
1854+
}
18551855

18561856
if (!sublist)
18571857
sublist = work->size;

0 commit comments

Comments
 (0)