Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia committed Oct 29, 2019
1 parent e3fafc7 commit ab12ba8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions website/contents/pages.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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())
Expand Down

0 comments on commit ab12ba8

Please sign in to comment.