index.js 961 字节
Newer Older
D
DCloud_LXH 已提交
1 2 3 4
function isExternal(path) {
  return /^[a-z]+:/i.test(path)
}

D
DCloud_LXH 已提交
5 6 7 8 9 10 11 12 13 14 15 16
function simplifySlugText(text) {
  // 移除方法后面的括号及里面的内容
  if (text.match(/^uni/) && text.match(/\)$/)) {
    text = text.replace(/^uni/, '').replace(/\(.*\)$/, '');
  }
  // 处理部分非uni开头方法的括号内容,主要是会出现多参数的情况。
  if (text.match(/\([\w+\s+\[\],]+\)$/)) {
    text = text.replace(/\([\w+\s+\[\],]+\)$/, '');
  }
  return text;
}

D
DCloud_LXH 已提交
17 18 19 20 21 22
// 顺序有要求,会影响 for 循环匹配侧边栏
const tabs = [
  '/uni-app-x/compiler/', '/uni-app-x/dom/', '/uni-app-x/uts/', '/uni-app-x/collocation/', '/uni-app-x/plugin/', '/uni-app-x/worktile/', '/uni-app-x/component/', '/uni-app-x/api/', '/uni-app-x/css/', '/uni-app-x/',
  '/uniCloud/',
  '/plugin/', '/worktile/', '/tutorial/', '/collocation/', '/component/', '/api/', '/',
]
D
DCloud_LXH 已提交
23

D
DCloud_LXH 已提交
24
module.exports = {
D
DCloud_LXH 已提交
25
  isExternal,
D
DCloud_LXH 已提交
26
  simplifySlugText,
D
DCloud_LXH 已提交
27
  tabs: process.env.DOCS_LITE ? [] : tabs
D
DCloud_LXH 已提交
28
}