|
2 | 2 | <div class="header header-detail"> |
3 | 3 | <%- partial('menu') %> |
4 | 4 | </div> |
| 5 | + |
| 6 | +<!-- 终端风页面头部:纯 HTML/CSS 装饰(grid 背景 + 辉光 + 扫描线),零图片素材 --> |
| 7 | +<div class="detail-hero"> |
| 8 | + <div class="detail-hero-scan" aria-hidden="true"></div> |
| 9 | + <div class="detail-hero-inner container"> |
| 10 | + <div class="detail-hero-cmd"><span class="detail-term-prompt" aria-hidden="true">$</span> ./whois <%- item.slug %></div> |
| 11 | + <div class="detail-hero-title" aria-hidden="true">> DEVELOPER PROFILE<span class="detail-hero-cursor"></span></div> |
| 12 | + <div class="detail-hero-meta"> |
| 13 | + <span class="hero-dot" aria-hidden="true"><span class="hero-dot-ping"></span><span class="hero-dot-core"></span></span> |
| 14 | + <span data-i18n-zh="码力榜开发者档案" data-i18n-en="HeroRank Developer Profile">码力榜开发者档案</span> |
| 15 | + </div> |
| 16 | + </div> |
| 17 | +</div> |
| 18 | + |
5 | 19 | <!-- 详情 --> |
6 | | -<div class="container pt-5 detail-content"> |
| 20 | +<div class="container detail-content"> |
7 | 21 | <div class="row justify-content-center"> |
8 | 22 | <div class="col-sm-12 col-md-8"> |
9 | 23 | <!-- 终端风 profile 卡片:$ ./whois <login> --> |
|
49 | 63 | <% } %> |
50 | 64 | </div> |
51 | 65 | </div> |
| 66 | + <!-- osgraph 嵌入已失效(对方证书过期),改为外链访问 --> |
| 67 | + <div class="detail-term-graphs"> |
| 68 | + <span class="detail-term-prompt" aria-hidden="true">$</span> |
| 69 | + <span class="detail-graphs-cmd">open ./graphs</span> |
| 70 | + <span class="detail-graphs-arrow" aria-hidden="true">-></span> |
| 71 | + <span class="detail-graphs-links"> |
| 72 | + <a class="detail-graph-link" href="https://osgraph.com/graphs/developer-activity/github/<%= item.slug %>?user-limit=10" target="_blank" rel="noopener" data-i18n-zh="开发活动" data-i18n-en="Developer Activity">开发活动</a> |
| 73 | + <a class="detail-graph-link" href="https://osgraph.com/graphs/os-partner/github/<%= item.slug %>?user-limit=10" target="_blank" rel="noopener" data-i18n-zh="开源伙伴" data-i18n-en="Open Source Partners">开源伙伴</a> |
| 74 | + <a class="detail-graph-link" href="https://osgraph.com/graphs/os-interest/github/<%= item.slug %>?repo-limit=5&topic-limit=3" target="_blank" rel="noopener" data-i18n-zh="开源兴趣" data-i18n-en="Open Source Interests">开源兴趣</a> |
| 75 | + </span> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + |
| 80 | + <div class="detail-divider" aria-hidden="true">---</div> |
| 81 | + |
| 82 | + <!-- GitHub Profile README:客户端拉取 <login>/<login> 仓库 README,失败整体隐藏 --> |
| 83 | + <div class="detail-term detail-readme" id="detailReadme" data-login="<%- item.slug %>" hidden> |
| 84 | + <div class="detail-term-bar"> |
| 85 | + <span class="detail-term-dots" aria-hidden="true"><i></i><i></i><i></i></span> |
| 86 | + <span class="detail-term-title">~/profile/README.md</span> |
| 87 | + </div> |
| 88 | + <div class="detail-term-body"> |
| 89 | + <div class="detail-term-cmd"><span class="detail-term-prompt" aria-hidden="true">$</span> cat ~/profile/README.md</div> |
| 90 | + <pre class="detail-readme-pre" id="detailReadmeContent"></pre> |
| 91 | + <div class="detail-readme-src"> |
| 92 | + <span class="detail-term-out" aria-hidden="true">></span> |
| 93 | + <span data-i18n-zh="来源" data-i18n-en="source">来源</span> |
| 94 | + <span class="detail-term-sep" aria-hidden="true">::</span> |
| 95 | + <a href="https://github.com/<%= item.slug %>/<%= item.slug %>" target="_blank" rel="noopener">github.com/<%- item.slug %>/<%- item.slug %></a> |
| 96 | + </div> |
52 | 97 | </div> |
53 | 98 | </div> |
54 | 99 |
|
55 | | - <div class="contribute mt-4 mt-sm-1"> |
56 | | - <%- item.content %> |
57 | | - <%- partial('osgraph', {slug: item.slug}) %> |
| 100 | + <% |
| 101 | + // 从 item.content 提取 github.com/owner/repo 链接,重构为终端风列表 |
| 102 | + // 仅认 <li> 列表项中的仓库链接;正文其余部分(简介、段落)原样保留 |
| 103 | + // 富内容页(图片 / 多级标题 / 表格等,如 huan)整体回退渲染原始 item.content |
| 104 | + const contentStr = item.content || ''; |
| 105 | + const isRichContent = /<(img|h2|h4|h5|h6|table|center|figure|video)\b/i.test(contentStr); |
| 106 | + const repoLinkRe = /href="https?:\/\/github\.com\/([A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)\/([A-Za-z0-9_.-]+?)\/?"/; |
| 107 | + const repos = []; |
| 108 | + let proseHtml = ''; |
| 109 | + if (!isRichContent) { |
| 110 | + const seenRepos = {}; |
| 111 | + const liRe = /<li>([\s\S]*?)<\/li>/g; |
| 112 | + let liMatch; |
| 113 | + while ((liMatch = liRe.exec(contentStr)) !== null) { |
| 114 | + const linkMatch = liMatch[1].match(repoLinkRe); |
| 115 | + if (!linkMatch) continue; |
| 116 | + const dedupeKey = (linkMatch[1] + '/' + linkMatch[2]).toLowerCase(); |
| 117 | + if (seenRepos[dedupeKey]) continue; |
| 118 | + seenRepos[dedupeKey] = true; |
| 119 | + // 列表项里链接之后的文字视为一句话简介(去标签、截断) |
| 120 | + let desc = liMatch[1] |
| 121 | + .replace(/<a [^>]*>[\s\S]*?<\/a>/, '') |
| 122 | + .replace(/<[^>]+>/g, '') |
| 123 | + .replace(/^[\s\-–—::]+/, '') |
| 124 | + .trim(); |
| 125 | + if (desc.length > 120) desc = desc.slice(0, 120).replace(/&[^;]*$/, '') + ' …'; |
| 126 | + repos.push({ owner: linkMatch[1], name: linkMatch[2], desc: desc }); |
| 127 | + } |
| 128 | + if (repos.length) { |
| 129 | + // 正文保留:去掉「主要贡献项目」标题与含仓库链接的列表,其余原样渲染 |
| 130 | + proseHtml = contentStr |
| 131 | + .replace(/<h3[^>]*>[\s\S]*?主要贡献项目[\s\S]*?<\/h3>/, '') |
| 132 | + .replace(/<ul[^>]*>[\s\S]*?<\/ul>/g, (ul) => repoLinkRe.test(ul) ? '' : ul) |
| 133 | + .trim(); |
| 134 | + } |
| 135 | + } |
| 136 | + %> |
| 137 | + <div class="contribute"> |
| 138 | + <% if (repos.length) { %> |
| 139 | + <% if (proseHtml) { %> |
| 140 | + <div class="contribute-prose"><%- proseHtml %></div> |
| 141 | + <% } %> |
| 142 | + <h2 class="detail-section-title" data-i18n-zh="主要贡献项目" data-i18n-en="Top Contributions">主要贡献项目</h2> |
| 143 | + <div class="detail-term detail-repos"> |
| 144 | + <div class="detail-term-bar"> |
| 145 | + <span class="detail-term-dots" aria-hidden="true"><i></i><i></i><i></i></span> |
| 146 | + <span class="detail-term-title">~/contributions</span> |
| 147 | + <span class="detail-repos-count"><%= repos.length %> <span data-i18n-zh="个仓库" data-i18n-en="repos">个仓库</span></span> |
| 148 | + </div> |
| 149 | + <div class="detail-term-body"> |
| 150 | + <div class="detail-term-cmd"><span class="detail-term-prompt" aria-hidden="true">$</span> ls -la ~/contributions</div> |
| 151 | + <ul class="detail-repos-list"> |
| 152 | + <% repos.forEach(({ owner, name, desc }) => { %> |
| 153 | + <li class="detail-repos-row"> |
| 154 | + <a href="https://github.com/<%= owner %>/<%= name %>" target="_blank" rel="noopener"> |
| 155 | + <span class="detail-repos-perm" aria-hidden="true">-rw-r--r--</span> |
| 156 | + <span class="detail-repos-main"> |
| 157 | + <span class="detail-repos-name"><%- owner %>/<%- name %></span> |
| 158 | + <% if (desc) { %> |
| 159 | + <span class="detail-repos-desc"><%- desc %></span> |
| 160 | + <% } %> |
| 161 | + </span> |
| 162 | + <span class="detail-repos-arrow" aria-hidden="true">-></span> |
| 163 | + </a> |
| 164 | + </li> |
| 165 | + <% }) %> |
| 166 | + </ul> |
| 167 | + </div> |
| 168 | + </div> |
| 169 | + <% } else if (contentStr.trim()) { %> |
| 170 | + <%- item.content %> |
| 171 | + <% } %> |
58 | 172 | </div> |
59 | 173 | </div> |
60 | 174 | </div> |
|
0 commit comments