exports.init = function(parser) {
this.parser = parser;
// For each tag, set a matchRegExp and parse
for (var i = 0; i < myArray.length; i++) {
this.matchRegExp = new RegExp(whatever...);
}
};
...
exports.parse = function() {
// Move past the matched word
this.parser.pos = this.matchRegExp.lastIndex;
params.push(paramInfo);
return [{
...
}];
};
So I expected maybe I could call this.parse() each time through, but this just dies:
exports.init = function(parser) {
this.parser = parser;
// For each tag, set a matchRegExp and parse
for (var i = 0; i < myArray.length; i++) {
this.matchRegExp = new RegExp(whatever...);
// Parse based on the RegExp tailored for this array value
this.parse();
}
};
...
Hi all, sorry to keep posting so many questions this week.
I'm trying to write a parser that iterates through an array, and runs a regex for each value.
Use case:
- make an array of all tags
- make a RegExp to find first instance of each tag in the array
- parse to return a macro that wraps each tag in <<tag arrayValue>>
--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/da6e4662-c67d-4999-9059-3d8aa56ef85e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...
This issue has come up before in relation to automatically turning the text of references to tiddler titles to become links;
You will get the text: "I'm referencing AnotherTiddler"