before crazy

This commit is contained in:
Mark McGranaghan 2012-10-09 12:54:47 -07:00
parent 3436d87b1f
commit a8fd1a1c40
3 changed files with 12 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
<title>Go by Example: {{.Name}}</title>
<link rel=stylesheet href="../template/site.css">
<link rel=stylesheet href="site.css">
</head>
<body>
<div class="chapter" id="{{.Id}}">

View File

@ -3,7 +3,7 @@
<head>
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
<title>Go by Example</title>
<link rel=stylesheet href="../template/site.css">
<link rel=stylesheet href="site.css">
</head>
<body>
<div id="intro">

View File

@ -28,6 +28,15 @@ func ensureDir(dir string) {
check(err)
}
func copyFile(src, dst string) {
srcF, err := os.Open(src, os.O_RDONLY, 0)
check(err)
dstF, err := os.Create(dst)
check(err)
err = io.Copy(srcF, dstF)
check(err)
}
func pipe(bin string, arg []string, src string) []byte {
cmd := exec.Command(bin, arg...)
in, _ := cmd.StdinPipe()
@ -222,6 +231,7 @@ func renderChapters(chapters []*Chapter) {
func main() {
ensureDir(siteDir)
copyFile("template/site.css", siteDir+"/site.css")
chapters := parseChapters()
renderIndex(chapters)
renderChapters(chapters)