~jzs/sketchground.site

e17ffd1a6eb60d3fe69396332f8f54f4cb2db6dd — Jens Zeilund 10 months ago 199c6d6
Cleanup and format news slightly different
3 files changed, 29 insertions(+), 22 deletions(-)

M index.md.tmpl
M main.go
M toots/index.md.tmpl
M index.md.tmpl => index.md.tmpl +2 -2
@@ 11,9 11,9 @@ A personal playground for experiments and various projects that has not reached 

{{range .}}
{{if eq .Type "toot" }}
- {{.Created.Format "2006-01-02"}} - {{.Title}} -
- **{{.Created.Format "2006-01-02"}}** - {{.Title}}
{{ else }}
- {{.Created.Format "2006-01-02"}} [{{.Title}}]({{.Link}})
- **{{.Created.Format "2006-01-02"}}** - [{{.Title}}]({{.Link}})
{{ end }}
{{ end }}


M main.go => main.go +25 -19
@@ 187,7 187,7 @@ func MarkdownToHtml(t *template.Template, fc []byte, hasBack bool) []byte {
		Content template.HTML
	}{
		HasBack: hasBack,
		Content: template.HTML(template.HTML(blackfriday.Run(fc))),
		Content: template.HTML(blackfriday.Run(fc)),
	}); err != nil {
		log.Println(err)
	}


@@ 438,15 438,18 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
			file = buf.Bytes()
		}

		if err := t.Execute(w, struct {
			HasBack bool
			Content template.HTML
		}{
			HasBack: r.URL.Path != "/index.md",
			Content: template.HTML(blackfriday.Run(file)),
		}); err != nil {
			log.Println(err)
		}
		w.Write(MarkdownToHtml(t, file, r.URL.Path != "/index.md"))
		/*
			if err := t.Execute(w, struct {
				HasBack bool
				Content template.HTML
			}{
				HasBack: r.URL.Path != "/index.md",
				Content: template.HTML(blackfriday.Run(file)),
			}); err != nil {
				log.Println(err)
			}
		*/

		return
	}


@@ 459,15 462,18 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
			panic(err)
		}

		if err := t.Execute(w, struct {
			HasBack bool
			Content template.HTML
		}{
			HasBack: r.URL.Path != "/index.md",
			Content: template.HTML(blackfriday.Run(file)),
		}); err != nil {
			log.Println(err)
		}
		w.Write(MarkdownToHtml(t, file, r.URL.Path != "/index.md"))
		/*
			if err := t.Execute(w, struct {
				HasBack bool
				Content template.HTML
			}{
				HasBack: r.URL.Path != "/index.md",
				Content: template.HTML(blackfriday.Run(file)),
			}); err != nil {
				log.Println(err)
			}
		*/

		return
	}

M toots/index.md.tmpl => toots/index.md.tmpl +2 -1
@@ 1,5 1,6 @@
# Toots


{{range .}}
- {{.Time.Format "2006-01-02"}} - {{.Message}} -
- **{{.Time.Format "2006-01-02"}}** - {{.Message}}
{{ end }}