diff --git a/main.go b/main.go index 91e7378..ad9c1e9 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,41 @@ package main -import "fmt" +import ( + "fmt" + "html/template" + "net/http" +) + +type Item struct { + ID string + Title string +} + +type PageData struct { + Title string + // Items []Item + Selected map[string]bool +} + +var tmpl = template.Must(template.ParseGlob("templates/*.html")) func main() { - fmt.Println("Hello World") + + fmt.Println("serving on localhost:8080") + + http.HandleFunc("/", indexHandler) + http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) + http.ListenAndServe(":8080", nil) +} + +func indexHandler(w http.ResponseWriter, r *http.Request) { + selected := map[string]bool{"lords_prayer": false, "collect_for_purity": true} + data := PageData{ + Title: "The Order for Holy Communion", + Selected: selected, + } + + if err := tmpl.ExecuteTemplate(w, "communion.html", data); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } } diff --git a/static/css/style.css b/static/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/templates/communion.html b/templates/communion.html new file mode 100644 index 0000000..fc9bd3e --- /dev/null +++ b/templates/communion.html @@ -0,0 +1,25 @@ +{{/* file: templates/index.html */}} + + +
+ +OUR Father, who art in heaven, Hallowed be thy Name. + Thy kingdom come. Thy will be done, On earth as it + is in heaven. Give us this day our daily bread. And forgive + us our trespasses, As we forgive those who trespass against + us. And lead us not into temptation, But deliver us from + evil. Amen. +
+{{end}} + +{{define "collect_for_purity"}} ++ ALMIGHTY God, unto whom all hearts are open, all desires known, and from whom no secrets are hid; Cleanse the thoughts of our hearts by the inspira- + tion of thy Holy Spirit, that we may perfectly love thee, and worthily magnify thy holy Name; through Christ our Lord. Amen. +
+ ++ ¶ Then shall the Priest, turning to the People, rehearse distinctly The Ten Commandments; and the People, still kneeling, shall, after every + Commandment, ask God mercy for their transgressions for the time past, and grace to keep the law for the time to come. +
+ ++ ¶ And Note, That in rehearsing The Ten Commandments, the Priest may omit that part of the Commandment which is inset. +
+ ++ ¶ The Decalogue may be omitted, provided it be said at least one Sunday in each month. But Note, That whenever it is omitted, the Priest shall say the Summary + of the Law, beginning, Hear what our Lord Jesus Christ saith. +
+{{end}}