about summary refs log tree commit diff stats
path: root/html
diff options
context:
space:
mode:
authorYarden Shoham2024-08-19 13:01:33 +0300
committerGitHub2024-08-19 12:01:33 +0200
commitaade77281e640f52c1ee19d9336493d953bacc2c (patch)
tree79309bacb7b1fd88eb9208b08226269bddfe6bd4 /html
parent033f6ac3c36da0e95882d2e00b8cdd54468d3050 (diff)
downloadgomponents-aade77281e640f52c1ee19d9336493d953bacc2c.tar.lz
gomponents-aade77281e640f52c1ee19d9336493d953bacc2c.tar.zst
gomponents-aade77281e640f52c1ee19d9336493d953bacc2c.zip
Add `cite` attribute (#192)
It can appear in a `<blockquote>`.

- Closes https://github.com/maragudk/gomponents/issues/189

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Diffstat (limited to 'html')
-rw-r--r--html/attributes.go4
-rw-r--r--html/attributes_test.go1
-rw-r--r--html/elements.go5
-rw-r--r--html/elements_test.go1
4 files changed, 11 insertions, 0 deletions
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},