diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-11-04 10:17:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-04 10:17:49 +0100 |
| commit | cb1aad3a0cc862c5ff57a557e196ba49a02917de (patch) | |
| tree | 80cd62cbeb0f8d2bb999cc984d213f42293ebd24 /tests/suite/model | |
| parent | 6b636167ef2e84c761777261ce1ca3087a75f765 (diff) | |
| parent | 2c9728f53b318a6cae092f30ad0956a536af7ccb (diff) | |
Refactor Parser (#5310)
Diffstat (limited to 'tests/suite/model')
| -rw-r--r-- | tests/suite/model/heading.typ | 17 | ||||
| -rw-r--r-- | tests/suite/model/list.typ | 45 |
2 files changed, 54 insertions, 8 deletions
diff --git a/tests/suite/model/heading.typ b/tests/suite/model/heading.typ index 884f203d..d182724c 100644 --- a/tests/suite/model/heading.typ +++ b/tests/suite/model/heading.typ @@ -38,7 +38,7 @@ multiline. --- heading-trailing-whitespace --- // Whether headings contain trailing whitespace with or without comments/labels. // Labels are special cased to immediately end headings in the parser, but also -// have unique whitespace behavior. +// #strike[have unique whitespace behavior] Now their behavior is consistent! #let join(..xs) = xs.pos().join() #let head(h) = heading(depth: 1, h) @@ -49,19 +49,20 @@ multiline. #test(head[h], [= h<a>]) #test(head[h], [= h/**/<b>]) -// Label behaves differently than normal trailing space and comment. -#test(head(join[h][ ]), [= h ]) -#test(head(join[h][ ]), [= h /**/]) +// #strike[Label behaves differently than normal trailing space and comment.] +// Now they behave the same! +#test(join(head[h])[ ], [= h ]) +#test(join(head[h])[ ], [= h /**/]) #test(join(head[h])[ ], [= h <c>]) // Combinations. -#test(head(join[h][ ][ ]), [= h /**/ ]) +#test(join(head[h])[ ][ ], [= h /**/ ]) #test(join(head[h])[ ][ ], [= h <d> ]) -#test(head(join[h][ ]), [= h /**/<e>]) +#test(join(head[h])[ ], [= h /**/<e>]) #test(join(head[h])[ ], [= h/**/ <f>]) -// The first space attaches, but not the second -#test(join(head(join[h][ ]))[ ], [= h /**/ <g>]) +// #strike[The first space attaches, but not the second] Now neither attaches! +#test(join(head(join[h]))[ ][ ], [= h /**/ <g>]) --- heading-leading-whitespace --- // Test that leading whitespace and comments don't matter. diff --git a/tests/suite/model/list.typ b/tests/suite/model/list.typ index 46f4621f..c3c123de 100644 --- a/tests/suite/model/list.typ +++ b/tests/suite/model/list.typ @@ -34,6 +34,51 @@ _Shopping list_ - C - D +--- list-indent-trivia-nesting --- +// Test indent nesting behavior with odd trivia (comments and spaces). + +#let indented = [ +- a + /**/- b +/**/ - c + /*spanning + multiple + lines */ - d + - e +/**/ - f +/**/ - g +] +// Current behavior is that list columns are based on the first non-whitespace +// element in their line, so the block comments here determine the column the +// list starts at + +#let item = list.item +#let manual = { + [ ] + item({ + [a] + [ ] + item[b] + [ ]; [ ] + item({ + [c] + [ ]; [ ] + item[d] + }) + [ ] + item({ + [e] + [ ]; [ ] + item[f] + [ ]; [ ] + item[g] + }) + }) + [ ] +} + +#test(indented, manual) + --- list-tabs --- // This works because tabs are used consistently. - A with 1 tab |
