Skip to content
Browse files

Added handle bars plugin. Fixed cleanurls tests. Fixed some bad packa…

…ge.json files. Added npm install and make compile to test runner
  • Loading branch information...
1 parent 089a516 commit 163b4a47b2485556c47a63a35944e159eddf6803 @balupton balupton committed Jun 22, 2012
Showing with 62 additions and 57 deletions.
  1. +3 −0 History.md
  2. +9 −0 LICENSE.txt
  3. +11 −13 package.json
  4. +33 −38 src/handlebars.plugin.coffee
  5. +6 −6 test/docpad.cson
View
3 History.md
@@ -1,4 +1,7 @@
## History
+- v2.0.0 June 22, 2012
+ - Cleaning
+
- v1.0.0 June 14, 2012
- Initial version of Handlebars plugin
View
9 LICENSE.txt
@@ -0,0 +1,9 @@
+(The MIT License)
+
+Copyright (c) 2012 Mike Moulton <mike@meltmedia.com> (http://meltmedia.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
24 package.json
@@ -12,33 +12,31 @@
"render",
"rendering"
],
- "author": {
- "name": "Mike Moulton",
- "email": "mike@meltmedia.com",
- "url": "http://meltmedia.com"
- },
+ "author": "Mike Moulton <mike@meltmedia.com> (http://meltmedia.com)",
+ "maintainers": [
+ "Mike Moulton <mike@meltmedia.com> (http://meltmedia.com)",
+ "Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
+ ],
+ "contributors": [
+ "Mike Moulton <mike@meltmedia.com> (http://meltmedia.com)",
+ "Benjamin Lupton <b@lupton.cc> (http://balupton.com)"
+ ],
"bugs": {
"url": "https://github.com/bevry/docpad-extras/issues"
},
"repository" : {
"type": "git",
"url": "http://github.com/bevry/docpad-extras.git"
},
- "licenses": [
- {
- "type": "MIT",
- "url": "http://creativecommons.org/licenses/MIT/"
- }
- ],
"dependencies": {
- "handlebars": ">= 1.0.5beta"
+ "handlebars": "1.0.x"
},
"devDependencies": {
"coffee-script": "1.3.x"
},
"engines" : {
"node": ">=0.4.0",
- "docpad": "6.x"
+ "docpad": "6.x"
},
"main": "./out/handlebars.plugin.js",
"scripts": {
View
71 src/handlebars.plugin.coffee
@@ -1,40 +1,35 @@
module.exports = (BasePlugin) ->
- # Define Plugin
- class HandlebarsPlugin extends BasePlugin
-
- # Plugin name
- name: 'handlebars'
-
- # Plugin priority
- priority: 725
-
- # Handlebars
- Handlebars: null
-
- # Constructor
- constructor: ->
- super
- docpad = @docpad
- config = @config
-
- Handlebars = @Handlebars = require 'handlebars'
-
- # Add helpers, if defined in docpad.cson
- if @config.helpers
- Handlebars.registerHelper(name, helper) for name, helper of @config.helpers
-
- # Render some content
- render: (opts, next) ->
- # Prepare
- {inExtension,outExtension,templateData,file,content} = opts
- Handlebars = @Handlebars
-
- try
- if inExtension in ['hb', 'hbs', 'handlebars']
- opts.content = Handlebars.compile(content)(templateData)
-
- return next()
-
- catch err
- return next(err)
+ # Define Plugin
+ class HandlebarsPlugin extends BasePlugin
+
+ # Plugin name
+ name: 'handlebars'
+
+ # Plugin priority
+ priority: 725
+
+ # Handlebars
+ handlebars: null
+
+ # Constructor
+ constructor: ->
+ # Prepare
+ super
+ docpad = @docpad
+ config = @config
+ handlebars = @handlebars = require('handlebars')
+
+ # Add helpers, if defined in docpad.cson
+ if @config.helpers
+ for own name,helper of @config.helpers
+ handlebars.registerHelper(name, helper)
+
+ # Render some content
+ render: (opts) ->
+ # Prepare
+ {inExtension,outExtension,templateData,file,content} = opts
+ handlebars = @handlebars
+
+ if inExtension in ['hb', 'hbs', 'handlebars']
+ opts.content = handlebars.compile(content)(templateData)
View
12 test/docpad.cson
@@ -1,7 +1,7 @@
{
- plugins:
- handlebars:
- helpers:
- helperTest: () ->
- output = "Testing Helpers"
-}
+ plugins:
+ handlebars:
+ helpers:
+ helperTest: () ->
+ output = "Testing Helpers"
+}

0 comments on commit 163b4a4

Please sign in to comment.
Something went wrong with that request. Please try again.