diff --git a/parser.leg b/parser.leg index c5156fe..25dbe78 100644 --- a/parser.leg +++ b/parser.leg @@ -194,7 +194,7 @@ BulletList = &Bullet (ListTight | ListLoose) { $$.key = BULLETLIST } ListTight = a:StartList - ( ListItem { a = cons($$, a) } )+ + ( ListItemTight { a = cons($$, a) } )+ BlankLine* !(Bullet | Enumerator | DefMarker) { $$ = mk_list(LIST, a) } @@ -218,6 +218,20 @@ ListItem = ( Bullet | Enumerator | DefMarker ) $$.children = raw } +ListItemTight = + ( Bullet | Enumerator | DefMarker ) + a:StartList + ListBlock { a = cons($$, a) } + ( !BlankLine + ListContinuationBlock { a = cons($$, a) } )* + !ListContinuationBlock + { + raw := mk_str_from_list(a, false) + raw.key = RAW + $$ = mk_element(LISTITEM) + $$.children = raw + } + ListBlock = a:StartList !BlankLine Line { a = cons($$, a) } ( ListBlockLine { a = cons($$, a) } )*