From cbf7aa6a9d12d21d032fe679c3cd6e864bd614cd Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Wed, 20 Dec 2023 15:35:09 -0700 Subject: [PATCH] Move module to git.codemonkeysoftware.net --- README.md | 20 ++++----- attribute/accesskey.go | 2 +- attribute/accesskey_test.go | 3 +- attribute/coords.go | 2 +- attribute/coords_test.go | 2 +- attribute/customdata.go | 2 +- attribute/generated.go | 80 +++++++++++++++++------------------ attribute/generated_test.go | 2 +- attribute/step.go | 7 ++- attribute/step_test.go | 5 ++- attribute/value_types_test.go | 3 +- benchmark_test.go | 5 ++- element/generated.go | 4 +- go.mod | 2 +- hatmill_test.go | 6 +-- internal/codegen/codegen.go | 4 +- 16 files changed, 78 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 3772b60..7a158b2 100644 --- a/README.md +++ b/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. diff --git a/attribute/accesskey.go b/attribute/accesskey.go index b593de1..d2583f2 100644 --- a/attribute/accesskey.go +++ b/attribute/accesskey.go @@ -1,6 +1,6 @@ package attribute -import "gitlab.codemonkeysoftware.net/b/hatmill" +import "git.codemonkeysoftware.net/b/hatmill" type AccessKeyCode rune diff --git a/attribute/accesskey_test.go b/attribute/accesskey_test.go index b1f9f23..70eb8f6 100644 --- a/attribute/accesskey_test.go +++ b/attribute/accesskey_test.go @@ -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) { diff --git a/attribute/coords.go b/attribute/coords.go index 5c425e8..0414585 100644 --- a/attribute/coords.go +++ b/attribute/coords.go @@ -3,7 +3,7 @@ package attribute import ( "bytes" - "gitlab.codemonkeysoftware.net/b/hatmill" + "git.codemonkeysoftware.net/b/hatmill" ) type CoordsList []float32 diff --git a/attribute/coords_test.go b/attribute/coords_test.go index 5aad7bb..26614a0 100644 --- a/attribute/coords_test.go +++ b/attribute/coords_test.go @@ -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) { diff --git a/attribute/customdata.go b/attribute/customdata.go index 119660b..8b131c6 100644 --- a/attribute/customdata.go +++ b/attribute/customdata.go @@ -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 { diff --git a/attribute/generated.go b/attribute/generated.go index c94506c..369a03e 100644 --- a/attribute/generated.go +++ b/attribute/generated.go @@ -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{ diff --git a/attribute/generated_test.go b/attribute/generated_test.go index 6518918..1f3ad76 100644 --- a/attribute/generated_test.go +++ b/attribute/generated_test.go @@ -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) { diff --git a/attribute/step.go b/attribute/step.go index 5d1ea0f..f25da58 100644 --- a/attribute/step.go +++ b/attribute/step.go @@ -1,7 +1,10 @@ package attribute -import "strconv" -import "gitlab.codemonkeysoftware.net/b/hatmill" +import ( + "strconv" + + "git.codemonkeysoftware.net/b/hatmill" +) type StepValue float32 diff --git a/attribute/step_test.go b/attribute/step_test.go index a4c4a19..c9ab8e8 100644 --- a/attribute/step_test.go +++ b/attribute/step_test.go @@ -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) { diff --git a/attribute/value_types_test.go b/attribute/value_types_test.go index 1a70964..c555e62 100644 --- a/attribute/value_types_test.go +++ b/attribute/value_types_test.go @@ -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) { diff --git a/benchmark_test.go b/benchmark_test.go index 4106623..5769b98 100644 --- a/benchmark_test.go +++ b/benchmark_test.go @@ -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 { diff --git a/element/generated.go b/element/generated.go index 9a93088..7ad4159 100644 --- a/element/generated.go +++ b/element/generated.go @@ -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 element. func A(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement { diff --git a/go.mod b/go.mod index 9fd2728..8b634de 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gitlab.codemonkeysoftware.net/b/hatmill +module git.codemonkeysoftware.net/b/hatmill go 1.14 diff --git a/hatmill_test.go b/hatmill_test.go index aeabfa9..c3c85a3 100644 --- a/hatmill_test.go +++ b/hatmill_test.go @@ -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 { diff --git a/internal/codegen/codegen.go b/internal/codegen/codegen.go index 3040cbd..4283b84 100644 --- a/internal/codegen/codegen.go +++ b/internal/codegen/codegen.go @@ -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 {