(route, locale)
| 352 | } |
| 353 | |
| 354 | function getActiveSidebarHref(route, locale) { |
| 355 | var normalizedRoute = normalizeRoute(route); |
| 356 | |
| 357 | if (normalizedRoute === '' || normalizedRoute === '/' || normalizedRoute === 'README') { |
| 358 | return normalizeHashHref('#/'); |
| 359 | } |
| 360 | |
| 361 | if (normalizedRoute === 'README.zh-CN') { |
| 362 | return normalizeHashHref('#/README.zh-CN'); |
| 363 | } |
| 364 | |
| 365 | if (!/\/README$/.test(normalizedRoute) && normalizedRoute.indexOf('/') > -1) { |
| 366 | normalizedRoute = normalizedRoute.replace(/\/[^/]+$/, '/README'); |
| 367 | } |
| 368 | |
| 369 | if (locale === 'zh' && normalizedRoute.indexOf('en/') === 0) { |
| 370 | normalizedRoute = normalizedRoute.replace(/^en\//, ''); |
| 371 | } |
| 372 | |
| 373 | return normalizeHashHref('#/' + normalizedRoute); |
| 374 | } |
| 375 | |
| 376 | function normalizeHashHref(href) { |
| 377 | var cleanHref = (href || '').trim(); |
no test coverage detected