adding automatic.css

This commit is contained in:
github_username_here
2026-03-24 18:37:31 +01:00
parent f7e63ce1e1
commit 3be21b99e4
7 changed files with 179 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ import (
"log"
"project.hechon.fr/internal/config"
"project.hechon.fr/internal/models"
"html/template"
"gopkg.in/yaml.v3"
"os"
"path"
@@ -46,15 +47,29 @@ func ExtractChapter(cfg *config.Cfg, chapterNum int) (error){
currentStrophe.Colas = append(currentStrophe.Colas, poeticLine.Cola)
}else{
psalm.Strophes = append(psalm.Strophes, currentStrophe)
currentStrophe.Who = poeticLine.Who
currentStrophe.Of = poeticLine.Of
currentStrophe.To = poeticLine.To
currentStrophe = models.Strophe{
Who: poeticLine.Who,
To: poeticLine.To,
Of: poeticLine.Of,
Colas: [][]models.Colon{poeticLine.Cola},
}
}
}
psalm.Strophes = append(psalm.Strophes, currentStrophe)
tmpl := template.Must(template.ParseFiles( "internal/models/index.html", "internal/models/psalm.html"))
outputFileName := path.Join(cfg.HtmlPath, cfg.Book.Name + strconv.Itoa(chapterNum) + ".html")
outputFile, err := os.Create(outputFileName)
if err!= nil {
return fmt.Errorf("cant create %v", outputFileName)
}
defer outputFile.Close()
tmpl.ExecuteTemplate(outputFile, "index.html", psalm.Strophes)
log.Printf("%v", psalm)
return nil