Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
iframe parsing
Browse files Browse the repository at this point in the history
Fixes #33
  • Loading branch information
mquandalle committed May 22, 2014
1 parent c993807 commit 2cdcb4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugin/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};
Expand Down
2 changes: 2 additions & 0 deletions tests/match.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

<template name="match-html-inlineBracketsTags"><div>styling <span><span>tags</span></span></div></template>

<template name="match-html-iframe"><iframe width="13" height="37"></iframe></template>

<template name="match-html-justText">Hello world</template>

<template name="match-html-multipleChildren"><p>Hello
Expand Down
3 changes: 3 additions & 0 deletions tests/match.jade
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ template(name="match-jade-inlineColonTags")
template(name="match-jade-inlineBracketsTags")
div styling #[span #[span tags]]

template(name="match-jade-iframe")
iframe(width="13" height="37")

template(name="match-jade-justText-1")
| Hello world

Expand Down

0 comments on commit 2cdcb4f

Please sign in to comment.