mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Fix issue in regex for underscored CSS imports (#3728)
* Use lazy quantifier in UNDERSCORED_CSS_IMPORTS regex * Add test
This commit is contained in:
parent
c35237c94d
commit
3acca96ed8
1 changed files with 11 additions and 2 deletions
|
@ -186,7 +186,7 @@ static UNDERSCORED_CSS_IMPORTS: LazyLock<Regex> = LazyLock::new(|| {
|
||||||
| # or
|
| # or
|
||||||
'(_[^']+)' # single quoted
|
'(_[^']+)' # single quoted
|
||||||
| # or
|
| # or
|
||||||
(_.+) # unquoted filename
|
(_.+?) # unquoted filename
|
||||||
\s*\))
|
\s*\))
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
|
@ -649,8 +649,17 @@ mod test {
|
||||||
"URL(\"_bar.css\")\n",
|
"URL(\"_bar.css\")\n",
|
||||||
"@import url('_baz.css')\n",
|
"@import url('_baz.css')\n",
|
||||||
"url('nope.css')\n",
|
"url('nope.css')\n",
|
||||||
|
"url(_foo.woff2) format('woff2')",
|
||||||
)),
|
)),
|
||||||
vec!["_foo.css", "_bar.css", "_baz.css", "_foo.css", "_bar.css", "_baz.css",]
|
vec![
|
||||||
|
"_foo.css",
|
||||||
|
"_bar.css",
|
||||||
|
"_baz.css",
|
||||||
|
"_foo.css",
|
||||||
|
"_bar.css",
|
||||||
|
"_baz.css",
|
||||||
|
"_foo.woff2"
|
||||||
|
]
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
extract_underscored_references(concat!(
|
extract_underscored_references(concat!(
|
||||||
|
|
Loading…
Reference in a new issue