On Tuesday, January 2, 2018 at 6:40:27 PM UTC-8, tobaisch wrote:
>
> Hello Eric,
> thanks.
> Your assumption is correct.
> Your code does not work for me.
> Also no error message
> Is there something else to be added instead of the "..."?
>

My apologies... I'm using MUCH more verbose in my responses.  Let me try 
again:

Using this code:
<$list filter="[all[tiddlers]nsort[]]">
   <$list filter="[all[current]removeprefix{!!nr}}">
   ...
   </$list>
</$list>
 
The outer $list widget iterates over all the tiddlers in the document, 
sorted numerically.  By default, as it iterates, it sets the value of the 
"currentTiddler" variable, so that within the outer $list, the 
"currentTiddler" is equal to each tiddler title it finds, one at a time.

The inner $list widget then operates on the current tiddler title, using 
filter syntax "all[current]", and removes the prefix (if any), based on the 
value of the "nr" field of the current tiddler.

Here's where I left out some explanation (and some important syntax too!)...

Within the body of the inner $list widget, the value of currentTiddler 
should then be a tiddler title with the number prefix removed.  However, 
there's TWO issues here that I failed to touch on:

1) If there is NO "nr" field in the current tiddler, then the 
"removeprefix" filter will return the current tiddler title, unchanged.  
This would cause matches with tiddlers that are unnumbered.  To exclude 
those tiddlers and only show tiddlers that actually have an nr value 
defined, we need to test that the "nr" field is actually present in that 
tiddler, by using the has[fieldname] filter operator, like this:

   <$list filter="[all[current]has[nr]removeprefix{!!nr}}">

2) I used "..." as a placeholder for "... and then you do more stuff with 
the matched tiddler..."  Let's assume that "more stuff" is something like 
"output a link to the matched tiddler".  To do this, you want to preserve 
access to the FULL name of the tiddler, *including* the number, so you can 
link to it.  But you also want the truncated tiddler title *without* the 
number for display purposes.  To do this, you can add a separate "variable" 
param to the <$list> widget, like this:

   <$list filter="[all[current]has[nr]removeprefix{!!nr}}" 
variable="thistiddler">

This will avoid changing the value of "currentTiddler" as set by the outer 
$list widget, and instead using "thisTiddler" to store the title with the 
prefix removed.  You can then construct a suitable $link widget output 
within the inner $list widget, using both variables accordingly... like 
this:

<$list filter="[all[tiddlers]nsort[]]">
   <$list filter="[all[current]removeprefix{!!nr}}" variable="thisTiddler">
      <li> <$link to=<<currentTiddler>>> <$text text=<<thisTiddler>>/> 
</$link> </li>
   </$list>
</$list>

Notes:
a) The <li>...</li> syntax makes the output show as a bullet point
b) The $link widget uses the value of "currentTiddler" by default, so it 
could be written as just <$link>...</$link> without the to="..." param and 
it would still work as intended
c) The $text widget ensures that the text is displayed without additional 
processing for automatic WikiWord linking (e.g., if the tiddler title is 
"0123 SomeThing", then the "SomeThing" text won't become a link to a 
"SomeThing" tiddler, but WILL be linked to the full "0123 SomeThing" title, 
based on the containing $link widget.

I hope this explanation doesn't confuse you more!

let me know how it goes...
-e

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b4d9c434-611a-4514-aac9-0a5e3fdb4e1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to