-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignore / if the delimiter is something else (#1850)
* ignore / if the delimiter is something else (note: I don't think this is the correct fix! But at least it gives a unit test) closes #1849 * avoid string.replaceAll * add delimiter test * \/ needs three (six) backslashes! * pass tests, but still not complete * proper escape/unescape * refactor logic * lift delimiter code * tweak error message * refactor logic slightly --------- Co-authored-by: Mike Bostock <[email protected]>
- Loading branch information
Showing
5 changed files
with
268 additions
and
9 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,50 @@ | ||
import * as Plot from "@observablehq/plot"; | ||
|
||
export async function treeDelimiter() { | ||
return Plot.plot({ | ||
axis: null, | ||
height: 150, | ||
margin: 10, | ||
marginLeft: 40, | ||
marginRight: 190, | ||
marks: [ | ||
Plot.tree( | ||
[ | ||
"foo;a;//example", // foo → a → //example | ||
"foo;a;//example/1", // foo → a → //example/1 | ||
"foo;b;//example/2", // foo → b → //example/2 | ||
"foo;c\\;c;//example2", // foo → c;c → //example2 | ||
"foo;d\\\\;d;//example2", // foo → d\ → d → //example3 | ||
"foo;d\\\\;\\d;//example2", // foo → d\ → \d → //example3 | ||
"foo;e\\\\\\;e;//example2", // foo → e\;e → //example3 | ||
"foo;f/f;//example4", // foo → f/f → //example4 | ||
"foo;g\\/g;//example3" // foo → g\/g → //example3 | ||
], | ||
{delimiter: ";"} | ||
) | ||
] | ||
}); | ||
} | ||
|
||
export async function treeDelimiter2() { | ||
return Plot.plot({ | ||
axis: null, | ||
height: 150, | ||
margin: 10, | ||
marginLeft: 40, | ||
marginRight: 190, | ||
marks: [ | ||
Plot.tree([ | ||
"foo/a/\\/\\/example", // foo → a → //example | ||
"foo/a/\\/\\/example\\/1", // foo → a → //example/1 | ||
"foo/b/\\/\\/example\\/2", // foo → b → //example/2 | ||
"foo/c;c/\\/\\/example2", // foo → c;c → //example2 | ||
"foo/d\\\\/d/\\/\\/example2", // foo → d\ → d → //example3 | ||
"foo/d\\\\/\\d/\\/\\/example2", // foo → d\ → \d → //example3 | ||
"foo/e\\\\;e/\\/\\/example2", // foo → e\;e → //example3 | ||
"foo/f\\/f/\\/\\/example4", // foo → f/f → //example4 | ||
"foo/g\\\\\\/g/\\/\\/example3" // foo → g\/g → //example3 | ||
]) | ||
] | ||
}); | ||
} |