From 3b38e31d403fc6a43722e1b9eca2278a8b0496f0 Mon Sep 17 00:00:00 2001 From: guiquanz Date: Wed, 16 Jan 2013 17:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=201.=E4=BF=AE=E6=94=B9build.go=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=9A=E4=B8=BA=E7=94=9F=E6=88=90=E7=9A=84=E6=AF=8F?= =?UTF-8?q?=E4=B8=AAhtml=E6=96=87=E4=BB=B6=E8=AE=BE=E7=BD=AEUTF-8=E7=BC=96?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6=E4=B9=B1=E7=A0=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9B=20=202.=E5=A2=9E=E5=8A=A0build.sh=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=9A=E5=B0=81=E8=A3=85html=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=EF=BC=8C=E7=AE=80=E5=8C=96=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=EF=BC=9B=20=203.=E5=A2=9E=E5=8A=A0.gitignore?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=9A=E8=BF=87=E6=BB=A4=E5=AF=B9html?= =?UTF-8?q?=E3=80=81pkg=E7=AD=89=E6=96=87=E4=BB=B6=E7=9A=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++++ build.go | 6 +++++- build.sh | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100755 build.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..25f05583 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*~ +pkg/* +*.html + diff --git a/build.go b/build.go index f82340bf..58ce52e7 100644 --- a/build.go +++ b/build.go @@ -6,8 +6,8 @@ import ( "io/ioutil" "os" "path/filepath" - "strings" "regexp" + "strings" ) // 定义一个访问者结构体 @@ -37,10 +37,14 @@ func (self *Visitor) visit(path string, f os.FileInfo, err error) error { os.Exit(-1) } defer out.Close() + header := "\n\n\n\n\n" + footer := "\n" + out.Write([]byte(header)) if _, err = out.Write(output); err != nil { fmt.Fprintln(os.Stderr, "Error writing output:", err) os.Exit(-1) } + out.Write([]byte(footer)) } } return nil diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..cce60be8 --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/usr/bin/sh + +rm -f *.html *~ + +export GOPATH=`pwd` + +go get -u github.com/russross/blackfriday + +go run build.go +