1
0
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:
Jermolene 2013-11-17 21:53:12 +00:00
parent 29c0f7156b
commit 3b35d7dfe4
2 changed files with 10 additions and 1 deletions

View File

@ -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;
}; };
/* /*

View File

@ -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 : [ ] } ] } ]
);
});
}); });
})(); })();