Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knio/domino
https://github.com/knio/domino
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/knio/domino
- Owner: Knio
- License: mit
- Created: 2014-04-11T02:21:05.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-22T01:10:34.000Z (about 10 years ago)
- Last Synced: 2024-10-16T15:30:03.381Z (2 months ago)
- Language: Go
- Size: 285 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Domino
======`Domino` is a Go library for creating and manipulating HTML documents
using an elegant DOM API. It allows you to write HTML pages in pure Go
reasonably concisely, which eliminates the need to learn another template
language, and lets you take advantage of the more powerful features of Go.Go:
```go
package mainimport "fmt"
import . "github.com/Knio/Domino"func main() {
d := NewDocument("Dominate your HTML")d.Head.Add(
Link(Attr{"rel": "stylesheet", "href": "style.css"}),
Script(Attr{"type": "text/javascript", "src": "script.js"}),
)c := NewContext(d.Body.Div(Attr{"id": "header"}))
c.Push(Ol())
for _, i := range []string{"home", "about", "contact"} {
Li(c, A(i, Attr{"href": fmt.Sprintf("/%s", i)}))
}
c.Pop()c.Div(Attr{"class": "body"}, P("Lorem ipsum.."))
fmt.Print(d.IndentString())
}
```HTML:
```html
Dominate your HTML
Lorem ipsum..
```
Compatibility
-------------`Domino` is compatible with Go 1.1 and above.
Installation
------------The recommended way to install `domino` is with
```bash
go get github.com/Knio/Domino
```Developed By
------------* Tom Flanagan -
Git repository located at
[github.com/Knio/Domino](//github.com/Knio/Domino)