in website/src/contents/pages.js [43:72]
function generatePath(cachKey, tree, getDocUrl, parentPath = '', depth = 0) {
if (Array.isArray(tree)) {
tree.forEach(branch => generatePath(cachKey, branch, getDocUrl, parentPath, depth));
return tree;
}
tree.root = cachKey;
tree.depth = depth;
if (tree.name) {
tree.path = tree.name
.match(/(GeoJson|3D|API|JSON|XVIZ|UI|FAQ|[A-Z]?[a-z'0-9\.]+|\d+)/g)
.join('-')
.toLowerCase()
.replace(/[^\w-]/g, '');
}
if (tree.children) {
generatePath(cachKey, tree.children, getDocUrl, `${parentPath}/${tree.path}`, depth + 1);
}
if (typeof tree.markdown === 'string') {
tree.markdown = getDocUrl(tree.markdown);
const i = tree.markdown.indexOf('docs/');
if (i >= 0) {
markdownFiles[`${cachKey}-${tree.markdown.slice(i)}`] = `${cachKey}${parentPath}/${
tree.path
}`;
}
}
return tree;
}