68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
package main
|
||
|
||
import(
|
||
"project.hechon.fr/internal/renderer"
|
||
/*
|
||
"project.hechon.fr/internal/fetcher"
|
||
*/
|
||
|
||
"log"
|
||
"os"
|
||
"strings"
|
||
"project.hechon.fr/internal/config"
|
||
)
|
||
|
||
func loadExclude(path string) (map[string]struct{}, error) {
|
||
b, err := os.ReadFile(path)
|
||
if err != nil { return nil, err }
|
||
m := make(map[string]struct{})
|
||
for _, line := range strings.Split(string(b), "\n") {
|
||
w := strings.TrimSpace(line)
|
||
if w == "" || strings.HasPrefix(w, "#") { continue }
|
||
m[w] = struct{}{}
|
||
}
|
||
return m, nil
|
||
}
|
||
|
||
func main (){
|
||
|
||
book := config.Book{
|
||
Name: "Psaumes",
|
||
Version: "LSG",
|
||
}
|
||
|
||
cfg := config.Cfg{
|
||
ConfigPath: "internal/config/",
|
||
YamlPath: "data",
|
||
HtmlPath: "public",
|
||
BookList: map[string]int{
|
||
"Psaumes": 150,
|
||
"Proverbes": 31,
|
||
},
|
||
|
||
Book: book,
|
||
}
|
||
|
||
|
||
properName, err:= loadExclude(cfg.ConfigPath + "properName.txt")
|
||
if err != nil{
|
||
log.Printf("can’t open the proper names file")
|
||
os.Exit(1)
|
||
}
|
||
cfg.ProperName = properName
|
||
/*
|
||
err = fetcher.FetchBook(&cfg)
|
||
*/
|
||
|
||
err = renderer.ExtractChapter(&cfg, 2)
|
||
err = renderer.ExtractChapter(&cfg, 68)
|
||
|
||
if err != nil {
|
||
log.Printf("******%s*******\n", err)
|
||
os.Exit(1)
|
||
}
|
||
|
||
os.Exit(0)
|
||
}
|
||
|