xonecas.io
8356
Wx

www-xonecas-io / files

www-xonecas-io / internal / site / view.go

1.5 KB
1package site
2
3// The view types every page template renders. The data tickets fill them from git.
4
5// Element is a project drawn as a periodic-table tile.
6type Element struct {
7	Num, Weight int    // order of discovery, commit count
8	Sym, Name   string // symbol, project name
9	Group       string // fe, be, both or none: the tile colour
10	Post        bool   // post-AI projects get an outline
11}
12
13// ProjectRow is one project in a list.
14type ProjectRow struct {
15	El          Element
16	Desc, Lang  string
17	From, Width float64 // the active span, as percent of the whole timeline
18	Heat        int     // 0-6, from commit count
19	Tags        []string
20	First, Last string // dates of the first and last commit, for sorting
21	Months      string // every YYYY-MM with my commits, space-separated, for the date filter
22	Topics      []string
23}
24
25// TreeEntry is one file or folder in a file tree, with its last commit.
26type TreeEntry struct {
27	Dir                   bool
28	Name, Msg, Date, Href string
29}
30
31// Commit is one commit in a feed.
32type Commit struct {
33	El                            Element
34	Hash, Msg, Author, Date, Href string // Href is the commit page, "" for none
35}
36
37// DiffLine is one line of a unified diff. Op is "+", "-", " ", or "@" for a hunk header.
38type DiffLine struct {
39	Op       string
40	Old, New int // line numbers, 0 where the side has none
41	Text     string
42}
43
44// Diff is the change to one file.
45type Diff struct {
46	Path       string
47	Adds, Dels int
48	Lines      []DiffLine
49	Note       string // why lines are missing: a binary file, or a diff cut short
50}