aboutsummaryrefslogtreecommitdiff
path: root/page.go
blob: 4fb8b5895b8f6aeafe45e0672aa37e672c9b425d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
	"html/template"
	"io"
	"os"

	"github.com/russross/blackfriday"
)

type Page struct {
	Title string
	Body  []byte
	Pages []os.FileInfo
}

func (p Page) Render(w io.Writer, t *template.Template) error {
	return t.ExecuteTemplate(w, "root", p)
}

func (p Page) HTML() template.HTML {
	return template.HTML(blackfriday.MarkdownCommon(p.Body))
}