Add support for fonts

This commit is contained in:
lowlighter
2020-10-25 00:19:57 +02:00
parent cdbb0e5b87
commit a4e15807ad
11 changed files with 116 additions and 48 deletions

View File

@@ -1,23 +1,23 @@
<svg xmlns="http://www.w3.org/2000/svg" width="480" height="<%= 48
+ (!!base.header)*64
+ (!!base.metadata)*122
+ (!!base.activity)*146
+ (!!base.community)*120
+ (!!base.repositories)*188
+ (Object.entries(base).filter(([key, value]) => value).length)*8
+ (!!computed.plugins.traffic)*18
+ (!!computed.plugins.followup)*112
+ (!!computed.plugins.lines)*36
+ ((!!computed.plugins.traffic)+(!!computed.plugins.followup)+(!!computed.plugins.lines))*4
+ (!!computed.plugins.pagespeed)*132
+ (!!computed.plugins.languages)*172
+ (Object.entries(computed.plugins).filter(([key, value]) => value).length)*4
+ (!!base.header)*62
+ (!!base.metadata)*108
+ (!!base.activity)*108
+ (!!base.community)*94
+ (!!base.repositories)*142
+ ((!!base.repositories)*(!!computed.plugins.traffic))*18
+ ((!!base.repositories)*(!!computed.plugins.followup))*102
+ ((!!base.repositories)*(!!computed.plugins.lines))*34
+ (!!computed.plugins.pagespeed)*110
+ (!!computed.plugins.languages)*124
+ Math.max(0, (((!!base.metadata)+(!!base.header)+((!!base.activity)||(!!base.community))+(!!base.repositories)+(!!computed.plugins.pagespeed)+(!!computed.plugins.languages))-1))*20
%>">
<%
meta.$ = `<span class="ps1-path">${user.login}@metrics</span>:<span class="ps1-location">~</span>${computed.token.scopes.includes("repo") ? "#" : "$"}`
meta.animations = !meta.placeholder ? {stdin:.16, stdout:.28, length:(2+Object.keys(base).length+Object.keys(computed.plugins).length)} : {stdin:0, stdout:0, length:0}
%>
<defs><style><%= fonts %></style></defs>
<style>
<%= style %>
.stdin, .stdout {
@@ -57,8 +57,7 @@
<% if (base.metadata) { %>
<div class="banner"><%# -%>
GitHub metrics generator <%= meta.version %>
These generated metrics comes with ABSOLUTELY NO WARRANTY,
to the extent permitted by applicable law.
These generated metrics comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
Last generated: <%= new Date().toGMTString() %>
</div><% } -%>
@@ -66,8 +65,9 @@ Last generated: <%= new Date().toGMTString() %>
<% if (base.header) { %>
<div class="stdin"><%- meta.$ %> whoami</div><%# -%>
<div class="stdout"><%# -%>
<b><%= user.name || user.login %></b> registered=<%= computed.registration.match(/^.+? [ym]/)[0].replace(/ /g, "") %>, uid=<%= `${user.databaseId}`.substr(-4) %>, gid=<%= user.organizations.totalCount %>, followers=<%= user.followers.totalCount %>
<b><%= user.name || user.login %></b> registered=<%= computed.registration.match(/^.+? [ym]/)[0].replace(/ /g, "") %>, uid=<%= `${user.databaseId}`.substr(-4) %>, gid=<%= user.organizations.totalCount %>
contributed to <%= user.repositoriesContributedTo.totalCount %> repositor<%= s(user.repositoriesContributedTo.totalCount, "y") %> <b><% for (const [x, {color}] of Object.entries(computed.calendar)) { -%><span style="color:<%= color %>">#</span><% } %></b>
followed by <b><%= user.followers.totalCount %></b> user<%= s(user.followers.totalCount) %>
</div><% } -%>
<%# ============================================================= -%>
<% if ((base.activity)||(base.community)) { %>
@@ -152,7 +152,7 @@ dr-x LICENSE
<%# ============================================================= -%>
<% if (base.metadata) { -%>
<footer>Connection reset by 127.0.0.1</footer><%# -%>
<footer>Connection reset by <%= Math.floor(256*Math.random()) %>.<%= Math.floor(256*Math.random()) %>.<%= Math.floor(256*Math.random()) %>.<%= Math.floor(256*Math.random()) %></footer><%# -%>
<% } -%></pre>
</div>

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB