+11
-4
atom/feed.go
+11
-4
atom/feed.go
···
61
61
}
62
62
rfc3339 := date.Format(time.RFC3339)
63
63
64
+
var summaryContent string
65
+
if subtitle, ok := p.Meta["subtitle"]; ok {
66
+
summaryContent = fmt.Sprintf("<h2>%s</h2>\n%s",
67
+
subtitle.(string),
68
+
string(p.Body))
69
+
} else {
70
+
summaryContent = string(p.Body)
71
+
}
72
+
64
73
entry := AtomEntry{
65
74
Title: p.Meta["title"].(string),
66
75
Updated: rfc3339,
···
74
83
// filepath.Join strips the second / in http://
75
84
Link: &AtomLink{Href: config.Config.URL + filepath.Join(srcDir, p.Meta["slug"].(string))},
76
85
Summary: &AtomSummary{
77
-
Content: fmt.Sprintf("<h2>%s</h2>\n%s",
78
-
p.Meta["subtitle"].(string),
79
-
string(p.Body)),
80
-
Type: "html",
86
+
Content: summaryContent,
87
+
Type: "html",
81
88
},
82
89
}
83
90
entries = append(entries, entry)
+7
-1
commands/build.go
+7
-1
commands/build.go
···
87
87
// Build is the core builder function. Converts markdown/yaml
88
88
// to html, copies over non-.md/.yaml files, etc.
89
89
func Build(drafts bool) error {
90
+
startTime := time.Now()
91
+
90
92
if err := preBuild(); err != nil {
91
93
return err
92
94
}
···
116
118
if err := util.CopyDir(types.StaticDir, buildStatic); err != nil {
117
119
return err
118
120
}
121
+
122
+
buildTime := time.Since(startTime)
123
+
fmt.Printf("vite: completed in %v\n", buildTime)
119
124
120
125
return nil
121
126
}
···
181
186
182
187
// Copy the post to the root if it's marked as such.
183
188
// ex: build/blog/foo-bar -> build/foo-bar
184
-
if post.Meta["atroot"].(bool) {
189
+
atroot, ok := post.Meta["atroot"]
190
+
if ok && atroot.(bool) {
185
191
os.Mkdir(filepath.Join(types.BuildDir, slug), 0755)
186
192
df := filepath.Join(types.BuildDir, slug+".html")
187
193
util.CopyFile(filepath.Join(dstDir, slug, "index.html"), df)
+2
-1
contrib/style.go
+2
-1
contrib/style.go
···
7
7
8
8
"github.com/alecthomas/chroma"
9
9
"github.com/alecthomas/chroma/formatters/html"
10
+
"github.com/alecthomas/chroma/styles"
10
11
)
11
12
12
13
var syntax = chroma.MustNewStyle("syntax", chroma.StyleEntries{
···
56
57
57
58
func main() {
58
59
formatter := html.New(html.WithClasses(true))
59
-
formatter.WriteCSS(os.Stdout, syntax)
60
+
formatter.WriteCSS(os.Stdout, styles.Get("catppuccin-latte"))
60
61
}
+1
-1
flake.nix
+1
-1
flake.nix
+1
-1
formats/markdown/markdown.go
+1
-1
formats/markdown/markdown.go
···
69
69
return tmpl.Write(dest, metaTemplate, data)
70
70
}
71
71
72
-
// extract takes the source markdown page, extracts the frontmatter
72
+
// extractFrontmatter takes the source markdown page, extracts the frontmatter
73
73
// and body. The body is converted from markdown to html here.
74
74
func (md *Markdown) extractFrontmatter(source []byte) error {
75
75
r := bytes.NewReader(source)
+6
-1
formats/yaml/yaml.go
+6
-1
formats/yaml/yaml.go
···
76
76
return fmt.Errorf("yaml: meta section is not a map: %s", y.Path)
77
77
}
78
78
79
-
y.meta = metaInterface
79
+
stringMeta := make(map[string]any)
80
+
for k, v := range metaInterface {
81
+
stringMeta[k] = convertToString(v)
82
+
}
83
+
84
+
y.meta = stringMeta
80
85
81
86
err = y.template(dest, types.TemplatesDir, templateData{
82
87
config.Config,
+5
-2
go.mod
+5
-2
go.mod
···
1
1
module tangled.sh/icyphox.sh/vite
2
2
3
-
go 1.21
3
+
go 1.22
4
+
5
+
toolchain go1.24.1
4
6
5
7
require (
6
8
git.icyphox.sh/grayfriday v0.0.0-20221126034429-23c704183914
···
11
13
12
14
require (
13
15
github.com/BurntSushi/toml v0.3.1 // indirect
14
-
github.com/dlclark/regexp2 v1.4.0 // indirect
16
+
github.com/alecthomas/chroma/v2 v2.16.0 // indirect
17
+
github.com/dlclark/regexp2 v1.11.5 // indirect
15
18
gopkg.in/yaml.v2 v2.3.0 // indirect
16
19
)
+4
go.sum
+4
go.sum
···
6
6
github.com/adrg/frontmatter v0.2.0/go.mod h1:93rQCj3z3ZlwyxxpQioRKC1wDLto4aXHrbqIsnH9wmE=
7
7
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
8
8
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
9
+
github.com/alecthomas/chroma/v2 v2.16.0 h1:QC5ZMizk67+HzxFDjQ4ASjni5kWBTGiigRG1u23IGvA=
10
+
github.com/alecthomas/chroma/v2 v2.16.0/go.mod h1:RVX6AvYm4VfYe/zsk7mjHueLDZor3aWCNE14TFlepBk=
9
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
10
12
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
11
13
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12
14
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
13
15
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
16
+
github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ=
17
+
github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
14
18
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
15
19
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
16
20
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=