mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
Tags can take a function for their content.
This commit is contained in:
@@ -10,10 +10,18 @@ class Builder
|
||||
toHtml: ->
|
||||
_.map(@document, (x) -> x.toHtml()).join('')
|
||||
|
||||
tag: (name) ->
|
||||
tag: (name, args...) ->
|
||||
options = @extractOptions(args)
|
||||
@openTag(name)
|
||||
options.content?()
|
||||
@closeTag(name)
|
||||
|
||||
extractOptions: (args) ->
|
||||
options = {}
|
||||
for arg in args
|
||||
options.content = arg if _.isFunction(arg)
|
||||
options
|
||||
|
||||
openTag: (name) ->
|
||||
@document.push(new OpenTag(name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user