mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-04 01:09:20 +02:00
refactor: enforce named capture groups; clean up regexes (#6524)
* refactor: enforce named capture groups; clean up regexes * fixes * fix
This commit is contained in:
parent
c56e6194b4
commit
1cefb643dd
32 changed files with 80 additions and 77 deletions
|
@ -59,7 +59,7 @@ export function shouldQuotifyFrontMatter([key, value]: [
|
|||
if (key === 'tags') {
|
||||
return false;
|
||||
}
|
||||
if (String(value).match(/^("|').+("|')$/)) {
|
||||
if (String(value).match(/^(?<quote>["']).+\1$/)) {
|
||||
return false;
|
||||
}
|
||||
// title: !something needs quotes because otherwise it's a YAML tag.
|
||||
|
@ -69,6 +69,6 @@ export function shouldQuotifyFrontMatter([key, value]: [
|
|||
// TODO this is not ideal to have to maintain such a list of allowed chars
|
||||
// maybe we should quotify if gray-matter throws instead?
|
||||
return !String(value).match(
|
||||
/^([\w .\-sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+_?'`&#()[\]§%€$])+$/,
|
||||
/^[\w .\-sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+_?'`&#()[\]§%€$]+$/,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue