Build doc
This commit is contained in:
parent
264916bbb3
commit
884bee9c6d
2 changed files with 13 additions and 12 deletions
|
|
@ -12,7 +12,7 @@
|
|||
<link fetchpriority="low" href="/go-form/site.webmanifest" rel="manifest" />
|
||||
<title>Rendering – deblan/go-form</title>
|
||||
<meta name="description" content="go-form allows you to render a form using Go’s built-in template engine. Here is a simple example that displays a form:
|
||||
myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(` <html> <head> <title>My form</title> </head> <body> {{ form .Form }} </body> </html> `) b := new(strings.Builder) tpl.Execute(w, map[string]any{ "Form": myForm, }) fmt.Println(b.String()) @import "html/template" @import "strings" @import @import "gitnet.fr/deblan/go-form/example" @import "gitnet.fr/deblan/go-form/theme" form := example.CreateDataForm() render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(`{{ form .Form }}`) buff := new(strings.Builder) tpl.Execute(buff, map[string]any{ "Form": form, }) fmt.Println(buff.String()) Test me Run Try it yourself ↗ Share ↗ Other helper functions are available to render specific parts of the form:" /><link rel="canonical" href="https://deblan.gitnet.page/go-form/docs/rendering/" itemprop="url" />
|
||||
myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(` <html> <head> <title>My form</title> </head> <body> {{ form .Form }} </body> </html> `) b := new(strings.Builder) tpl.Execute(w, map[string]any{ "Form": myForm, }) fmt.Println(b.String()) @import "fmt" @import "html/template" @import "strings" @import @import "gitnet.fr/deblan/go-form/example" @import "gitnet.fr/deblan/go-form/theme" form := example.CreateDataForm() render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(`{{ form .Form }}`) buff := new(strings.Builder) tpl.Execute(buff, map[string]any{ "Form": form, }) fmt.Println(buff.String()) Test me Run Try it yourself ↗ Share ↗ Other helper functions are available to render specific parts of the form:" /><link rel="canonical" href="https://deblan.gitnet.page/go-form/docs/rendering/" itemprop="url" />
|
||||
|
||||
<meta property="og:title" content="Rendering" />
|
||||
<meta property="og:description" content="Creating and processing HTML forms in golang" />
|
||||
|
|
@ -21,12 +21,12 @@ myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _
|
|||
|
||||
<meta itemprop="name" content="Rendering">
|
||||
<meta itemprop="description" content="go-form allows you to render a form using Go’s built-in template engine. Here is a simple example that displays a form:
|
||||
myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(` <html> <head> <title>My form</title> </head> <body> {{ form .Form }} </body> </html> `) b := new(strings.Builder) tpl.Execute(w, map[string]any{ "Form": myForm, }) fmt.Println(b.String()) @import "html/template" @import "strings" @import @import "gitnet.fr/deblan/go-form/example" @import "gitnet.fr/deblan/go-form/theme" form := example.CreateDataForm() render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(`{{ form .Form }}`) buff := new(strings.Builder) tpl.Execute(buff, map[string]any{ "Form": form, }) fmt.Println(buff.String()) Test me Run Try it yourself ↗ Share ↗ Other helper functions are available to render specific parts of the form:">
|
||||
<meta itemprop="wordCount" content="147">
|
||||
myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(` <html> <head> <title>My form</title> </head> <body> {{ form .Form }} </body> </html> `) b := new(strings.Builder) tpl.Execute(w, map[string]any{ "Form": myForm, }) fmt.Println(b.String()) @import "fmt" @import "html/template" @import "strings" @import @import "gitnet.fr/deblan/go-form/example" @import "gitnet.fr/deblan/go-form/theme" form := example.CreateDataForm() render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(`{{ form .Form }}`) buff := new(strings.Builder) tpl.Execute(buff, map[string]any{ "Form": form, }) fmt.Println(buff.String()) Test me Run Try it yourself ↗ Share ↗ Other helper functions are available to render specific parts of the form:">
|
||||
<meta itemprop="wordCount" content="149">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:title" content="Rendering">
|
||||
<meta name="twitter:description" content="go-form allows you to render a form using Go’s built-in template engine. Here is a simple example that displays a form:
|
||||
myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(` <html> <head> <title>My form</title> </head> <body> {{ form .Form }} </body> </html> `) b := new(strings.Builder) tpl.Execute(w, map[string]any{ "Form": myForm, }) fmt.Println(b.String()) @import "html/template" @import "strings" @import @import "gitnet.fr/deblan/go-form/example" @import "gitnet.fr/deblan/go-form/theme" form := example.CreateDataForm() render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(`{{ form .Form }}`) buff := new(strings.Builder) tpl.Execute(buff, map[string]any{ "Form": form, }) fmt.Println(buff.String()) Test me Run Try it yourself ↗ Share ↗ Other helper functions are available to render specific parts of the form:">
|
||||
myForm := form.NewForm(...) render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(` <html> <head> <title>My form</title> </head> <body> {{ form .Form }} </body> </html> `) b := new(strings.Builder) tpl.Execute(w, map[string]any{ "Form": myForm, }) fmt.Println(b.String()) @import "fmt" @import "html/template" @import "strings" @import @import "gitnet.fr/deblan/go-form/example" @import "gitnet.fr/deblan/go-form/theme" form := example.CreateDataForm() render := theme.NewRenderer(theme.Bootstrap5) tpl, _ := template.New("page").Funcs(render.FuncMap()).Parse(`{{ form .Form }}`) buff := new(strings.Builder) tpl.Execute(buff, map[string]any{ "Form": form, }) fmt.Println(buff.String()) Test me Run Try it yourself ↗ Share ↗ Other helper functions are available to render specific parts of the form:">
|
||||
|
||||
<link rel="preload" href="/go-form/css/compiled/main.min.e0bb0f28123bf084d555fc9253c6d2aa1443b2dfcde6044741a207eabdc3ddb8.css" as="style" integrity="sha256-4LsPKBI78ITVVfySU8bSqhRDst/N5gRHQaIH6r3D3bg=" />
|
||||
<link href="/go-form/css/compiled/main.min.e0bb0f28123bf084d555fc9253c6d2aa1443b2dfcde6044741a207eabdc3ddb8.css" rel="stylesheet" integrity="sha256-4LsPKBI78ITVVfySU8bSqhRDst/N5gRHQaIH6r3D3bg=" />
|
||||
|
|
@ -346,6 +346,7 @@ Here is a simple example that displays a form:</p>
|
|||
</div>
|
||||
</div>
|
||||
<pre class="hidden">
|
||||
@import "fmt"
|
||||
@import "html/template"
|
||||
@import "strings"
|
||||
@import
|
||||
|
|
@ -367,16 +368,16 @@ fmt.Println(buff.String())
|
|||
</pre>
|
||||
<details>
|
||||
<summary class="hugo-goplay-summary">Test me</summary>
|
||||
<textarea class="hugo-goplay-textarea" id="textarea-b7b61b017c775b00ff044d2855132d68"></textarea>
|
||||
<div id="b7b61b017c775b00ff044d2855132d68" class="hugo-goplay-result"></div>
|
||||
<textarea class="hugo-goplay-textarea" id="textarea-0f80eacd59d04956ad1e7f144eff8b7e"></textarea>
|
||||
<div id="0f80eacd59d04956ad1e7f144eff8b7e" class="hugo-goplay-result"></div>
|
||||
<div class="hugo-goplay-toolbox">
|
||||
<button role="button" class="hugo-goplay-button" id="hugo-goplay-tool-b7b61b017c775b00ff044d2855132d68-run">
|
||||
<button role="button" class="hugo-goplay-button" id="hugo-goplay-tool-0f80eacd59d04956ad1e7f144eff8b7e-run">
|
||||
Run
|
||||
</button>
|
||||
<button role="button" class="hugo-goplay-button" id="hugo-goplay-tool-b7b61b017c775b00ff044d2855132d68-try">
|
||||
<button role="button" class="hugo-goplay-button" id="hugo-goplay-tool-0f80eacd59d04956ad1e7f144eff8b7e-try">
|
||||
Try it yourself ↗
|
||||
</button>
|
||||
<button role="button" class="hugo-goplay-button" id="hugo-goplay-tool-b7b61b017c775b00ff044d2855132d68-share">
|
||||
<button role="button" class="hugo-goplay-button" id="hugo-goplay-tool-0f80eacd59d04956ad1e7f144eff8b7e-share">
|
||||
Share ↗
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -386,8 +387,8 @@ fmt.Println(buff.String())
|
|||
|
||||
createPlaygroundWithAutoImportMail(
|
||||
new GoPlayProxy("https://gp.deblan.gitnet.page"),
|
||||
"b7b61b017c775b00ff044d2855132d68",
|
||||
"\n\u003cpre class=\u0022hidden\u0022\u003e\n@import \u0022html\/template\u0022\n@import \u0022strings\u0022\n@import\n@import \u0022gitnet.fr\/deblan\/go-form\/example\u0022\n@import \u0022gitnet.fr\/deblan\/go-form\/theme\u0022\n\nform := example.CreateDataForm()\nrender := theme.NewRenderer(theme.Bootstrap5)\n\ntpl, _ := template.New(\u0022page\u0022).Funcs(render.FuncMap()).Parse(\u0060{{ form .Form }}\u0060)\n\nbuff := new(strings.Builder)\n\ntpl.Execute(buff, map[string]any{\n \u0022Form\u0022: form,\n})\n\nfmt.Println(buff.String())\n\u003c\/pre\u003e\n"
|
||||
"0f80eacd59d04956ad1e7f144eff8b7e",
|
||||
"\n\u003cpre class=\u0022hidden\u0022\u003e\n@import \u0022fmt\u0022\n@import \u0022html\/template\u0022\n@import \u0022strings\u0022\n@import\n@import \u0022gitnet.fr\/deblan\/go-form\/example\u0022\n@import \u0022gitnet.fr\/deblan\/go-form\/theme\u0022\n\nform := example.CreateDataForm()\nrender := theme.NewRenderer(theme.Bootstrap5)\n\ntpl, _ := template.New(\u0022page\u0022).Funcs(render.FuncMap()).Parse(\u0060{{ form .Form }}\u0060)\n\nbuff := new(strings.Builder)\n\ntpl.Execute(buff, map[string]any{\n \u0022Form\u0022: form,\n})\n\nfmt.Println(buff.String())\n\u003c\/pre\u003e\n"
|
||||
)
|
||||
</script>
|
||||
<p>Other helper functions are available to render specific parts of the form:</p>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue