From 144723f58d504549716b23d73ce904099e9d2674 Mon Sep 17 00:00:00 2001 From: gelosie Date: Fri, 21 Sep 2012 16:42:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E7=94=B1=E5=8C=85=E5=90=AB.md=E5=8F=98=E4=B8=BA?= =?UTF-8?q?=E4=BB=A5.md=E4=B8=BA=E7=BB=93=E5=B0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.go b/build.go index b8522a06..d7bfdedf 100644 --- a/build.go +++ b/build.go @@ -21,7 +21,7 @@ func (self *Visitor) visit(path string, f os.FileInfo, err error) error { } else if (f.Mode() & os.ModeSymlink) > 0 { return nil } else { - if strings.Contains(f.Name(), ".md") { + if strings.HasSuffix(f.Name(), ".md") { fmt.Println(f) file, err := os.Open(f.Name()) if err != nil { From 1983f1d4ef0ae0c504e11a7fad486a1cbdc59e26 Mon Sep 17 00:00:00 2001 From: gelosie Date: Fri, 21 Sep 2012 20:40:02 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84html=E6=96=87?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=9B=BF=E6=8D=A2.md=EF=BC=8C=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=9C=A8=E5=90=8E=E9=9D=A2=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.go b/build.go index d7bfdedf..59ff9b18 100644 --- a/build.go +++ b/build.go @@ -30,7 +30,7 @@ func (self *Visitor) visit(path string, f os.FileInfo, err error) error { input, _ := ioutil.ReadAll(file) output := blackfriday.MarkdownCommon(input) var out *os.File - if out, err = os.Create(f.Name() + ".html"); err != nil { + if out, err = os.Create(strings.Replace(f.Name(),".md",".html",-1) ); err != nil { fmt.Fprintf(os.Stderr, "Error creating %s: %v", f.Name(), err) os.Exit(-1) }