A closing </$list> statement and mark for user created tiddlers

I have created a viewtemplate as folllows:

<$list filter="[is[current]!is[system]!tag[Categories]!tag[_Developer]!tag[Index]!tag[Links]]" >
 * Item type: <$text text={{{ [{!!object_type}] }}}/>   
<p>
 * Date start: <$text text={{{ [{!!date_start}format:date[0DD-0MM-YYYY]] }}}/>   
<p>
* Date end: <$text text={{{ [{!!date_end}format:date[0DD-0MM-YYYY]] }}}/>   
<p>

This is a list of all items related to this item.

<<list-links filter:"[tag<currentTiddler>]+[sort[title]]">>

</$list>

This works excepr for a trailing </$list> statement as the last statement on a tiddler display

Screenshot 2024-09-12 at 15.16.16

I can leave the closing </$list> statement out of the view template and everything seems to work OK but this is odd to me, all other statements are terminated by a /> or </xxx

I only want the list-links statement to display on my data tiddlers.

Where is my understanding wrong?

Also, is there a way to detect all of my tiddlers, so no system, shadows or any other tiddler apart from ones I have added? If there is no simple way of doing so, might it not be a good idea to have a specialist marker (maybe a tag) for user created data tiddlers as part of TW core functionality?

bobj

You need to “close” the <p> tags by using <p/> instead. Also, if you want the * items to be proper bullets, you need to precede the first bullet item by a blank line, and then put the <p/> elements at the end of each bullet line, like this:

<$list filter="[is[current]!is[system]!tag[Categories]!tag[_Developer]!tag[Index]!tag[Links]]">

* Item type: <$text text={{{ [{!!object_type}] }}}/><p/>
* Date start: <$text text={{{ [{!!date_start}format:date[0DD-0MM-YYYY]] }}}/><p/>
* Date end: <$text text={{{ [{!!date_end}format:date[0DD-0MM-YYYY]] }}}/><p/>
This is a list of all items related to this item.
<<list-links filter:"[tag<currentTiddler>sort[]]">>
</$list>

enjoy,
-e

1 Like

Or, ditch the p elements altogether and use CSS:

<style>li { line-height:2em; }</style>
<$list filter="[is[current]!is[system]!tag[Categories]!tag[_Developer]!tag[Index]!tag[Links]]" >

* Item type: <$text text={{{ [{!!object_type}] }}}/>   
* Date start: <$text text={{{ [{!!date_start}format:date[0DD-0MM-YYYY]] }}}/>   
* Date end: <$text text={{{ [{!!date_end}format:date[0DD-0MM-YYYY]] }}}/>   

This is a list of all items related to this item.

<<list-links filter:"[tag<currentTiddler>]+[sort[title]]">>

</$list>

This will affect all li elements, everywhere in the TiddlyWiki! To address this:

  • wrap the output in a unique custom class
  • add specificity to the style definition

Like this:

<div class="myFooterClass">
<style>.myFooterClass li { line-height:2em; }</style>
...

-e

Thank you everyone who replied, I am most grateful for your suggestions.

One thing still I don’t understand, the semantics behind the all and is operators.

If I do not have the is statement, it seems that any tiddler I open even ones having tabs I specificaly negate for, appear to be affected by the view template specification. In my niaivity, I would expect only those tiddlers recalled by the $list statement would be affected but certainly tiddlers beginning $:/ (ie system tiddlers) are also.

As the processing is going through the retrieved list, I would have expected the tiddler being currently processed to be the current tiddler and so the is[current] statement would seem superfluous.

Similarly, all[current] seems redundant because the only tiddlers being processed are the ones retrieved by the $list statement.

I am obviously missing something (else).

Bobj

all[current] is equivalent to <currentTiddler>.

is[current] is normally used within a filter, following some other filter syntax. It tests each “input” value, and is equivalent to match<currentTiddler>.

However, when is[current] occurs at the beginning of a filter, there are no “input” values to test, so it gets handled as a special case and is equivalent to all[current].

So, in your specific use-case, you could use is[current], or all[current] or <currentTiddler> and they all will produce the exact same filter result.

Since your use-case is a ViewTemplate, the initial filter is intended to test the <currentTiddler> and allow the rest of the template content to be rendered only when it meets the filter criteria. For this purpose, I always use <currentTiddler> rather than is[current] or all[current]. I feel that it is more semantically apparent as to what it means, and is also ever so slightly more efficient in processing overhead.

Thus, the filter I would use is:

<$list filter="[<currentTiddler>!is[system]!tag[Categories]!tag[_Developer]!tag[Index]!tag[Links]]">

which can be read as:

If the current tiddler is not a system tiddler and also is not tagged with “Catagories”, “_Developer”, “Index”, or “Links”, then render the rest of this ViewTemplate.

I hope that makes things a bit clearer…

-e

2 Likes

yes it does, @EricShulman , thank you for taking the time.