         # values
         @loaded = no
         @loading = no
+        @extensions = {}
+        for name, ext of HTMLCompiler.extensions
+            @extensions[name] = ext
         #aliases
         @loadSync = @open
+
+    register: (name, ext) ->
+        @extensions[name] = ext
 
     read: (filename, callback) ->
         fs.readFile filename, (err, data) =>


# exports

module.exports = HTMLCompiler


{ extname } = require 'path'
{ jsonify } = require './traverse'
link = require './linker'

extensions =  # defaults
    json: (tree) ->
        JSON.stringify(tree)
    coffee: (tree) ->
        """link = require 'dt-compiler/linker'
        tree = #{JSON.stringify tree}
        module.exports = (rawtemplate) -> link rawtemplate, tree
        """
    js: (tree) ->
        """var link = require('dt-compiler/linker'),
        tree = #{JSON.stringify tree};
        module.exports = function (rawtemplate) {
            return link(rawtemplate, tree);
        };"""


class HTMLCompiler
