Skip to content

Commit

Permalink
this should work, but doesnt :(
Browse files Browse the repository at this point in the history
  • Loading branch information
dodo committed Oct 22, 2011
1 parent 7f84798 commit 40ec68e
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/test/template.coffee
Expand Up @@ -48,3 +48,51 @@ module.exports =
'</body>'
'</html>'
]

'layout': (æ) ->

layout = ({title}, callback) ->
new Template schema:'html5', ->
@$html ->
@$head ->
@$title title
body = @body ->
@div class:'body', ->
{ end } = this
@end = ->
body.end()
end()
callback?.call(this)

template = (data) ->
layout data, ->
end = @end
@p ->
@write data.content
@end()
end()


xml = template data =
title:'test'
content:'..'

xml.on 'end', æ.done
xml.on 'data', (tag) -> æ.equal results.shift(), tag
results = [
'<!DOCTYPE html>'
'<html>'
'<head>'
'<title>'
data.title
'</title>'
'<body>'
'<div class="body">'
'<p>'
data.content
'</p>'
'</div>'
'</body>'
'</html>'
]

0 comments on commit 40ec68e

Please sign in to comment.