4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
*~
|
||||||
|
pkg/*
|
||||||
|
*.html
|
||||||
|
|
||||||
6
build.go
6
build.go
@@ -6,8 +6,8 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 定义一个访问者结构体
|
// 定义一个访问者结构体
|
||||||
@@ -37,10 +37,14 @@ func (self *Visitor) visit(path string, f os.FileInfo, err error) error {
|
|||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
defer out.Close()
|
defer out.Close()
|
||||||
|
header := "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\"/>\n</head>\n"
|
||||||
|
footer := "</html>\n"
|
||||||
|
out.Write([]byte(header))
|
||||||
if _, err = out.Write(output); err != nil {
|
if _, err = out.Write(output); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Error writing output:", err)
|
fmt.Fprintln(os.Stderr, "Error writing output:", err)
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
out.Write([]byte(footer))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user