(listItem)
| 652 | } |
| 653 | |
| 654 | function toHomeUpdateItem(listItem) { |
| 655 | if (!listItem || listItem.tagName !== 'LI') { |
| 656 | return null; |
| 657 | } |
| 658 | |
| 659 | var link = listItem.querySelector('a[href]'); |
| 660 | |
| 661 | if (!link) { |
| 662 | return null; |
| 663 | } |
| 664 | |
| 665 | var markdownPath = toMarkdownPath(link.getAttribute('href') || ''); |
| 666 | |
| 667 | if (!markdownPath || !isArticleMarkdown(markdownPath)) { |
| 668 | return null; |
| 669 | } |
| 670 | |
| 671 | var rawText = listItem.textContent.replace(/\s+/g, ' ').trim(); |
| 672 | var dateMatch = rawText.match(/^(\d{4}-\d{2}-\d{2})\s*(?:[·-])\s*/); |
| 673 | |
| 674 | return { |
| 675 | date: dateMatch ? dateMatch[1] : '', |
| 676 | href: toRouteHref(markdownPath), |
| 677 | markdownPath: markdownPath, |
| 678 | summary: dateMatch ? dateMatch[1] : '', |
| 679 | title: link.textContent.trim() |
| 680 | }; |
| 681 | } |
| 682 | |
| 683 | function renderFeaturedCards(list, latestArticles) { |
| 684 | if (latestArticles && latestArticles.length) { |
nothing calls this directly
no test coverage detected