On Friday, May 8, 2015 at 3:39:17 PM UTC-4, Mat wrote:

> @Mike
>
> http://eucaly-tw5.tiddlyspot.com/ 
>> <http://www.google.com/url?q=http%3A%2F%2Feucaly-tw5.tiddlyspot.com%2F&sa=D&sntz=1&usg=AFQjCNGQxnHJamYuy0-LASNO_OuvD1YBMw>
>>
>> As soon as you drag over $:/core/modules/filters/match.js ,save and 
>> refresh, those tiddlers that I gave earlier should work.
>>
>
>
> Can't get this to work. I set up http://match.tiddlyspot.com/ if you 
> could perhaps tell if I'm misunderstanding something. BTW, are you using 
> the lastest TW version? I believe that this plugin was written before they 
> implemented change in some parameter(?) name from "tw-" to "tc-", "tv-" or 
> whatever it is (anyone who knows what I'm talking about? I don't.) Anyway, 
> that change made many plugins not work in the updated TW's so is your TW 
> using the match filter perhaps also not updated?
>
> Thank you!
>
> <:-)
>

I looked at the version of match.js that you have and it didn't match mine 
... there appears to be two floating around. The one that I have has the 
line "140823: reloaded for 5.0.15-beta" in the header.
It can be found attached to a message here:

https://groups.google.com/forum/#%21topic/tiddlywikidev/4ciJxJVAsY8

pointed to by the thread here:

https://groups.google.com/forum/#!topic/tiddlywiki/et79cGcwFLk

I have no idea why the one on eucaly's site doesn't work but it is 
significantly different and looks like an earlier version. Sorry for the 
wrong pointer. I thought that I confirmed to see if it worked in a new 
empty tiddlywiki but I guess my check was flawed in some way.

I just cut and pasted the version pointed to above into your example 
tiddler and it works. Here is the match.js that works for me from the links 
above.

/*\
title: $:/core/modules/filters/match.js
type: application/javascript
module-type: filteroperator

Filter operator for picking parts out of fields using regular expressions

140823: reloaded for 5.0.15-beta

\*/
(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Export our filter function
*/
exports.match = function(source,operator,options) {
        var results = [],
                fieldname = (operator.suffix || operator.operator || 
"title").toLowerCase();
        if(operator.prefix === "!") {
                if(operator.regexp) {
                        source(function(tiddler,title) {
                                if(tiddler) {
                                        var text = 
tiddler.getFieldString(fieldname);
                                        if(text !== null && 
!operator.regexp.exec(text)) {
                                                results.push(title);
                                        }
                                }
                        });
                } else {
                        source(function(tiddler,title) {
                                if(tiddler) {
                                        var text = 
tiddler.getFieldString(fieldname);
                                        if(text !== null && text !== 
operator.operand) {
                                                results.push(title);
                                        }
                                }
                        });
                }
        } else {
                if(operator.regexp) {
                        source(function(tiddler,title) {
                                if(tiddler) {
                                        var text = 
tiddler.getFieldString(fieldname);
                                        if(text !== null) {
var matches = [],
        execresult = operator.regexp.exec(text);
while(execresult) {
     if(execresult.length > 1) { // there were brackets
          matches= matches.concat(execresult.slice(1));
     }
     else { // no brackets - take the full match
          matches.push(execresult[0]);
     }
     if(operator.regexp.lastIndex === 0) { // no g-switch
          break;
     }
     execresult = operator.regexp.exec(text);
}                                       
if(matches) {
    $tw.utils.pushTop(results,matches);
}
                                        }
                                }
                        });
                } else {
                        source(function(tiddler,title) {
                                if(tiddler) {
                                        var text = 
tiddler.getFieldString(fieldname);
                                        if(text !== null){
var incr = operator.operand.length;
if(incr === 0) { // empty operand
     return;
}
var matches = [],
        pos = text.indexOf(operator.operand);
while(pos >= 0) {
     matches.push(operator.operand);
     pos = text.indexOf(operator.operand, pos+incr);
}
if(matches) {
    $tw.utils.pushTop(results,matches);
}
                                        }
                                }
                        });
                }
        }
        return results;
};

})();

 

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/58424aee-0c6d-470f-a644-aea1bb98bcd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to