diff --git a/htmlgetterfunc.go b/htmlgetterfunc.go
new file mode 100644
index 0000000..c270141
--- /dev/null
+++ b/htmlgetterfunc.go
@@ -0,0 +1,16 @@
+package jaws
+
+import "html/template"
+
+type htmlGetterFunc struct {
+ fn func(*Element) template.HTML
+}
+
+func (g htmlGetterFunc) JawsGetHtml(e *Element) template.HTML {
+ return g.fn(e)
+}
+
+// HtmlGetterFunc wraps a function and returns a HtmlGetter.
+func HtmlGetterFunc(fn func(*Element) template.HTML) HtmlGetter {
+ return htmlGetterFunc{fn: fn}
+}
diff --git a/htmlgetterfunc_test.go b/htmlgetterfunc_test.go
new file mode 100644
index 0000000..1fa3e78
--- /dev/null
+++ b/htmlgetterfunc_test.go
@@ -0,0 +1,15 @@
+package jaws
+
+import (
+ "html/template"
+ "testing"
+)
+
+func TestHtmlGetterFunc(t *testing.T) {
+ hg := HtmlGetterFunc(func(e *Element) template.HTML {
+ return "foo"
+ })
+ if s := hg.JawsGetHtml(nil); s != "foo" {
+ t.Error(s)
+ }
+}