 					sublist = @parsePartials source
 
 					if sublist.length
-						@_makePartials partials, sublist, root, defaultEngine
-				
+						@_makePartials partials, sublist
 		
-	
-	compile : (source='', options)->
+	render : (source, context={})->  # Shortcut for @compile(source, options)()
+		do @compile source, context
+
+	compile : (source='', options={})->
+		@root = options.root if options.root
+		@ext = options.defaultEngine if options.defaultEngine
+
 		hogan = require 'hogan.js'
 		compiled = hogan.compile source
 

		return result

	
	_readFile : (file)->
		{readFileSync} = require 'fs'
		return readFileSync(file).toString() # TODO better way to read file? especially large ones.

	
	_makePartials : (partials, list, root, defaultEngine)->
		{join} = require 'path'
		{existsSync} = require 'path'

		for file in list
			sublist = []
			source = null

			if file not of partials
				filepath = join root, file

				if existsSync filepath
					source = @_readFile filepath
				else if defaultEngine and existsSync filepath+=".#{defaultEngine}"
					source = @_readFile filepath

				if source
					partials[file] = source

{join} = require 'path'
{existsSync} = require 'path'

class HulkHogan
	parsePartials : (source)->  # Return list of patial filenames in the source.
		{scan} = require 'hogan.js'
