mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Fixed problem with greedy regexp for macrocalls
It was preventing this from working: ``` <<macro>><<bacrp>><<sdf>><<qweqwe>> ```
This commit is contained in:
parent
29c0f7156b
commit
3b35d7dfe4
@ -22,7 +22,7 @@ exports.types = {block: true};
|
|||||||
exports.init = function(parser) {
|
exports.init = function(parser) {
|
||||||
this.parser = parser;
|
this.parser = parser;
|
||||||
// Regexp to match
|
// Regexp to match
|
||||||
this.matchRegExp = /<<([^\s>]+)\s*([\s\S]*?)>>(?:\r?\n|$)/mg;
|
this.matchRegExp = /<<([^>\s]+)(?:\s*)((?:[^>]|(?:>(?!>)))*?)>>(?:\r?\n|$)/mg;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -104,6 +104,15 @@ describe("WikiText parser tests", function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should parse macro calls", function() {
|
||||||
|
expect(parse("<<john>><<paul>><<george>><<ringo>>")).toEqual(
|
||||||
|
|
||||||
|
[ { type : 'element', tag : 'p', children : [ { type : 'macrocall', name : 'john', params : [ ] }, { type : 'macrocall', name : 'paul', params : [ ] }, { type : 'macrocall', name : 'george', params : [ ] }, { type : 'macrocall', name : 'ringo', params : [ ] } ] } ]
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user