Move module to git.codemonkeysoftware.net

This commit is contained in:
Brandon Dyck 2023-12-20 15:35:09 -07:00
parent 38aea4a033
commit cbf7aa6a9d
16 changed files with 78 additions and 71 deletions

View File

@ -1,9 +1,9 @@
hatmill - HTML generation DSL for Go 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) [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://git.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) [![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/gitlab.codemonkeysoftware.net/b/hatmill)](https://goreportcard.com/report/gitlab.codemonkeysoftware.net/b/hatmill) [![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/gitlab.codemonkeysoftware.net/b/hatmill?status.svg)](https://godoc.org/gitlab.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) ![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. `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: There are three necessary packages:
- `gitlab.codemonkeysoftware.net/b/hatmill` - `git.codemonkeysoftware.net/b/hatmill`
- `gitlab.codemonkeysoftware.net/b/hatmill/attribute` - `git.codemonkeysoftware.net/b/hatmill/attribute`
- `gitlab.codemonkeysoftware.net/b/hatmill/element` - `git.codemonkeysoftware.net/b/hatmill/element`
Install them as you would any other Go package, with `go get` or whatever. 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. with Go ≥ 1.11.
Usage 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 and `element` subpackages contain helper functions for HTML5 attributes and
elements. See the `Example` function in `hatmill_test.go`. 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 `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/*`, out what you need to know by reading `defs.json`, `internal/codegen/*`,
`attribute/*`, and `element/*`, then `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. improve the documentation.

View File

@ -1,6 +1,6 @@
package attribute package attribute
import "gitlab.codemonkeysoftware.net/b/hatmill" import "git.codemonkeysoftware.net/b/hatmill"
type AccessKeyCode rune type AccessKeyCode rune

View File

@ -1,8 +1,9 @@
package attribute_test package attribute_test
import ( import (
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
"testing" "testing"
"git.codemonkeysoftware.net/b/hatmill/attribute"
) )
func TestAccessKeyCodeString(t *testing.T) { func TestAccessKeyCodeString(t *testing.T) {

View File

@ -3,7 +3,7 @@ package attribute
import ( import (
"bytes" "bytes"
"gitlab.codemonkeysoftware.net/b/hatmill" "git.codemonkeysoftware.net/b/hatmill"
) )
type CoordsList []float32 type CoordsList []float32

View File

@ -3,7 +3,7 @@ package attribute_test
import ( import (
"testing" "testing"
"gitlab.codemonkeysoftware.net/b/hatmill/attribute" "git.codemonkeysoftware.net/b/hatmill/attribute"
) )
func TestCoordsList(t *testing.T) { func TestCoordsList(t *testing.T) {

View File

@ -1,6 +1,6 @@
package attribute package attribute
import "gitlab.codemonkeysoftware.net/b/hatmill" import "git.codemonkeysoftware.net/b/hatmill"
// CustomData creates an attribute of the form data-suffix='value'. // CustomData creates an attribute of the form data-suffix='value'.
func CustomData(suffix, value string) hatmill.Attrib { func CustomData(suffix, value string) hatmill.Attrib {

View File

@ -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! // DO NOT EDIT!
package attribute package attribute
import "gitlab.codemonkeysoftware.net/b/hatmill" import "git.codemonkeysoftware.net/b/hatmill"
// Accept creates a "accept" attribute // Accept creates a "accept" attribute
func Accept(value ...string) hatmill.Attrib { func Accept(value ...string) hatmill.Attrib {
@ -38,8 +38,8 @@ func Alt(value string) hatmill.Attrib {
} }
// Async creates a "async" attribute // Async creates a "async" attribute
func Async(b bool) hatmill.Attrib { func Async(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -64,8 +64,8 @@ func Autocomplete(value string) hatmill.Attrib {
} }
// Autofocus creates a "autofocus" attribute // Autofocus creates a "autofocus" attribute
func Autofocus(b bool) hatmill.Attrib { func Autofocus(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -74,8 +74,8 @@ func Autofocus(b bool) hatmill.Attrib {
} }
// Autoplay creates a "autoplay" attribute // Autoplay creates a "autoplay" attribute
func Autoplay(b bool) hatmill.Attrib { func Autoplay(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -92,8 +92,8 @@ func Charset(value string) hatmill.Attrib {
} }
// Checked creates a "checked" attribute // Checked creates a "checked" attribute
func Checked(b bool) hatmill.Attrib { func Checked(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -158,8 +158,8 @@ func Contextmenu(value string) hatmill.Attrib {
} }
// Controls creates a "controls" attribute // Controls creates a "controls" attribute
func Controls(b bool) hatmill.Attrib { func Controls(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -192,8 +192,8 @@ func Decoding(value string) hatmill.Attrib {
} }
// Default creates a "default" attribute // Default creates a "default" attribute
func Default(b bool) hatmill.Attrib { func Default(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -202,8 +202,8 @@ func Default(b bool) hatmill.Attrib {
} }
// Defer creates a "defer" attribute // Defer creates a "defer" attribute
func Defer(b bool) hatmill.Attrib { func Defer(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -228,8 +228,8 @@ func Dirname(value string) hatmill.Attrib {
} }
// Disabled creates a "disabled" attribute // Disabled creates a "disabled" attribute
func Disabled(b bool) hatmill.Attrib { func Disabled(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -310,8 +310,8 @@ func Height(value int) hatmill.Attrib {
} }
// Hidden creates a "hidden" attribute // Hidden creates a "hidden" attribute
func Hidden(b bool) hatmill.Attrib { func Hidden(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -360,8 +360,8 @@ func Id(value string) hatmill.Attrib {
} }
// Ismap creates a "ismap" attribute // Ismap creates a "ismap" attribute
func Ismap(b bool) hatmill.Attrib { func Ismap(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -410,8 +410,8 @@ func List(value string) hatmill.Attrib {
} }
// Loop creates a "loop" attribute // Loop creates a "loop" attribute
func Loop(b bool) hatmill.Attrib { func Loop(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -476,8 +476,8 @@ func Minlength(value int) hatmill.Attrib {
} }
// Multiple creates a "multiple" attribute // Multiple creates a "multiple" attribute
func Multiple(b bool) hatmill.Attrib { func Multiple(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -486,8 +486,8 @@ func Multiple(b bool) hatmill.Attrib {
} }
// Muted creates a "muted" attribute // Muted creates a "muted" attribute
func Muted(b bool) hatmill.Attrib { func Muted(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -504,8 +504,8 @@ func Name(value string) hatmill.Attrib {
} }
// Novalidate creates a "novalidate" attribute // Novalidate creates a "novalidate" attribute
func Novalidate(b bool) hatmill.Attrib { func Novalidate(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -514,8 +514,8 @@ func Novalidate(b bool) hatmill.Attrib {
} }
// Open creates a "open" attribute // Open creates a "open" attribute
func Open(b bool) hatmill.Attrib { func Open(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -572,8 +572,8 @@ func Preload(value string) hatmill.Attrib {
} }
// Readonly creates a "readonly" attribute // Readonly creates a "readonly" attribute
func Readonly(b bool) hatmill.Attrib { func Readonly(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -598,8 +598,8 @@ func Rel(value ...string) hatmill.Attrib {
} }
// Required creates a "required" attribute // Required creates a "required" attribute
func Required(b bool) hatmill.Attrib { func Required(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -608,8 +608,8 @@ func Required(b bool) hatmill.Attrib {
} }
// Reversed creates a "reversed" attribute // Reversed creates a "reversed" attribute
func Reversed(b bool) hatmill.Attrib { func Reversed(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{
@ -650,8 +650,8 @@ func Scope(value string) hatmill.Attrib {
} }
// Selected creates a "selected" attribute // Selected creates a "selected" attribute
func Selected(b bool) hatmill.Attrib { func Selected(showAttrib bool) hatmill.Attrib {
if !b { if !showAttrib {
return hatmill.Attrib{} return hatmill.Attrib{}
} }
return hatmill.Attrib{ return hatmill.Attrib{

View File

@ -3,7 +3,7 @@ package attribute_test
import ( import (
"testing" "testing"
"gitlab.codemonkeysoftware.net/b/hatmill/attribute" "git.codemonkeysoftware.net/b/hatmill/attribute"
) )
func TestBool(t *testing.T) { func TestBool(t *testing.T) {

View File

@ -1,7 +1,10 @@
package attribute package attribute
import "strconv" import (
import "gitlab.codemonkeysoftware.net/b/hatmill" "strconv"
"git.codemonkeysoftware.net/b/hatmill"
)
type StepValue float32 type StepValue float32

View File

@ -1,10 +1,11 @@
package attribute_test package attribute_test
import ( import (
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
"gitlab.codemonkeysoftware.net/b/hatmill/element"
"os" "os"
"testing" "testing"
"git.codemonkeysoftware.net/b/hatmill/attribute"
"git.codemonkeysoftware.net/b/hatmill/element"
) )
func TestStepValue(t *testing.T) { func TestStepValue(t *testing.T) {

View File

@ -1,8 +1,9 @@
package attribute_test package attribute_test
import ( import (
"gitlab.codemonkeysoftware.net/b/hatmill/attribute"
"testing" "testing"
"git.codemonkeysoftware.net/b/hatmill/attribute"
) )
func expectEqualStrings(t *testing.T, actual, expected string) { func expectEqualStrings(t *testing.T, actual, expected string) {

View File

@ -2,11 +2,12 @@ package hatmill_test
import ( import (
"bytes" "bytes"
h "gitlab.codemonkeysoftware.net/b/hatmill"
he "gitlab.codemonkeysoftware.net/b/hatmill/element"
"html/template" "html/template"
"io" "io"
"testing" "testing"
h "git.codemonkeysoftware.net/b/hatmill"
he "git.codemonkeysoftware.net/b/hatmill/element"
) )
type benchPerson struct { type benchPerson struct {

View File

@ -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! // DO NOT EDIT!
package element package element
import "gitlab.codemonkeysoftware.net/b/hatmill" import "git.codemonkeysoftware.net/b/hatmill"
// A creates a <a> element. // A creates a <a> element.
func A(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement { func A(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {

2
go.mod
View File

@ -1,4 +1,4 @@
module gitlab.codemonkeysoftware.net/b/hatmill module git.codemonkeysoftware.net/b/hatmill
go 1.14 go 1.14

View File

@ -11,12 +11,12 @@ import (
"testing" "testing"
"unicode" "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"
"github.com/leanovate/gopter/gen" "github.com/leanovate/gopter/gen"
"github.com/leanovate/gopter/prop" "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 { func writeToString(wt io.WriterTo) string {

View File

@ -141,12 +141,12 @@ func (spec ElemSpec) Generate() Def {
func Render(defs []Def, pkgName string) ([]byte, error) { func Render(defs []Def, pkgName string) ([]byte, error) {
buf := new(bytes.Buffer) 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! // DO NOT EDIT!
`) `)
fmt.Fprintln(buf, "package ", pkgName) 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 { for _, def := range defs {