diff --git a/Makefile b/Makefile index 87cf96f..afe476c 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,9 @@ review: gitbook build go run zh2tw.go . .md$$ zh2tw +qrcode: + go run mkqrcode.go + fixlink: go run fixlinks.go . .md$$ diff --git a/gopl-zh-qrcode.png b/gopl-zh-qrcode.png index 8e7df0d..4912088 100644 Binary files a/gopl-zh-qrcode.png and b/gopl-zh-qrcode.png differ diff --git a/mkqrcode.go b/mkqrcode.go new file mode 100644 index 0000000..ce6e688 --- /dev/null +++ b/mkqrcode.go @@ -0,0 +1,33 @@ +// Copyright 2015 . All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ingore + +package main + +import ( + "fmt" + "io/ioutil" + "log" + + qr "github.com/chai2010/image/qrencoder" +) + +const ( + gopl_zh_url = "http://golang-china.github.io/gopl-zh/" + output = "gopl-zh-qrcode.png" +) + +func main() { + c, err := qr.Encode(gopl_zh_url, qr.H) + if err != nil { + log.Fatal(err) + } + err = ioutil.WriteFile(output, c.PNG(), 0666) + if err != nil { + log.Fatal(err) + } + + fmt.Println("output:", output) +}