MCPcopy Create free account
hub / github.com/crisxuan/bestJavaer / toHomeUpdateItem

Function toHomeUpdateItem

assets/article-cards.js:654–681  ·  view source on GitHub ↗
(listItem)

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 3

toMarkdownPathFunction · 0.85
isArticleMarkdownFunction · 0.85
toRouteHrefFunction · 0.85

Tested by

no test coverage detected