Hi Yakov,

I would create a kind of IncludePluginConfig tiddler, wherein I would
have lists separated by horizontal rules under a heading called
"Filters".

Each block between horizontal rules would then contain a plain list of
either tiddlers themselves or tags which one wants to explicitly
either include or exclude, maybe with the following syntax:

TiddlerName
keep>TiddlerName
tagged>TagName
keep>tagged>TagName

So, before importing from a store you would have to parse this config
somewhat like this...

inc,ex,incTagged,exTagged=[];

stores=getConfigTiddlerSection.split('----');
for(store=0;store<stores.length;store++){
lines=stores[store].split('\n');
thestore=lines[0];
for(line=1;line<lines.length;lines++){
theline=lines[line];
keep=theline.substr(0,5).toLowerCase()=='keep>';
if(keep)theline=theline.substr(5,theline.length-5);
isTag=theline.substr(0,7).toLowerCase()=='tagged>';
if(isTag){
thetag=theline.substr(7,theline.length-7);
if(keep)incTagged.add(thetag);
else exTagged.add(thetag);
}else{
if(keep)inc.add(theline);
else ex.add(theline);
}
}
}

Now you have your arrays of tids and tags to be excluded or kept for
inclusion (overrides exclusion) and you can do with it what you want,
for example push it into some (global) array variable for later use.

some.config.path.includePluginFilters[thestore]={
inc:inc,
ex:ex,
incTagged:incTagged,
exTagged:exTagged
}

Then you can later check when importing the store, whether your
tiddler or its tags either is in the exclude or in the include array
for the store, whereas you would include a tid by default or do so
when it is in the include array or otherwise exclude it when only in
an exclude array but not in any include array.

You could also add a global include / exclude array under
some.config.path.includePluginFilters["__globals"];
which you could then apply to all included stores and not just a
particular one.

Mind you that the above code is a mere skeleton, neither tested nor
with sufficient variable declarations.

If you are really keen of providing the full deal, you could even
allow for filters like these...
field>somefield>contains>someContent
field>somefield>someOperator>comparativeValue
field>somefield>hasValue>true/false

of course also working like this:
keep>field>...

...and then also have subArrays like these:
incField, exField

With so many separators, however, I would probably split each line
like so:
def = theline.split("'>");

If you want to allow for someone to have ">" in a tiddlers title, then
you would have to use a different separator or simply make it longer,
like ">>". Or to be really flexible, define your separator as a
variable, then people can use whatever they want in their configs.

Hope that helped,

Cheers, Tobias.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to