Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/knio/domino


https://github.com/knio/domino

Last synced: 17 days ago
JSON representation

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 main

import "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







  1. home


  2. about


  3. contact



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)