diff --git a/spec/stdlib/template/builder-spec.coffee b/spec/stdlib/template/builder-spec.coffee
index 28f1da96c..173a3bb60 100644
--- a/spec/stdlib/template/builder-spec.coffee
+++ b/spec/stdlib/template/builder-spec.coffee
@@ -20,3 +20,12 @@ fdescribe "Builder", ->
builder.tag 'li'
expect(builder.toHtml()).toBe("
")
+
+ it "can generate tags with text", ->
+ builder.tag 'div', "hello"
+ expect(builder.toHtml()).toBe("hello
")
+
+ builder.reset()
+ builder.tag 'div', 22
+ expect(builder.toHtml()).toBe("22
")
+
diff --git a/src/stdlib/template/builder.coffee b/src/stdlib/template/builder.coffee
index 41b6807cf..1677f4386 100644
--- a/src/stdlib/template/builder.coffee
+++ b/src/stdlib/template/builder.coffee
@@ -1,6 +1,7 @@
_ = require 'underscore'
OpenTag = require 'template/open-tag'
CloseTag = require 'template/close-tag'
+Text = require 'template/text'
module.exports =
class Builder
@@ -14,12 +15,15 @@ class Builder
options = @extractOptions(args)
@openTag(name)
options.content?()
+ @text(options.text) if options.text
@closeTag(name)
extractOptions: (args) ->
options = {}
for arg in args
options.content = arg if _.isFunction(arg)
+ options.text = arg if _.isString(arg)
+ options.text = arg.toString() if _.isNumber(arg)
options
openTag: (name) ->
@@ -28,6 +32,9 @@ class Builder
closeTag: (name) ->
@document.push(new CloseTag(name))
+ text: (string) ->
+ @document.push(new Text(string))
+
reset: ->
@document = []
diff --git a/src/stdlib/template/text.coffee b/src/stdlib/template/text.coffee
new file mode 100644
index 000000000..5f20e1d2e
--- /dev/null
+++ b/src/stdlib/template/text.coffee
@@ -0,0 +1,6 @@
+module.exports =
+class Text
+ constructor: (@string) ->
+
+ toHtml: -> @string
+