From 2cdcb4fcfd31293f0e5c55e0ad38ab615c759358 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Thu, 22 May 2014 10:16:04 +0200 Subject: [PATCH] iframe parsing Fixes #33 --- plugin/lexer.js | 9 +++++++-- tests/match.html | 2 ++ tests/match.jade | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugin/lexer.js b/plugin/lexer.js index 1169d05..8543d0a 100644 --- a/plugin/lexer.js +++ b/plugin/lexer.js @@ -8,15 +8,20 @@ Lexer = Npm.require('jade').Lexer; +// XXX Remove this function when inline JavaScript expression support lands +var unwrap = function (value) { + return value && /^\(?(.+?)\)?$/.exec(value.trim())[1]; +}; + // Build-in components Lexer.prototype.builtInComponents = function () { var self = this; var tok; - var captures = /^(if|unless|else if|else|with|each) *\(?([^\n\)]*)\)?/.exec(self.input); + var captures = /^(if|unless|else if|else|with|each)\b(.*)/.exec(self.input); if (captures) { self.consume(captures[0].length); tok = self.tok('mixin', captures[1]); - tok.args = captures[2]; + tok.args = unwrap(captures[2]); return tok; } }; diff --git a/tests/match.html b/tests/match.html index 9a5cd45..e068b72 100644 --- a/tests/match.html +++ b/tests/match.html @@ -16,6 +16,8 @@ + +