1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-06 03:27:27 +00:00

create a new package, name it as hero, I was thinking super or superb but hero is better name for what it does - the goal is to split the new 'mvc handlers' from the mvc system because they are not the same, users should know that they can use these type of rich binded handlers without controllers as well, like a normal handler and that I implemented here, the old files exist on the mvc package but will be removed at the next commit, I have to decide if we want type aliases for Result or no

Former-commit-id: cb775edc72bedc88aeab4c5a6de6bfc6bd56fae2
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-12-25 20:05:32 +02:00
parent 4ab889da5f
commit 46505f62db
43 changed files with 2680 additions and 20 deletions

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<%@ body { %>
<% } %>
</body>
</html>

View File

@@ -0,0 +1,3 @@
// Code generated by hero.
// DO NOT EDIT!
package template

View File

@@ -0,0 +1,3 @@
<li>
<%= user %>
</li>

View File

@@ -0,0 +1,3 @@
// Code generated by hero.
// DO NOT EDIT!
package template

View File

@@ -0,0 +1,11 @@
<%: func UserList(userList []string, buffer *bytes.Buffer) %>
<%~ "index.html" %>
<%@ body { %>
<% for _, user := range userList { %>
<ul>
<%+ "user.html" %>
</ul>
<% } %>
<% } %>

View File

@@ -0,0 +1,41 @@
// Code generated by hero.
// DO NOT EDIT!
package template
import (
"bytes"
"github.com/shiyanhui/hero"
)
func UserList(userList []string, buffer *bytes.Buffer) {
buffer.WriteString(`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
`)
for _, user := range userList {
buffer.WriteString(`
<ul>
`)
buffer.WriteString(`<li>
`)
hero.EscapeHTML(user, buffer)
buffer.WriteString(`
</li>
`)
buffer.WriteString(`
</ul>
`)
}
buffer.WriteString(`
</body>
</html>
`)
}

View File

@@ -0,0 +1,11 @@
<%: func UserListToWriter(userList []string, w io.Writer) (int, error)%>
<%~ "index.html" %>
<%@ body { %>
<% for _, user := range userList { %>
<ul>
<%+ "user.html" %>
</ul>
<% } %>
<% } %>

View File

@@ -0,0 +1,44 @@
// Code generated by hero.
// DO NOT EDIT!
package template
import (
"io"
"github.com/shiyanhui/hero"
)
func UserListToWriter(userList []string, w io.Writer) (int, error) {
_buffer := hero.GetBuffer()
defer hero.PutBuffer(_buffer)
_buffer.WriteString(`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
`)
for _, user := range userList {
_buffer.WriteString(`
<ul>
`)
_buffer.WriteString(`<li>
`)
hero.EscapeHTML(user, _buffer)
_buffer.WriteString(`
</li>
`)
_buffer.WriteString(`
</ul>
`)
}
_buffer.WriteString(`
</body>
</html>
`)
return w.Write(_buffer.Bytes())
}