Web - Go module for HTML generation
This package provides a straight forward way of programming HTML, leaving the separation of view and model as a design choice for the developer. Also no values are automatically escaped.
Install
go get github.com/gregoryv/web/...
API documentation
- web - HTML generation
- web/files - file loading tools
- web/apidoc - HTTP request/response documentation tools
- web/toc - table of content tools
Example
package docs
import . "github.com/gregoryv/web"
func NewHtmlPage() *Page {
page := NewPage(
Html(
Head(
Title("my home page"),
),
Body(
H1("My home"),
"some text here",
),
),
)
return page
}
Produces
<!DOCTYPE html>
<html>
<head>
<title>my home page</title>
</head>
<body>
<h1>My home</h1>
some text here</body>
</html>
The package apidocs enables for a smooth approach to produce documentation while testing your web apis.
API exampleAbout
Written by Gregory Vinčić
MIT License
License
MIT License Copyright (c) 2019 Gregory Vinčić Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.