Documentation
¶
Overview ¶
Package isocalendar owns the M4 "isocalendar" plugin. It reshapes the contributionsCollection.contributionCalendar payload (already fetched by base.runIndepth when isocalendar's input is enabled) into a week×day matrix and computes streaks.
Index ¶
Constants ¶
const Name = "isocalendar"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &isocalendarPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the isocalendar plugin. Output structure mirrors upstream org_repo/source/templates/classic/partials/isocalendar.ejs:
<section data-section="isocalendar" data-duration="...">
<section>
<h2 class="field"><svg cal/>Contributions calendar</h2>
<div class="row">
<section/> <!-- error path (empty) -->
<section> <!-- stats panel -->
<h3 class="field"><svg/>Commits streaks</h3>
<div class="field"><svg flame/>Current streak N day</div>
<div class="field"><svg/>Best streak N day</div>
<h3 class="field"><svg/>Commits per day</h3>
<div class="field"><svg/>Highest in a day at N</div>
<div class="field"><svg/>Average per day at ~A</div>
</section>
</div>
<svg class="isocalendar-grid" ...> <!-- 3D isometric heatmap -->
<g transform="scale(4) translate(12, 0)">
<g transform="translate(i*1.7, i)"> <!-- per week -->
<g transform="translate(j*-1.7, j+(1-ratio)*6)"> <!-- per day -->
<path d="M1.7,2 0,1 1.7,0 3.4,1 z"/> <!-- top diamond -->
<path filter="url(#brightness1)" d="..."/> <!-- left face -->
<path filter="url(#brightness2)" d="..."/> <!-- right face -->
</g>
</g>
</g>
</svg>
</section>
</section>
Settings: mjun0812 uses plugin_isocalendar: yes, plugin_isocalendar_duration: full-year.
Types ¶
type ISOWeek ¶
type ISOWeek struct {
FirstDay string `json:"firstDay"`
Days [7]int `json:"days"`
DayColors [7]string `json:"dayColors"`
}
ISOWeek holds 7 daily contribution counts for one ISO week.
Days[i] is the raw contribution count for weekday i (0 = Sunday). DayColors[i] is the GitHub heatmap color for the same day. Both arrays are aligned and always 7 entries (zero-filled when the week is partial at the start/end of the duration window).
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
Weeks []ISOWeek `json:"weeks"`
Streak Streak `json:"streak"`
Average float64 `json:"average"`
Sum int `json:"sum"`
Max int `json:"max"`
Duration string `json:"duration"`
}
Result is the JSON payload published under data.Plugins["isocalendar"].