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

Function toArticleItem

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

Source from the content-addressed store, hash-verified

831 }
832
833 function toArticleItem(listItem) {
834 var link = listItem.querySelector('a[href]');
835
836 if (!link) {
837 return null;
838 }
839
840 var href = link.getAttribute('href') || '';
841 var markdownPath = toMarkdownPath(href);
842
843 if (!markdownPath || !isArticleMarkdown(markdownPath)) {
844 return null;
845 }
846
847 var rawText = listItem.textContent.replace(/\s+/g, ' ').trim();
848 var dateMatch = rawText.match(/^(\d{4}-\d{2}-\d{2})\s*-\s*/);
849
850 return {
851 date: dateMatch ? dateMatch[1] : '',
852 href: toRouteHref(markdownPath),
853 item: listItem,
854 markdownPath: markdownPath,
855 title: link.textContent.trim()
856 };
857 }
858
859 function renderCard(article) {
860 var item = article.item;

Callers

nothing calls this directly

Calls 3

toMarkdownPathFunction · 0.85
isArticleMarkdownFunction · 0.85
toRouteHrefFunction · 0.85

Tested by

no test coverage detected