-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoc.go
More file actions
68 lines (56 loc) · 1.36 KB
/
Copy pathdoc.go
File metadata and controls
68 lines (56 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package cutedoc
import (
"gopkg.in/yaml.v2"
"io/ioutil"
)
// config represents the default name of the cutedoc config file.
const config = ".cutedoc.yml"
// Doc represents the current model of the documentation being created.
type Doc struct {
Build Build
Meta Meta
Theme Theme
Articles yaml.MapSlice
}
// Build represents options used during the build process.
type Build struct {
Dir string
Minify bool
}
// Meta holds metadata of the documentation.
type Meta struct {
Title string
Author string
Description string
Branding Branding
}
// Represents theme of the documentation.
type Theme struct {
Template string
Colors Colors
}
// Represents color scheme of the documentation.
type Colors struct {
Primary string
Secondary string
Text string
Nav string
Background string
}
// Branding holds the paths to the branding of the documentation.
type Branding struct {
Logo string
Icon string
}
// New reads the doc config in the current directory and creates a doc model based on it.
func New() (*Doc, error) {
bytes, err := ioutil.ReadFile(config)
if err != nil {
return nil, err
}
doc := &Doc{Build{"docs", true},
Meta{"Docs", "", "Documentation page.", Branding{}},
Theme{"minimal", Colors{"3e4669", "c3c6de", "3e4669", "fff", "f6f7fb"}},
yaml.MapSlice{}}
return doc, yaml.Unmarshal(bytes, doc)
}