Move module to git.codemonkeysoftware.net
This commit is contained in:
parent
38aea4a033
commit
cbf7aa6a9d
20
README.md
20
README.md
@ -1,9 +1,9 @@
|
||||
hatmill - HTML generation DSL for Go
|
||||
=====================================
|
||||
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://gitlab.codemonkeysoftware.net/b/hatmill/blob/master/COPYING)
|
||||
[![Gitlab pipeline status](https://gitlab.codemonkeysoftware.net/b/hatmill/badges/master/pipeline.svg)](https://gitlab.codemonkeysoftware.net/b/hatmill/commits/master)
|
||||
[![Go Report Card](https://goreportcard.com/badge/gitlab.codemonkeysoftware.net/b/hatmill)](https://goreportcard.com/report/gitlab.codemonkeysoftware.net/b/hatmill)
|
||||
[![GoDoc](https://godoc.org/gitlab.codemonkeysoftware.net/b/hatmill?status.svg)](https://godoc.org/gitlab.codemonkeysoftware.net/b/hatmill)
|
||||
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://git.codemonkeysoftware.net/b/hatmill/blob/master/COPYING)
|
||||
[![Gitlab pipeline status](https://git.codemonkeysoftware.net/b/hatmill/badges/master/pipeline.svg)](https://git.codemonkeysoftware.net/b/hatmill/commits/master)
|
||||
[![Go Report Card](https://goreportcard.com/badge/git.codemonkeysoftware.net/b/hatmill)](https://goreportcard.com/report/git.codemonkeysoftware.net/b/hatmill)
|
||||
[![GoDoc](https://godoc.org/git.codemonkeysoftware.net/b/hatmill?status.svg)](https://godoc.org/git.codemonkeysoftware.net/b/hatmill)
|
||||
![Badge count](https://img.shields.io/badge/badges-5-yellow.svg)
|
||||
|
||||
`hatmill` provides a simple set of types and helper functions for writing HTML in plain Go code, without having to deal with any template languages. It is not spectacularly fast, but is comparable in simple cases to the `html/template` package; run `go test -bench=. -benchmem` for proof. `hatmill` “templates” are arguably easier to read and write than many template languages.
|
||||
@ -14,17 +14,17 @@ Installation
|
||||
---------------
|
||||
There are three necessary packages:
|
||||
|
||||
- `gitlab.codemonkeysoftware.net/b/hatmill`
|
||||
- `gitlab.codemonkeysoftware.net/b/hatmill/attribute`
|
||||
- `gitlab.codemonkeysoftware.net/b/hatmill/element`
|
||||
- `git.codemonkeysoftware.net/b/hatmill`
|
||||
- `git.codemonkeysoftware.net/b/hatmill/attribute`
|
||||
- `git.codemonkeysoftware.net/b/hatmill/element`
|
||||
|
||||
Install them as you would any other Go package, with `go get` or whatever.
|
||||
`gitlab.codemonkeysoftware.net/b/hatmill` is a Go module and so will play nicely
|
||||
`git.codemonkeysoftware.net/b/hatmill` is a Go module and so will play nicely
|
||||
with Go ≥ 1.11.
|
||||
|
||||
Usage
|
||||
------
|
||||
Basic types are in `gitlab.codemonkeysoftware.net/b/hatmill`. The `attribute`
|
||||
Basic types are in `git.codemonkeysoftware.net/b/hatmill`. The `attribute`
|
||||
and `element` subpackages contain helper functions for HTML5 attributes and
|
||||
elements. See the `Example` function in `hatmill_test.go`.
|
||||
|
||||
@ -34,5 +34,5 @@ If there is a missing attribute or element helper function, describe it in
|
||||
`defs.json` and run `go generate` in the repository root. If you can't figure
|
||||
out what you need to know by reading `defs.json`, `internal/codegen/*`,
|
||||
`attribute/*`, and `element/*`, then
|
||||
[pester me](https://gitlab.codemonkeysoftware.net/b/hatmill/issues/new) to
|
||||
[pester me](https://git.codemonkeysoftware.net/b/hatmill/issues/new) to
|
||||
improve the documentation.
|
||||
|
@ -1,6 +1,6 @@
|
||||
package attribute
|
||||
|
||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
import "git.codemonkeysoftware.net/b/hatmill"
|
||||
|
||||
type AccessKeyCode rune
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package attribute_test
|
||||
|
||||
import (
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
"testing"
|
||||
|
||||
"git.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
)
|
||||
|
||||
func TestAccessKeyCodeString(t *testing.T) {
|
||||
|
@ -3,7 +3,7 @@ package attribute
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
"git.codemonkeysoftware.net/b/hatmill"
|
||||
)
|
||||
|
||||
type CoordsList []float32
|
||||
|
@ -3,7 +3,7 @@ package attribute_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
"git.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
)
|
||||
|
||||
func TestCoordsList(t *testing.T) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package attribute
|
||||
|
||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
import "git.codemonkeysoftware.net/b/hatmill"
|
||||
|
||||
// CustomData creates an attribute of the form data-suffix='value'.
|
||||
func CustomData(suffix, value string) hatmill.Attrib {
|
||||
|
@ -1,9 +1,9 @@
|
||||
// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/codegen
|
||||
// GENERATED BY git.codemonkeysoftware.net/b/hatmill/internal/codegen
|
||||
// DO NOT EDIT!
|
||||
|
||||
package attribute
|
||||
|
||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
import "git.codemonkeysoftware.net/b/hatmill"
|
||||
|
||||
// Accept creates a "accept" attribute
|
||||
func Accept(value ...string) hatmill.Attrib {
|
||||
@ -38,8 +38,8 @@ func Alt(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Async creates a "async" attribute
|
||||
func Async(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Async(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -64,8 +64,8 @@ func Autocomplete(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Autofocus creates a "autofocus" attribute
|
||||
func Autofocus(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Autofocus(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -74,8 +74,8 @@ func Autofocus(b bool) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Autoplay creates a "autoplay" attribute
|
||||
func Autoplay(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Autoplay(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -92,8 +92,8 @@ func Charset(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Checked creates a "checked" attribute
|
||||
func Checked(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Checked(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -158,8 +158,8 @@ func Contextmenu(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Controls creates a "controls" attribute
|
||||
func Controls(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Controls(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -192,8 +192,8 @@ func Decoding(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Default creates a "default" attribute
|
||||
func Default(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Default(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -202,8 +202,8 @@ func Default(b bool) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Defer creates a "defer" attribute
|
||||
func Defer(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Defer(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -228,8 +228,8 @@ func Dirname(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Disabled creates a "disabled" attribute
|
||||
func Disabled(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Disabled(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -310,8 +310,8 @@ func Height(value int) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Hidden creates a "hidden" attribute
|
||||
func Hidden(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Hidden(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -360,8 +360,8 @@ func Id(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Ismap creates a "ismap" attribute
|
||||
func Ismap(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Ismap(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -410,8 +410,8 @@ func List(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Loop creates a "loop" attribute
|
||||
func Loop(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Loop(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -476,8 +476,8 @@ func Minlength(value int) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Multiple creates a "multiple" attribute
|
||||
func Multiple(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Multiple(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -486,8 +486,8 @@ func Multiple(b bool) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Muted creates a "muted" attribute
|
||||
func Muted(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Muted(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -504,8 +504,8 @@ func Name(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Novalidate creates a "novalidate" attribute
|
||||
func Novalidate(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Novalidate(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -514,8 +514,8 @@ func Novalidate(b bool) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Open creates a "open" attribute
|
||||
func Open(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Open(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -572,8 +572,8 @@ func Preload(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Readonly creates a "readonly" attribute
|
||||
func Readonly(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Readonly(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -598,8 +598,8 @@ func Rel(value ...string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Required creates a "required" attribute
|
||||
func Required(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Required(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -608,8 +608,8 @@ func Required(b bool) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Reversed creates a "reversed" attribute
|
||||
func Reversed(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Reversed(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
@ -650,8 +650,8 @@ func Scope(value string) hatmill.Attrib {
|
||||
}
|
||||
|
||||
// Selected creates a "selected" attribute
|
||||
func Selected(b bool) hatmill.Attrib {
|
||||
if !b {
|
||||
func Selected(showAttrib bool) hatmill.Attrib {
|
||||
if !showAttrib {
|
||||
return hatmill.Attrib{}
|
||||
}
|
||||
return hatmill.Attrib{
|
||||
|
@ -3,7 +3,7 @@ package attribute_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
"git.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
)
|
||||
|
||||
func TestBool(t *testing.T) {
|
||||
|
@ -1,7 +1,10 @@
|
||||
package attribute
|
||||
|
||||
import "strconv"
|
||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"git.codemonkeysoftware.net/b/hatmill"
|
||||
)
|
||||
|
||||
type StepValue float32
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package attribute_test
|
||||
|
||||
import (
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill/element"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
"git.codemonkeysoftware.net/b/hatmill/element"
|
||||
)
|
||||
|
||||
func TestStepValue(t *testing.T) {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package attribute_test
|
||||
|
||||
import (
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
"testing"
|
||||
|
||||
"git.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
)
|
||||
|
||||
func expectEqualStrings(t *testing.T, actual, expected string) {
|
||||
|
@ -2,11 +2,12 @@ package hatmill_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
h "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
he "gitlab.codemonkeysoftware.net/b/hatmill/element"
|
||||
"html/template"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
h "git.codemonkeysoftware.net/b/hatmill"
|
||||
he "git.codemonkeysoftware.net/b/hatmill/element"
|
||||
)
|
||||
|
||||
type benchPerson struct {
|
||||
|
@ -1,9 +1,9 @@
|
||||
// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/codegen
|
||||
// GENERATED BY git.codemonkeysoftware.net/b/hatmill/internal/codegen
|
||||
// DO NOT EDIT!
|
||||
|
||||
package element
|
||||
|
||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
import "git.codemonkeysoftware.net/b/hatmill"
|
||||
|
||||
// A creates a <a> element.
|
||||
func A(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module gitlab.codemonkeysoftware.net/b/hatmill
|
||||
module git.codemonkeysoftware.net/b/hatmill
|
||||
|
||||
go 1.14
|
||||
|
||||
|
@ -11,12 +11,12 @@ import (
|
||||
"testing"
|
||||
"unicode"
|
||||
|
||||
"git.codemonkeysoftware.net/b/hatmill"
|
||||
ha "git.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
he "git.codemonkeysoftware.net/b/hatmill/element"
|
||||
"github.com/leanovate/gopter"
|
||||
"github.com/leanovate/gopter/gen"
|
||||
"github.com/leanovate/gopter/prop"
|
||||
"gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
ha "gitlab.codemonkeysoftware.net/b/hatmill/attribute"
|
||||
he "gitlab.codemonkeysoftware.net/b/hatmill/element"
|
||||
)
|
||||
|
||||
func writeToString(wt io.WriterTo) string {
|
||||
|
@ -141,12 +141,12 @@ func (spec ElemSpec) Generate() Def {
|
||||
|
||||
func Render(defs []Def, pkgName string) ([]byte, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
buf.WriteString(`// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/codegen
|
||||
buf.WriteString(`// GENERATED BY git.codemonkeysoftware.net/b/hatmill/internal/codegen
|
||||
// DO NOT EDIT!
|
||||
|
||||
`)
|
||||
fmt.Fprintln(buf, "package ", pkgName)
|
||||
buf.WriteString(`import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
buf.WriteString(`import "git.codemonkeysoftware.net/b/hatmill"
|
||||
`)
|
||||
|
||||
for _, def := range defs {
|
||||
|
Loading…
Reference in New Issue
Block a user