Skip to content

Commit

Permalink
make symmetrical
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroso committed Nov 23, 2013
1 parent 7c087ea commit 882a32d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/jsmd/rewriter.js
Expand Up @@ -43,22 +43,17 @@ function Rewriter(input) {
*/

Rewriter.prototype.compile = function(fn) {
var self = this;
var buff = [];
var lexer = new Lexer;
var match = null;

lexer.lex(this.input).forEach(function(token) {
if (token.type === CODE && ~['js', 'javascript'].indexOf(token.lang)) {
buff.push(token.text);
}

match = token.type !== HTML
? null
: token.text.trim().match(/^<!--\s*js\s+([\S\s]*)-->$/);

if (match) {
buff.push(match[1]);
if (token.type === HTML) {
var match = token.text.trim().match(/^<!--\s*js\s+([\S\s]*)-->$/);
if (match) buff.push(match[1]);
}
});

Expand Down

0 comments on commit 882a32d

Please sign in to comment.