correction bug empty html
This commit is contained in:
@@ -32,14 +32,17 @@ func ExtractChapter(cfg *config.Cfg, chapterNum int) (error){
|
||||
}
|
||||
|
||||
var psalm models.Psalm
|
||||
currentStrophe := models.Strophe{
|
||||
Who: yamlData.PoeticLines[0].Who,
|
||||
To: yamlData.PoeticLines[0].To,
|
||||
Of: yamlData.PoeticLines[0].Of,
|
||||
}
|
||||
var currentStrophe models.Strophe
|
||||
|
||||
for _, poeticLine := range yamlData.PoeticLines{
|
||||
for i, poeticLine := range yamlData.PoeticLines{
|
||||
log.Printf("first line: %v - %v - %v", poeticLine.Who, poeticLine.To, poeticLine.Of)
|
||||
if i == 0 {
|
||||
currentStrophe = models.Strophe{
|
||||
Who: yamlData.PoeticLines[0].Who,
|
||||
To: yamlData.PoeticLines[0].To,
|
||||
Of: yamlData.PoeticLines[0].Of,
|
||||
}
|
||||
}
|
||||
|
||||
if poeticLine.Who == currentStrophe.Who &&
|
||||
poeticLine.To == currentStrophe.To &&
|
||||
@@ -58,6 +61,7 @@ func ExtractChapter(cfg *config.Cfg, chapterNum int) (error){
|
||||
}
|
||||
|
||||
psalm.Strophes = append(psalm.Strophes, currentStrophe)
|
||||
log.Printf("====== %v %v========", psalm.Strophes, chapterNum)
|
||||
|
||||
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")
|
||||
@@ -69,7 +73,7 @@ func ExtractChapter(cfg *config.Cfg, chapterNum int) (error){
|
||||
defer outputFile.Close()
|
||||
|
||||
|
||||
tmpl.ExecuteTemplate(outputFile, "index.html", psalm.Strophes)
|
||||
tmpl.Execute(outputFile, psalm.Strophes)
|
||||
log.Printf("%v", psalm)
|
||||
return nil
|
||||
|
||||
|
||||
Reference in New Issue
Block a user