-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow spaces in variables (#1035)
[![PR App][icn]][demo] | Fix RM-XYZ :-------------------:|:----------: ## 🧰 Changes Allows spaces in user variables. Previous, the transformer was validating user variables with a regex that didn't allow spaces. This PR changes the regex to allow spaces. This also allows spaces in the variables names, which would have crashed the parser before. All of the following are now valid: ``` {user.name} { user.name } {user['dont do this']} ``` ## 🧬 QA & Testing - [Broken on production][prod]. - [Working in this PR app][demo]. [demo]: https://markdown-pr-PR_NUMBER.herokuapp.com [prod]: https://SUBDOMAIN.readme.io [icn]: https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg
- Loading branch information
1 parent
47aca89
commit 5733446
Showing
7 changed files
with
115 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello, { user['this is cursed'] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"children": [ | ||
{ | ||
"children": [ | ||
{ | ||
"position": { | ||
"end": { | ||
"column": 8, | ||
"line": 1, | ||
"offset": 7 | ||
}, | ||
"start": { | ||
"column": 1, | ||
"line": 1, | ||
"offset": 0 | ||
} | ||
}, | ||
"type": "text", | ||
"value": "Hello, " | ||
}, | ||
{ | ||
"data": { | ||
"hName": "Variable", | ||
"hProperties": { | ||
"name": "this is cursed" | ||
} | ||
}, | ||
"position": { | ||
"end": { | ||
"column": 19, | ||
"line": 1, | ||
"offset": 18 | ||
}, | ||
"start": { | ||
"column": 8, | ||
"line": 1, | ||
"offset": 7 | ||
} | ||
}, | ||
"type": "readme-variable", | ||
"value": "{ user['this is cursed'] }" | ||
} | ||
], | ||
"position": { | ||
"end": { | ||
"column": 19, | ||
"line": 1, | ||
"offset": 18 | ||
}, | ||
"start": { | ||
"column": 1, | ||
"line": 1, | ||
"offset": 0 | ||
} | ||
}, | ||
"type": "paragraph" | ||
} | ||
], | ||
"position": { | ||
"end": { | ||
"column": 1, | ||
"line": 2, | ||
"offset": 19 | ||
}, | ||
"start": { | ||
"column": 1, | ||
"line": 1, | ||
"offset": 0 | ||
} | ||
}, | ||
"type": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters