diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | html/attributes.go | 4 | ||||
-rw-r--r-- | html/attributes_test.go | 1 | ||||
-rw-r--r-- | html/elements.go | 5 | ||||
-rw-r--r-- | html/elements_test.go | 1 |
5 files changed, 13 insertions, 1 deletions
diff --git a/README.md b/README.md index f525c3b..db6097d 100644 --- a/README.md +++ b/README.md @@ -145,10 +145,11 @@ For more complete examples, see [the examples directory](examples/). ### What's up with the specially named elements and attributes? -Unfortunately, there are five main name clashes in HTML elements and attributes, so they need an `El` or `Attr` suffix, +Unfortunately, there are six main name clashes in HTML elements and attributes, so they need an `El` or `Attr` suffix, to be able to co-exist in the same package in Go. I've chosen one or the other based on what I think is the common usage. In either case, the less-used variant also exists in the codebase: +- `cite` (`CiteEl`/`Cite`, `CiteAttr` also exists) - `data` (`DataEl`/`Data`, `DataAttr` also exists) - `form` (`Form`/`FormAttr`, `FormEl` also exists) - `label` (`Label`/`LabelAttr`, `LabelEl` also exists) diff --git a/html/attributes.go b/html/attributes.go index edaf85e..ccd1cb4 100644 --- a/html/attributes.go +++ b/html/attributes.go @@ -101,6 +101,10 @@ func Charset(v string) g.Node { return g.Attr("charset", v) } +func CiteAttr(v string) g.Node { + return g.Attr("cite", v) +} + func Class(v string) g.Node { return g.Attr("class", v) } diff --git a/html/attributes_test.go b/html/attributes_test.go index 92ce0d6..3eb0252 100644 --- a/html/attributes_test.go +++ b/html/attributes_test.go @@ -49,6 +49,7 @@ func TestSimpleAttributes(t *testing.T) { {Name: "as", Func: As}, {Name: "autocomplete", Func: AutoComplete}, {Name: "charset", Func: Charset}, + {Name: "cite", Func: CiteAttr}, {Name: "class", Func: Class}, {Name: "cols", Func: Cols}, {Name: "colspan", Func: ColSpan}, diff --git a/html/elements.go b/html/elements.go index f676462..32752ea 100644 --- a/html/elements.go +++ b/html/elements.go @@ -73,6 +73,11 @@ func Cite(children ...g.Node) g.Node { return g.El("cite", children...) } +// Deprecated: Use [Cite] instead. +func CiteEl(children ...g.Node) g.Node { + return Cite(children...) +} + func Code(children ...g.Node) g.Node { return g.El("code", children...) } diff --git a/html/elements_test.go b/html/elements_test.go index 88688f4..00639b9 100644 --- a/html/elements_test.go +++ b/html/elements_test.go @@ -45,6 +45,7 @@ func TestSimpleElements(t *testing.T) { {Name: "canvas", Func: Canvas}, {Name: "caption", Func: Caption}, {Name: "cite", Func: Cite}, + {Name: "cite", Func: CiteEl}, {Name: "code", Func: Code}, {Name: "colgroup", Func: ColGroup}, {Name: "data", Func: DataEl}, |