(href, articleRoot)
| 567 | } |
| 568 | |
| 569 | function resolveIndexMarkdownPath(href, articleRoot) { |
| 570 | articleRoot = articleRoot || 'ai-articles'; |
| 571 | |
| 572 | var cleanHref = (href || '').split('?')[0].split('#')[0].trim(); |
| 573 | |
| 574 | if (!cleanHref || /^(https?:|mailto:)/i.test(cleanHref)) { |
| 575 | return ''; |
| 576 | } |
| 577 | |
| 578 | if (cleanHref.indexOf('#/') === 0) { |
| 579 | return toMarkdownPath(cleanHref); |
| 580 | } |
| 581 | |
| 582 | if (cleanHref.indexOf('./') === 0) { |
| 583 | cleanHref = articleRoot + '/' + cleanHref.slice(2); |
| 584 | } else if (cleanHref.indexOf(articleRoot + '/') !== 0) { |
| 585 | cleanHref = articleRoot + '/' + cleanHref.replace(/^\/+/, ''); |
| 586 | } |
| 587 | |
| 588 | if (!/\.md$/i.test(cleanHref)) { |
| 589 | cleanHref += '.md'; |
| 590 | } |
| 591 | |
| 592 | return cleanHref.replace(/^\/+/, ''); |
| 593 | } |
| 594 | |
| 595 | function decorateHomePage(section) { |
| 596 | var latestArticles = collectHomeUpdateArticles(section).slice(0, 6); |
no test coverage detected