Code block variables doesn't expose to below template
sunfmin opened this issue · 2 comments
sunfmin commented
code
@{
import (
"github.com/sunfmin/gorazortests/models"
)
}
@{
au := &models.Author{"Van", 20}
}
<body>
@raw(Hello("Felix Sun", "h1", 30, au ,10))
</body>
generate:
package templates
import (
"bytes"
"github.com/sunfmin/gorazortests/models"
)
func Invokehello() string {
var _buffer bytes.Buffer
_buffer.WriteString("\n\n")
{
au := &models.Author{"Van", 20}
}
_buffer.WriteString("\n\n\n<body>\n")
_buffer.WriteString((Hello("Felix Sun", "h1", 30, au, 10)))
_buffer.WriteString("\n</body>\n\n")
return _buffer.String()
}
compiles error:
sunfmin@FelixMBPR ~/gopkg/src/github.com/sunfmin/gorazortests> gorazor ./templates/ ./templates/ ; go run main.go
Processing dir: ./templates/ ./templates/
Processing: templates/hello.gohtml --> /Users/sunfmin/gopkg/src/github.com/sunfmin/gorazortests/templates/hello.go
Processing: templates/invokehello.gohtml --> /Users/sunfmin/gopkg/src/github.com/sunfmin/gorazortests/templates/invokehello.go
# github.com/sunfmin/gorazortests/templates
templates/invokehello.go:15: undefined: au
Wuvist commented
En... this is a recursion bug with the new go compiler...
will fix today.
_< how this pass our test case....