Permalink
Browse files

Push to 3.2.0

Fixed newline bug in parser for attributes and parameter lists (closes #155)
Added some new tests
Removed horrible hack for Meteor smart package thanks to Meteor 0.6 improvements (closes #144) (closes #161)
Removed some hacks in NPM postinstall script that were previously needed for Meteor support
  • Loading branch information...
1 parent 2fdf96b commit 1ea24e7635691240061694ef8ed0111176c5ed87 @bminer committed Apr 8, 2013
@@ -225,10 +225,10 @@ attributes "attribute list" =
"()" {return {};}
/
"("
- newline* whitespace*
+ newline_token* whitespace*
first_attr:attribute
- next_attrs: (attribute_separator newline* whitespace* attr:attribute {return attr;})*
- newline* whitespace*
+ next_attrs: (attribute_separator newline_token* whitespace* attr:attribute {return attr;})*
+ newline_token* whitespace*
")"
{
var attrs = {};
@@ -346,11 +346,11 @@ parameters "parameter list" =
"()" {return [];}
/
"("
- newline* whitespace*
+ newline_token* whitespace*
first_param:identifier
/* attribute_separator was used for flexibility, but I suppose commas could be used, too */
- next_params:(attribute_separator newline* whitespace* param:identifier {return param;})*
- newline* whitespace*
+ next_params:(attribute_separator newline_token* whitespace* param:identifier {return param;})*
+ newline_token* whitespace*
")"
{return [first_param].concat(next_params);}
@@ -520,7 +520,11 @@ text_until_eol "some text before the end of the line" =
//Will reset the `indent` global variable
//Note: Only Linux and Windows line feeds are supported; Old Mac-style "\r" is not a newline
newline "newline" =
- "\r" ? "\n" {indent = 0;}
+ newline_token {indent = 0;}
+
+//Will not reset the `indent` global variable
+newline_token "newline" =
+ "\r" ? "\n"
//Will update `indent` global variable and return the # of indents
indents "indents" =
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,45 +1,12 @@
-//Hopefully, sometime soon I'll be able to get rid of this horrible hack...
-function requireHack() {
- var blade;
- function requireBlade(path, requireFunc) {
- if(blade) return;
- if(!requireFunc) requireFunc = require;
- try {
- blade = requireFunc(path);
- } catch(e) {}
- };
- requireBlade("blade");
- //It's likely that `__meteor_bootstrap__` will go away
- if(global.__meteor_bootstrap__)
- {
- requireBlade("blade", global.__meteor_bootstrap__.require);
- requireBlade("../", global.__meteor_bootstrap__.require);
- }
- // This block is for the core Meteor-installed package.
- // We actually have to give paths relative to
- // app/lib/packages.js, since that's who's evaling us.
- requireBlade("../../packages/blade/node_modules/blade");
- //The following lines should handle the Meteorite-installed package.
- requireBlade(process.cwd() + "/.meteor/meteorite/packages/blade/node_modules/blade");
- requireBlade(process.cwd() + "/../");
- requireBlade("../");
- return blade;
-}
-//-- end of horrible hack
-
Package.describe({
summary: "Blade - HTML Template Compiler, inspired by Jade & Haml"
});
-if(global.Npm)
- Npm.depends({"blade": ">=3"});
+Npm.depends({"blade": ">=3"});
Package.register_extension("blade", function(bundle, srcPath, servePath, where) {
- var path, blade;
- if(global.Npm)
- path = Npm.require("path"), blade = Npm.require("blade");
- else
- path = require("path"), blade = requireHack();
+ var path = Npm.require("path"),
+ blade = Npm.require("blade");
if(where !== "client") return; //get outta here, yo!
//The template name does not contain ".blade" file extension or a beginning "/"
var templateName = path.dirname(servePath).substr(1);
View
@@ -15,7 +15,7 @@
"live binding",
"meteor"
],
- "version": "3.1.0",
+ "version": "3.2.0",
"homepage": "https://github.com/bminer/node-blade",
"repository": {
"type": "git",
View
@@ -4,11 +4,6 @@ I'm hoping that I can get rid of this script someday... */
var fs = require('fs');
if(!fs.existsSync)
fs.existsSync = require('path').existsSync; //Node 0.6 compatibility
-if(!fs.existsSync("./meteor/node_modules") )
- fs.mkdirSync("./meteor/node_modules");
-//bash: [ -h ./meteor/node_modules/blade ] || ln -s ../.. ./meteor/node_modules/blade
-if(!fs.existsSync("./meteor/node_modules/blade") )
- fs.symlink("../..", "./meteor/node_modules/blade");
//bash: [ -h ./meteor/runtime.js ] || ln -s ../lib/runtime.js ./meteor/runtime.js
if(!fs.existsSync("./meteor/runtime.js") )
fs.symlink("../lib/runtime.js", "./meteor/runtime.js");
View
@@ -3,7 +3,7 @@
"author": "Blake Miner <miner.blake@gmail.com> (http://www.blakeminer.com/)",
"description": "Blade - HTML Template Compiler, inspired by Jade & Haml",
"homepage": "https://github.com/bminer/node-blade",
- "version": "3.1.0",
+ "version": "3.2.0",
"git": "https://github.com/bminer/node-blade.git",
"packages": {
}
@@ -0,0 +1 @@
+<div><div aaa="a" bbb="b"></div><div>ccc</div></div>
@@ -0,0 +1,6 @@
+div
+ div(
+ aaa='a'
+ bbb='b'
+ )
+ div ccc

0 comments on commit 1ea24e7

Please sign in to comment.