Skip to content

Commit

Permalink
Remove extra blank lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuvist committed May 3, 2014
1 parent 5dad1d5 commit 175ff00
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 63 deletions.
2 changes: 0 additions & 2 deletions gen/helper/footer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (

func Footer() string {
var _buffer bytes.Buffer

_buffer.WriteString("<div>copyright 2014</div>")

return _buffer.String()
}
2 changes: 0 additions & 2 deletions gen/helper/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (

func Header() string {
var _buffer bytes.Buffer

_buffer.WriteString("<div>Page Header</div>")

return _buffer.String()
}
6 changes: 0 additions & 6 deletions gen/helper/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ import (

func Msg(u *User) string {
var _buffer bytes.Buffer
_buffer.WriteString("\n\n\n")

username := u.Name
if u.Email != "" {
username += "(" + u.Email + ")"
}

_buffer.WriteString("\n<div class=\"welcome\">\n<h4>Hello ")
_buffer.WriteString(gorazor.HTMLEscape(username))

_buffer.WriteString("</h4>\n\n<div>")
_buffer.WriteString((u.Intro))

_buffer.WriteString("</div>\n</div>\n")

return _buffer.String()
}
48 changes: 0 additions & 48 deletions gen/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,118 +10,70 @@ import (

func Home(totalMessage int, u *User) string {
var _buffer bytes.Buffer
_buffer.WriteString("\n\n\n")
_buffer.WriteString((helper.Header()))

_buffer.WriteString("\n")
_buffer.WriteString((helper.Msg(u)))

_buffer.WriteString("\n\n")
for i := 0; i < 2; i++ {
if totalMessage > 0 {
if totalMessage == 1 {

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has 1 message</p>")

} else {

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has ")
_buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(totalMessage)))

_buffer.WriteString(" messages</p>")

}
} else {

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has no messages</p>")

}
}
_buffer.WriteString("\n\n\n")

for i := 0; i < 2; i++ {
if totalMessage > 0 {
if totalMessage == 1 {

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has 1 message</p>")

} else {

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has ")
_buffer.WriteString(gorazor.HTMLEscape(gorazor.Itoa(totalMessage)))

_buffer.WriteString(" messages</p>")

}
} else {

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has no messages</p>")

}
}

_buffer.WriteString("\n\n")

switch totalMessage {
case 1:

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has 1 message</p>")

case 2:

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has 2 messages</p>")

default:

_buffer.WriteString("<p>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString(" has no messages</p>")

}

_buffer.WriteString("\n\n")
_buffer.WriteString((helper.Footer()))

_buffer.WriteString("\n\n")
title := func() string {
var _buffer bytes.Buffer

_buffer.WriteString("<title>")
_buffer.WriteString(gorazor.HTMLEscape(u.Name))

_buffer.WriteString("'s homepage</title>")

return _buffer.String()
}
_buffer.WriteString("\n\n")
side := func() string {
var _buffer bytes.Buffer

return _buffer.String()
}
return layout.Base(_buffer.String(), title(), side())
Expand Down
4 changes: 0 additions & 4 deletions gen/layout/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ func Base(body string, title string, side string) string {
var _buffer bytes.Buffer
_buffer.WriteString("\n<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\" />\n")
_buffer.WriteString((title))

_buffer.WriteString("\n</head>\n<body>\n<div>")
_buffer.WriteString((body))

_buffer.WriteString("</div>\n<div>")
_buffer.WriteString((side))

_buffer.WriteString("</div>\n</body>\n</html>")

return _buffer.String()
}
4 changes: 3 additions & 1 deletion vash.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,9 @@ VCP.addHead = function(body){
if (l.indexOf("_buffer.WriteString") == 0) {
l = l.replace("\\'", "'");
}
newBody.push(l);
if(l != "" & (!l.match(/_buffer.WriteString\("(\\n)+"\)/))) {
newBody.push(l);
}
}

body = newBody.join("\n");
Expand Down

0 comments on commit 175ff00

Please sign in to comment.