 	# The relative base of our source file (no extension)
 	relativeBase: null
 
+
+	# ---------------------------------
+	# Content variables
+
+	# The contents of the file, includes the the meta data (header) and the content (body)
+	data: null
+
+	# The file meta data (header) in string format before it has been parsed
+	header: null
+
+	# The parser to use for the file's meta data (header)
+	parser: null
+
+	# The parsed file meta data (header)
+	meta: {}
+
+	# The file content (body) before rendering, excludes the meta data (header)
+	body: null
+
+	# The file content (body) during rendering, represents the current state of the content
 	content: null
-	contentSrc: null
-	contentRaw: null
-	contentRendered: null
-	fileMeta: {}
-	fileHead: null
-	fileBody: null
-	fileHeadParser: null
+
+	# Have we been rendered yet?
+	rendered: false
+
+	# The rendered content (after it has been wrapped in the layouts)
+	contentRendered: false
+
+	# The rendered content (before being passed through the layouts)
+	contentRenderedWithoutLayouts: null
+
+	# The stages of the content rendering
+	# [{layout:String,content:String,extension:String}]
+	contentRenderings: []
+
+	# The stages of the content rendering indexed by the layout
+	# layoutName: {[content:String,extension:String]}
+	contentRenderingsByLayout: {}
 
 
 	# ---------------------------------

	# The unique document identifier
	id: null
	
	# The filename without the extension
	basename: null

	# The filename with the extension
	filename: null

	# The extensions the filename has, in reverse order (.md.eco -> [eco,md])
	extensions: []

	# The original first extension (.md.eco -> eco)
	extension: null

	# The final extension used on our rendered file (takes into accounts layouts)
	extensionRendered: null

	# The full path of our file, only necessary is calling @load
	fullPath: null

	# The final rendered path of our file 
	outPath: null

	# The relative path of our source file (with extensions)

	# next(err)
	write: (next) ->
		# Prepare
		fullPath = @fullPath
		js2coffee = require('js2coffee/lib/js2coffee.coffee')  unless js2coffee
		
		# Log
		@logger.log 'debug', "Writing the file #{filePath}"

		# Prepare data
		header = 'var a = '+JSON.stringify(@meta)
		header = js2coffee.build(header).replace(/a =\s+|^  /mg,'')
		body = @body.replace(/^\s+/,'')
		data = "### #{@parser}\n#{header}\n###\n\n#{body}"

		# Apply
		@header = header
		@body = body
		@data = data

		# Write data
		fs.writeFile @fullPath, @data, (err) =>
			return next?(err)  if err
			
			# Log
			@logger.log 'info', "Wrote the file #{fullPath}"

			# Next
			next?()
