adding automatic.css
This commit is contained in:
@@ -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("can’t create %v", outputFileName)
|
||||
}
|
||||
defer outputFile.Close()
|
||||
|
||||
|
||||
tmpl.ExecuteTemplate(outputFile, "index.html", psalm.Strophes)
|
||||
log.Printf("%v", psalm)
|
||||
return nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user