Merge branch 'main' into consolidate-common-concepts

This commit is contained in:
Aidan Delaney 2024-03-05 08:20:56 +00:00 committed by GitHub
commit f98f986913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ const (
gendocFrontmatterTemplate = `+++
title="%s"
no_edit="true"
aliases=[ "/docs/tools/pack" ]
+++
<!--more-->
`
@ -30,7 +31,8 @@ no_edit="true"
var filePrepender = func(filename string) string {
name := filepath.Base(filename)
name = strings.Replace(name, ".md", "", -1)
return fmt.Sprintf(gendocFrontmatterTemplate, strings.Replace(name, "_", " ", -1))
presentationName := strings.Replace(name, "_", " ", -1)
return fmt.Sprintf(gendocFrontmatterTemplate, presentationName)
}
var linkHandler = func(name string) string {
@ -52,7 +54,7 @@ func main() {
}
if _, err := os.Stat(filepath.Join(outputPath, indexFile)); os.IsNotExist(err) {
if err := ioutil.WriteFile(filepath.Join(outputPath, indexFile), []byte(filePrepender("Pack CLI")), os.ModePerm); err != nil {
if err := os.WriteFile(filepath.Join(outputPath, indexFile), []byte(filePrepender("Pack CLI")), os.ModePerm); err != nil {
log.Fatal(err)
}
}