tag macro in defaultTiddlers - sort issue

276 views
Skip to first unread message

HansBKK

unread,
Jun 11, 2011, 3:04:07 PM6/11/11
to TiddlyWiki
Q1:
I'd like to have my TW's default display on loading to have a
particular tiddler at the top, followed by a set of tiddlers selected
by the presence of a tag "default". I thought the following
defaultTiddlers would work:
[[Open Journal Entries]]
[tag[default]][sort[-modified]]

However, the "sort" parameter in the second line is being applied to
the whole set, so the first entry only shows at the top if it is the
most recently edited tiddler - in practice this sorting behavior
results in this tiddler always sorting to the bottom!

A - I would suggest that this behavior be fixed,
B - ideally, defaultTiddlers could contain a list of tag macro
statements (as in #2 above) and each "section" of the resulting
display could have a separate sort order.
C - even more ideally, the list of defaultTiddlers could be generated
by Eric's fine MatchTagsPlugin, allowing for boolean logic in the tag
selection (default OR (journal AND NOT Archived)

Suggestions on how to accomplish any and/or all of the above would be
most welcome - kludgey workarounds gratefully accepted.

BTW I am in the meantime relying on a macro button using
OpenTaggedTiddlers, but I'd much rather have the desired set show up
without the user having to remember to push it on startup.

Thanks in advance.

whatever

unread,
Jun 11, 2011, 4:09:11 PM6/11/11
to TiddlyWiki
In DefaultTiddlers you can only list the tiddlers. If you want to use
a sorting/listing syntax, put it in a custom tiddler and then just
list that tiddler in the DefaultTiddlers.
For example:
Put [tag[default]][sort[-modified]] in MyDefaultTiddlers tiddler and
then put [[MyDefaultTiddlers]] in DefaultTiddlers tiddler.

w

HansBKK

unread,
Jun 12, 2011, 12:34:31 AM6/12/11
to TiddlyWiki
On Jun 12, 3:09 am, whatever <kbrezov...@gmail.com> wrote:
> In DefaultTiddlers you can only list the tiddlers. If you want to use a sorting/listing syntax, put it in a custom tiddler and then just

Sorry, but this just isn't true. Go ahead and test it yourself:

Put

[tag[journal]][sort[-modified]]

into DefaultTiddlers - it works just fine, and is a great way to make
TW act like a rudimentary blog.

And combining such a statement with the more traditional list of
tiddler also works, but as I pointed out, one isn't able to control
the ordering of the display (static listing first, then dynamically
generated list) - the tag macro's sort statement applies to all the
tiddlers retrieved.

The other difficulty is that I haven't been able to get more complex
selection criteria to work, and ideally I'd like Eric's MatchTags to
be able to work like the tag macro does regarding *actually opening* a
list of tiddlers as part of the DefaultTiddlers functionality, rather
than just displaying a list.

I realize these are two separate questions - my current workaround is
to use a "default" tag and to control the ordering by manipulating the
titles, but it's definitely a less than ideal kludge. . .

Eric Shulman

unread,
Jun 12, 2011, 1:28:34 AM6/12/11
to TiddlyWiki
> The other difficulty is that I haven't been able to get more complex
> selection criteria to work, and ideally I'd like Eric's MatchTags to
> be able to work like the tag macro does regarding *actually opening* a
> list of tiddlers as part of the DefaultTiddlers functionality, rather
> than just displaying a list.

http://www.TiddlyTools.com/#MatchTagsPlugin

In addition to defining the <<matchTags>> macro, the plugin also
extends the TWCore store.filterTiddlers() function that is used by the
[tag[...]] syntax. Thus, simply by installing the plugin, you can use
the enhanced full-boolean tag matching syntax *anywhere* that the
TWCore recognizes the [tag[...]] filter syntax, including it's use in
DefaultTiddlers.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
----------
Was this answer useful? If so, please help support TiddlyTools:

TiddlyTools direct contributions: (paypal)
http://www.TiddlyTools.com/#Donate
UnaMesa tax-deductible contributions:
http://about.unamesa.org/Participate (paypal)
TiddlyWiki consulting:
http://www.TiddlyTools.com/#ELSDesignStudios
http://www.TiddlyTools.com/#Contact

HansBKK

unread,
Jun 12, 2011, 5:05:00 AM6/12/11
to TiddlyWiki
Thanks for responding Eric, however I haven't been able to get the
syntax to work in DefaultTiddlers.

This works just fine:

[tag[journal]][sort[-modified]][limit[50]]

This returns nothing
[tag["journal AND NOT archived"]][sort[-modified]][limit[50]]

even though several of my journal tiddlers are tagged "archived"

I've also tried these:

[tag["journal" AND NOT "archived"]]
[tag["(journal AND NOT archived)"]]
[tag["[journal AND NOT archived]"]]

and several others, no go.

This is likely to have the same cause as the problem I'm having with
OpenTaggedTiddlers on which I've posted more recently:
http://groups.google.com/group/tiddlywiki/browse_thread/thread/edc74abdd796672d

Your help is greatly appreciated.

Eric Shulman

unread,
Jun 12, 2011, 6:23:52 AM6/12/11
to TiddlyWiki
> This works just fine:
> [tag[journal]][sort[-modified]][limit[50]]
>
> This returns nothing
> [tag["journal AND NOT archived"]][sort[-modified]][limit[50]]

Remove the quotes. The [tag[...]] syntax itself delimits the
expression.

[tag[journal AND NOT archived]][sort[-modified]][limit[50]]

-e

HansBKK

unread,
Jun 12, 2011, 8:44:04 AM6/12/11
to TiddlyWiki
Yes, I'd also tried that, returns zero.

Just to be sure I copied and pasted from your message and double-
checked case-sensitivity.

I'll try some other stuff as workarounds in the meantime. . .

HansBKK

unread,
Jun 12, 2011, 9:18:15 AM6/12/11
to tiddl...@googlegroups.com
Embarrassed apologies Eric, I thought I'd updated all my plugins but I must have missed this one!

I had been using v2.0.0, which was still using getTaggedTiddlers, while the current v2.0.5 switched to getMatchingTiddlers instead to allow for the boolean matching in the core tag macro.



HansBKK

unread,
Jun 15, 2011, 3:41:30 AM6/15/11
to tiddl...@googlegroups.com
For those googling this in the future, this issue:
ideally, DefaultTiddlers could contain a list of tag macro

statements (as in #2 above) and each "section" of the resulting
display could have a separate sort order.

even more ideally, the list of defaultTiddlers could be generated
by Eric's fine MatchTagsPlugin, allowing for boolean logic in the tag
selection (default OR (journal AND NOT Archived)
has been most elegantly resolved here by PMario

Note - you must delete your DefaultTiddlers tiddler first (leaving only the shadow version, which will be overwritten by the code from that thread, to be put into zzConfig or any tiddler flagged systemConfig:

var tids1 = store.getMatchingTiddlers("default","modified").reverse()
var tids2 = store.getMatchingTiddlers("journal AND NOT archived","title").reverse()

var tids = []
tids = tids.concat(tids1,tids2);

tids = tids.map(function(elem){return elem.title})
config.shadowTiddlers["DefaultTiddlers"] = '[[' + tids.join(']] [[') + ']]';


Reply all
Reply to author
Forward
0 new messages