/*
 * grunt-markdown
 * https://github.com/treasonx/grunt-markdown
 *
 * Copyright (c) 2012 James Morrin
 * Licensed under the MIT license.
 */

module.exports = function(grunt) {
  'use strict';

  var path = require('path');

  // Internal lib.
  var markdown = require('./lib/markdown').init(grunt);

  grunt.registerMultiTask('markdown', 'compiles markdown files into html', function() {
    var destPath = this.data.dest;
    var options = this.data.options || {};
    var extension = this.data.extenstion || 'html';
    var templateFn = this.data.template || path.join(__dirname, 'template.html');
    var template = grunt.file.read(templateFn);

    grunt.file.expand({filter:'isFile'}, this.data.files).forEach(function(filepath) {

      var file = grunt.file.read(filepath);

      var html = markdown.markdown(file, options, template);
      var ext = path.extname(filepath);
      var dest = path.join(destPath, path.basename(filepath, ext) +'.'+ extension);
      grunt.file.write(dest, html);

    });

  });

};


@@ -385,16 +385,297 @@
 ion() %7B%0A
+    // check for mistyped 'extenstion' option name%0A    if (this.data.extenstion && !this.data.extension) %7B%0A      this.data.extension = this.data.extenstion;%0A      console.warn('Warning: use deprecated (mistyped) option %60extenstion%60, please use %60extension%60 instead.'.yellow);%0A    %7D%0A
     var 
@@ -701,16 +701,16 @@
 a.dest;%0A
-
     var 
@@ -744,16 +744,16 @@
  %7C%7C %7B%7D;%0A
+
     var 
@@ -776,25 +776,24 @@
 .data.extens
-t
 ion %7C%7C 'html

fix mistyped option name extenstion -> extension