-
+require 'colors'
 util = require('util')
 util.orginspect = util.inspect
 util.inspect = require('eyes').inspector(stream: null, hexy:{format:'fours'})
+
+
 { EventEmitter } = require 'events'
+
 
 
 indent = ({level, opts:{pretty}}) ->

#########################################################################


xml = new Builder pretty:'·'

xml.on 'data', console.log

a = xml.tag('test') version:3, alt:"info", border:0
a.tag('middle')(center:yes).end()
b = a.tag('foo')(bar:'moo', border:0)


b.tag('lol').end()
c = b.tag('bar') x:2

c.end()
b.end()
a.end()
xml.end()

# html template engine



    end: () =>
        if @headers
            data = "#{indent this}#{@headers}/>"
        else
            data = "#{indent this}</#{@name}>"
        @emit 'end', data


class Builder extends EventEmitter
    constructor: (@opts = {}) ->
        @buffer = [] # for child output
        @pending = [] # no open child tag
        @opts.pretty ?= off
        @level = @opts.level ? 0

