Merge pull request #739 from mistadikay/master
Fix failing build for English version
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -2,7 +2,7 @@
|
|||||||
pkg/*
|
pkg/*
|
||||||
*.html
|
*.html
|
||||||
*.exe
|
*.exe
|
||||||
<<<<<<< HEAD
|
_book
|
||||||
=======
|
*.epub
|
||||||
|
*.pdf
|
||||||
>>>>>>> eead24cf064976b648de5826eab51880c803b0fa
|
.DS_Store
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
*~
|
|
||||||
pkg/*
|
|
||||||
*.html
|
|
||||||
*.exe
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> eead24cf064976b648de5826eab51880c803b0fa
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
# Multiple Language Versions
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
* [English](en/)
|
|
||||||
>>>>>>> eead24cf064976b648de5826eab51880c803b0fa
|
|
||||||
* [French](fr/)
|
|
||||||
* [Spanish](es/)
|
|
||||||
* [中文](zh/)
|
|
||||||
* [日本語](ja/)
|
|
||||||
* [Turkish](tr/)
|
|
||||||
* [Português - Brasil](pt-br/)
|
|
||||||
* [German](de/)
|
|
||||||
* [Русский](ru/)
|
|
||||||
|
|
||||||
# Donate
|
|
||||||
|
|
||||||
AliPay: <img src="zh/images/alipay.png" alt="alipay" width="100" height="100">
|
|
||||||
|
|
||||||
English Donate:[donate](http://beego.me/donate)
|
|
||||||
|
|
||||||
## Community
|
|
||||||
QQ群:148647580
|
|
||||||
|
|
||||||
BBS:[http://golanghome.com/](http://golanghome.com/)
|
|
||||||
|
|
||||||
## Acknowledgments
|
|
||||||
|
|
||||||
- [四月份平民](https://plus.google.com/110445767383269817959) (review代码)
|
|
||||||
- [Hong Ruiqi](https://github.com/hongruiqi) (review代码)
|
|
||||||
- [BianJiang](https://github.com/border) (编写go开发工具Vim和Emacs的设置)
|
|
||||||
- [Oling Cat](https://github.com/OlingCat)(review代码)
|
|
||||||
- [Wenlei Wu](mailto:spadesacn@gmail.com)(提供一些图片展示)
|
|
||||||
- [polaris](https://github.com/polaris1119)(review书)
|
|
||||||
- [雨痕](https://github.com/qyuhen)(review第二章)
|
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
Translator:
|
|
||||||
- [LarryBattle](https://github.com/LarryBattle)
|
|
||||||
>>>>>>> eead24cf064976b648de5826eab51880c803b0fa
|
|
||||||
## License
|
|
||||||
Book License: [CC BY-SA 3.0 License](http://creativecommons.org/licenses/by-sa/3.0/)
|
|
||||||
|
|
||||||
Code License: [BSD 3-Clause License](<https://github.com/astaxie/build-web-application-with-golang/blob/master/LICENSE.md>)
|
|
||||||
|
|
||||||
|
|
||||||
14
en/07.4.md
14
en/07.4.md
@@ -75,8 +75,8 @@ If you print `{{.}}` in a template, Go outputs a formatted string of this object
|
|||||||
|
|
||||||
We know how to output a field now. What if the field is an object, and it also has its own fields? How do we print them all in one loop? We can use `{{with …}}…{{end}}` and `{{range …}}{{end}}` for exactly that purpose.
|
We know how to output a field now. What if the field is an object, and it also has its own fields? How do we print them all in one loop? We can use `{{with …}}…{{end}}` and `{{range …}}{{end}}` for exactly that purpose.
|
||||||
|
|
||||||
- `{{range}}` just like range in Go.
|
- {% raw %}`{{range}}`{% endraw %} just like range in Go.
|
||||||
- `{{with}}` lets you write the same object name once and use `.` as shorthand for it ( ***Similar to `with` in VB*** ).
|
- {% raw %}`{{with}}`{% endraw %} lets you write the same object name once and use `.` as shorthand for it ( ***Similar to `with` in VB*** ).
|
||||||
|
|
||||||
More examples:
|
More examples:
|
||||||
|
|
||||||
@@ -305,6 +305,7 @@ Here's a complete example, supposing that we have the following three files: `he
|
|||||||
|
|
||||||
Main template:
|
Main template:
|
||||||
|
|
||||||
|
{% raw %}
|
||||||
//header.tmpl
|
//header.tmpl
|
||||||
{{define "header"}}
|
{{define "header"}}
|
||||||
<html>
|
<html>
|
||||||
@@ -334,6 +335,7 @@ Main template:
|
|||||||
//When using subtemplating make sure that you have parsed each sub template file,
|
//When using subtemplating make sure that you have parsed each sub template file,
|
||||||
//otherwise the compiler wouldn't understand what to substitute when it reads the {{template "header"}}
|
//otherwise the compiler wouldn't understand what to substitute when it reads the {{template "header"}}
|
||||||
|
|
||||||
|
{% endraw %}
|
||||||
Code:
|
Code:
|
||||||
|
|
||||||
package main
|
package main
|
||||||
@@ -430,10 +432,10 @@ start with the Range operator, then we can give any member of that struct as `{{
|
|||||||
Title and a Content, (please note the capital T and C, they are exported names and they need to be capitalised unless you
|
Title and a Content, (please note the capital T and C, they are exported names and they need to be capitalised unless you
|
||||||
want to make them private).
|
want to make them private).
|
||||||
|
|
||||||
so {{ range .Tasks }}
|
{{ range .Tasks }}
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
This block of code will print each title and content of the Task array. Below is a full example from github.com/thewhitetulip/Tasks home.html template.
|
This block of code will print each title and content of the Task array. Below is a full example from github.com/thewhitetulip/Tasks home.html template.
|
||||||
|
|
||||||
|
|||||||
10
en/13.5.md
10
en/13.5.md
@@ -127,11 +127,7 @@ func (this *EditController) Get() {
|
|||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||||
this.Data["Post"] = models.GetBlog(id)
|
this.Data["Post"] = models.GetBlog(id)
|
||||||
this.Layout = "layout.tpl"
|
this.Layout = "layout.tpl"
|
||||||
<<<<<<< HEAD
|
|
||||||
this.TplNames = "new.tpl"
|
|
||||||
=======
|
|
||||||
this.TplNames = "edit.tpl"
|
this.TplNames = "edit.tpl"
|
||||||
>>>>>>> eead24cf064976b648de5826eab51880c803b0fa
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *EditController) Post() {
|
func (this *EditController) Post() {
|
||||||
@@ -154,17 +150,11 @@ type DeleteController struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *DeleteController) Get() {
|
func (this *DeleteController) Get() {
|
||||||
<<<<<<< HEAD
|
|
||||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
|
||||||
this.Data["Post"] = models.DelBlog(id)
|
|
||||||
this.Ctx.Redirect(302, "/")
|
|
||||||
=======
|
|
||||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||||
blog := models.GetBlog(id)
|
blog := models.GetBlog(id)
|
||||||
this.Data["Post"] = blog
|
this.Data["Post"] = blog
|
||||||
models.DelBlog(blog)
|
models.DelBlog(blog)
|
||||||
this.Ctx.Redirect(302, "/")
|
this.Ctx.Redirect(302, "/")
|
||||||
>>>>>>> eead24cf064976b648de5826eab51880c803b0fa
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
BIN
.DS_Store → ja/src/.DS_Store
vendored
BIN
.DS_Store → ja/src/.DS_Store
vendored
Binary file not shown.
13
ja/src/1.2/main.go
Normal file
13
ja/src/1.2/main.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// 章节 1.2
|
||||||
|
// $GOPATH/src/mathapp/main.go
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"mymath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Printf("Hello, world. Sqrt(2) = %v\n", mymath.Sqrt(2))
|
||||||
|
}
|
||||||
11
ja/src/1.2/sqrt.go
Normal file
11
ja/src/1.2/sqrt.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// 章节 1.2
|
||||||
|
// $GOPATH/src/mymath/sqrt.go
|
||||||
|
package mymath
|
||||||
|
|
||||||
|
func Sqrt(x float64) float64 {
|
||||||
|
z := 0.0
|
||||||
|
for i := 0; i < 1000; i++ {
|
||||||
|
z -= (z*z - x) / (2 * x)
|
||||||
|
}
|
||||||
|
return z
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user