diff --git a/examples/gen/helper/footer.go b/examples/gen/helper/footer.go index c3fa7d4..e20d542 100644 --- a/examples/gen/helper/footer.go +++ b/examples/gen/helper/footer.go @@ -6,7 +6,7 @@ import ( func Footer() string { var _buffer bytes.Buffer - _buffer.WriteString("
") - _buffer.WriteString(gorazor.HTMLEscape(u.Name)) - _buffer.WriteString(" has 1 message
") - - } else { + for i := 0; i < 2; i++ { + if totalMessage > 0 { + if totalMessage == 1 { - _buffer.WriteString("") - _buffer.WriteString(gorazor.HTMLEscape(u.Name)) - _buffer.WriteString(" has ") - _buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(totalMessage))) - _buffer.WriteString(" messages
") + _buffer.WriteString("") + _buffer.WriteString(gorazor.HTMLEscape(u.Name)) + _buffer.WriteString(" has 1 message
") - } } else { _buffer.WriteString("") _buffer.WriteString(gorazor.HTMLEscape(u.Name)) - _buffer.WriteString(" has no messages
") + _buffer.WriteString(" has ") + _buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(totalMessage))) + _buffer.WriteString(" messages") } - } - } - _buffer.WriteString("\n\n") - { - switch totalMessage { - case 1: + } else { _buffer.WriteString("") _buffer.WriteString(gorazor.HTMLEscape(u.Name)) - _buffer.WriteString(" has 1 message
") + _buffer.WriteString(" has no messages") - case 2: + } + } - _buffer.WriteString("") - _buffer.WriteString(gorazor.HTMLEscape(u.Name)) - _buffer.WriteString(" has 2 messages
") + switch totalMessage { + case 1: - default: + _buffer.WriteString("") + _buffer.WriteString(gorazor.HTMLEscape(u.Name)) + _buffer.WriteString(" has 1 message
") - _buffer.WriteString("") - _buffer.WriteString(gorazor.HTMLEscape(u.Name)) - _buffer.WriteString(" has no messages
") + case 2: + + _buffer.WriteString("") + _buffer.WriteString(gorazor.HTMLEscape(u.Name)) + _buffer.WriteString(" has 2 messages
") + + default: + + _buffer.WriteString("") + _buffer.WriteString(gorazor.HTMLEscape(u.Name)) + _buffer.WriteString(" has no messages
") - } } - _buffer.WriteString("\n\n") + _buffer.WriteString((helper.Footer())) - _buffer.WriteString("\n\n") title := func() string { var _buffer bytes.Buffer @@ -104,14 +96,12 @@ func Home(totalMessage int, u *User) string { return _buffer.String() } - _buffer.WriteString("\n\n") side := func() string { var _buffer bytes.Buffer return _buffer.String() } - _buffer.WriteString("\n") return layout.Base(_buffer.String(), title(), side()) } diff --git a/examples/gen/layout/base.go b/examples/gen/layout/base.go index b7f0b1d..899e08f 100644 --- a/examples/gen/layout/base.go +++ b/examples/gen/layout/base.go @@ -6,13 +6,13 @@ import ( func Base(body string, title string, side string) string { var _buffer bytes.Buffer - _buffer.WriteString("\n\n\n\n\n") + _buffer.WriteString("\n\n\n\n") _buffer.WriteString((title)) _buffer.WriteString("\n\n\n