Skip to content

Commit b62e2bb

Browse files
committed
frontmatter: fences are now limited to 255 dashes
See rust-lang/rust#149358
1 parent 47fac49 commit b62e2bb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/framework/testcases.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ pub const LONGLIST: &[&str] = [
14931493
"---\n---\nident",
14941494
"---\nfront matter\n---\nident",
14951495
"----\nfront matter\n----\nident",
1496-
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nfront matter\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nident",
1496+
"-----------------\nfront matter\n-----------------\nident",
14971497
"---\r\nfront matter\r\n---\r\nident",
14981498

14991499
// What follows the frontmatter
@@ -1577,6 +1577,11 @@ pub const LONGLIST: &[&str] = [
15771577
"----\n🦀---\n ---\nident", // #146847
15781578
"---🦀--- ---", // Minimal case of #146847
15791579

1580+
// Length limit
1581+
"--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nfront matter\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nident",
1582+
"---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nfront matter\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nident",
1583+
"----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nfront matter\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nident",
1584+
15801585
// What's before the frontmatter
15811586
"ident\n---\nfront matter\n---\nident",
15821587
"ident---\nfront matter\n---\nident",

src/reimplementation/cleaning/frontmatter.pest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ END_LINE = {
3030
( LF | EOI )
3131
}
3232

33-
FENCE = { "---" ~ "-" * }
33+
FENCE = { "-" {3, 255} }
3434

3535
INFOSTRING = {
3636
( XID_START | "_" ) ~

writeup/raw_strings.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ RDQ_255_CONTENT = {
106106
107107
```
108108

109-
This approach wouldn't help for frontmatter fences,
110-
which don't have a length limit.
111-
112109

113110
[rdql-token]: string_and_byte_literal_tokens.html#rdql
114111
[pest-stack]: https://docs.rs/pest/2.8.0/pest/#special-rules

0 commit comments

Comments
 (0)