git-stats-html
Version:
Turn git-stats result into HTML output.
101 lines (95 loc) • 5.12 kB
HTML
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" href="https://bloggify.github.io/github-calendar/dist/github-calendar.css" type="text/css" media="screen" charset="utf-8">
<style>
<% theme.levels.forEach(function (c, i) { %>
rect[data-level='<%= i %>'] { fill: <%= c %> }
<% }) %>
rect[data-level='-1'] { display: none; }
<% if (process.argv.indexOf("--big") !== -1) { %>
.calendar {
width: <%= levels.length * 12.12 + 40 %>px;
}
svg.js-calendar-graph-svg {
width: 100% !important;
}
body {
overflow-x: auto;
padding: 10px;
}
.calendar-graph {
width: auto;
padding: 8px;
}
<% } %>
</style>
</head>
<body>
<div class="calendar">
<div class="mb-5 border border-gray-dark rounded-1 py-3">
<div class="js-calendar-graph is-graph-loading graph-canvas calendar-graph height-full">
<svg width="676" height="104" class="js-calendar-graph-svg">
<g transform="translate(16, 20)">
<% var DAY_X = 13; %>
<% var WEEK_X = 0; %>
<% var DAY_Y = 0; %>
<% levels.forEach(function (cWeek) { %>
<g transform="translate(<%= WEEK_X %>, 0)">
<% cWeek.forEach(function (cDayLevel) { %>
<rect class="day" width="10" height="10" x="<%= DAY_X %>" y="<%= DAY_Y %>" data-level="<%= cDayLevel.level %>" data-date="<%= cDayLevel.date %>"></rect>
<% DAY_Y += 12; %>
<% }) %>
<% DAY_Y = 0; %>
<% --DAY_X %>
<% WEEK_X += 13%>
</g>
<% }) %>
<% months.forEach(function (month) { %>
<text x="<%= month.left %>" y="-10" class="month"><%= month.name %></text>
<% }) %>
<text text-anchor="start" class="wday" dx="-14" dy="8" style="display: none;">Sun</text>
<text text-anchor="start" class="wday" dx="-14" dy="20">Mon</text>
<text text-anchor="start" class="wday" dx="-14" dy="32" style="display: none;">Tue</text>
<text text-anchor="start" class="wday" dx="-14" dy="44">Wed</text>
<text text-anchor="start" class="wday" dx="-14" dy="57" style="display: none;">Thu</text>
<text text-anchor="start" class="wday" dx="-14" dy="69">Fri</text>
<text text-anchor="start" class="wday" dx="-14" dy="81" style="display: none;">Sat</text>
</g>
</svg>
</div>
<div class="contrib-footer clearfix mt-1 mx-3 px-3 pb-1">
<div class="contrib-legend text-gray" title="A summary of pull requests, issues opened, and commits to the default and gh-pages branches.">
Less
<ul class="legend">
<% theme.levels.forEach(function (c, i) { %>
<li style="background-color: <%= c %>"></li>
<% }) %>
</ul>
More
</div>
</div>
</div>
<div class="contrib-column contrib-column-first table-column"><span class="text-muted">Contributions in the last year</span>
<span class="contrib-number"><%= total %> total</span>
<span class="text-muted"><%= start.format("LL") %> – <%= end.format("LL") %></span>
</div>
<div class="contrib-column table-column"><span class="text-muted">Longest streak</span>
<span class="contrib-number"><%= lStreak %> days</span>
<% if (lStreak !== 0) { %>
<%= longestStreak.start.format("LL") %> – <%= longestStreak.end.format("LL") %>
<% } %>
</div>
<div class="contrib-column table-column"><span class="text-muted">Current streak</span>
<span class="contrib-number"><%= cStreak %> days</span>
<span class="text-muted">
<% if (cStreak !== 0) { %>
<%= currentStreak.start.format("LL") %> – <%= currentStreak.end.format("LL") %>
<% } %>
</span>
</div>
</div>
</body>
</html>