From 65c47c033c1f2a069246727854d59b0f3483501b Mon Sep 17 00:00:00 2001 From: Xintong Xia Date: Mon, 28 Oct 2019 15:14:52 -0700 Subject: [PATCH 1/3] Fix the url to tile 3d layer example --- website/src/static/markdown/examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/static/markdown/examples.md b/website/src/static/markdown/examples.md index c5bf16e14de..26f2f07d7e5 100644 --- a/website/src/static/markdown/examples.md +++ b/website/src/static/markdown/examples.md @@ -94,7 +94,7 @@
From e3fafc70d925e2fbd5603942e1866bcf1108b49d Mon Sep 17 00:00:00 2001 From: Xintong Xia Date: Tue, 29 Oct 2019 08:31:24 -0700 Subject: [PATCH 2/3] Fix tree name generation --- website/contents/pages.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/website/contents/pages.js b/website/contents/pages.js index 90d5c707f20..970b1374c5f 100644 --- a/website/contents/pages.js +++ b/website/contents/pages.js @@ -19,9 +19,15 @@ function generatePath(tree, parentPath = '', depth = 0) { tree.depth = depth; if (tree.name) { + // pre-match GeoJson|3D|API|DeckGL|JSON + // use `#` to take up pre-matched' space + // then replace `#` with pre-match results + const matches = tree.name.match(/(GeoJson|3D|API|DeckGL|JSON)/g); tree.path = tree.name - .match(/(GeoJson|3D|API|DeckGL|JSON|[A-Z]*[a-z'0-9\.]+|\d+)/g) + .replace(/(GeoJson|3D|API|DeckGL|JSON)/g, '#') + .match(/(#|[A-Z]*[a-z'0-9\.]+|\d+)/g) .join('-') + .replace('#', _ => matches.shift()) .toLowerCase() .replace(/[^\w-]/g, ''); } From ab12ba8dad0863a8ff11fcadb3c549d1cc482851 Mon Sep 17 00:00:00 2001 From: Xintong Xia Date: Tue, 29 Oct 2019 10:27:51 -0700 Subject: [PATCH 3/3] Address comments --- website/contents/pages.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/contents/pages.js b/website/contents/pages.js index 970b1374c5f..5d6f68c48c1 100644 --- a/website/contents/pages.js +++ b/website/contents/pages.js @@ -1,3 +1,5 @@ +const PRE_MATCH_REGEX = /(GeoJson|3D|API|DeckGL|JSON)/g; + function getDocUrl(filename) { // DOCS_DIR specified in webpack config file // eslint-disable-next-line no-undef @@ -22,9 +24,9 @@ function generatePath(tree, parentPath = '', depth = 0) { // pre-match GeoJson|3D|API|DeckGL|JSON // use `#` to take up pre-matched' space // then replace `#` with pre-match results - const matches = tree.name.match(/(GeoJson|3D|API|DeckGL|JSON)/g); + const matches = tree.name.match(PRE_MATCH_REGEX); tree.path = tree.name - .replace(/(GeoJson|3D|API|DeckGL|JSON)/g, '#') + .replace(PRE_MATCH_REGEX, '#') .match(/(#|[A-Z]*[a-z'0-9\.]+|\d+)/g) .join('-') .replace('#', _ => matches.shift())