depp

No frills static page generator for Git repositories

git clone https://git.8pit.net/depp.git

 1package gitweb
 2
 3import (
 4	"html/template"
 5
 6	"github.com/go-git/go-git/v5"
 7)
 8
 9const (
10	// Name of the depp-specific Git configuration section.
11	confSec = "depp"
12)
13
14type Config struct {
15	HeaderExtra template.HTML
16}
17
18func loadConfig(repo *git.Repository) (Config, error) {
19	c, err := repo.Config()
20	if err != nil {
21		return Config{}, err
22	}
23
24	raw := c.Raw
25	if !raw.HasSection(confSec) {
26		return Config{}, nil
27	}
28
29	sec := raw.Section(confSec)
30	cnf := Config{
31		HeaderExtra: template.HTML(sec.Option("extra-head-content")),
32	}
33
34	return cnf, nil
35}