Allow assets to come from more places than PWD, do some autodetection, add a build file, and update the README

This commit is contained in:
Barak Michener 2014-06-27 22:34:29 -04:00
parent cf2f5219b2
commit 7a24e5e998
4 changed files with 55 additions and 32 deletions

View file

@ -25,6 +25,7 @@ import (
)
type DocRequestHandler struct {
assets string
}
func MarkdownWithCSS(input []byte, title string) []byte {
@ -56,7 +57,7 @@ func (h *DocRequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request, pa
if docpage == "" {
docpage = "Index"
}
file, err := os.Open(fmt.Sprintf("docs/%s.md", docpage))
file, err := os.Open(fmt.Sprintf("%s/docs/%s.md", h.assets, docpage))
if err != nil {
http.Error(w, err.Error(), http.StatusNotFound)
return