before crazy
This commit is contained in:
parent
3436d87b1f
commit
a8fd1a1c40
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
|
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
|
||||||
<title>Go by Example: {{.Name}}</title>
|
<title>Go by Example: {{.Name}}</title>
|
||||||
<link rel=stylesheet href="../template/site.css">
|
<link rel=stylesheet href="site.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="chapter" id="{{.Id}}">
|
<div class="chapter" id="{{.Id}}">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
|
<meta http-eqiv="content-type" content="text/html;charset=utf-8">
|
||||||
<title>Go by Example</title>
|
<title>Go by Example</title>
|
||||||
<link rel=stylesheet href="../template/site.css">
|
<link rel=stylesheet href="site.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="intro">
|
<div id="intro">
|
||||||
|
@ -28,6 +28,15 @@ func ensureDir(dir string) {
|
|||||||
check(err)
|
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 {
|
func pipe(bin string, arg []string, src string) []byte {
|
||||||
cmd := exec.Command(bin, arg...)
|
cmd := exec.Command(bin, arg...)
|
||||||
in, _ := cmd.StdinPipe()
|
in, _ := cmd.StdinPipe()
|
||||||
@ -222,6 +231,7 @@ func renderChapters(chapters []*Chapter) {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ensureDir(siteDir)
|
ensureDir(siteDir)
|
||||||
|
copyFile("template/site.css", siteDir+"/site.css")
|
||||||
chapters := parseChapters()
|
chapters := parseChapters()
|
||||||
renderIndex(chapters)
|
renderIndex(chapters)
|
||||||
renderChapters(chapters)
|
renderChapters(chapters)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user