Using TW after 5 year gap from TW2

118 views
Skip to first unread message

AlanBCohen

unread,
Aug 5, 2017, 7:48:11 PM8/5/17
to TiddlyWiki
Before I became disabled, I was a heavy user of some TW2 plugins; especially ForEachTiddler. For example, I created a tiddler with a name like 'journal'. The contents were a FeT that would list all the other tiddlers with the tag 'journal' with various sort and formatting. Another use was tagging journals with a progectid. In separate tiddler named the specific projectid, FeT was used to create a list of related journals (later expanded to list all the tiddler.texts as a printable diary for the projectid).
I have not been able to find a TW5 equivalent for this functionality. Can someone point me to how to accomplish this.
Once past this, there will probably be more questions.
Alan

Eric Shulman

unread,
Aug 5, 2017, 10:33:30 PM8/5/17
to TiddlyWiki
On Saturday, August 5, 2017 at 4:48:11 PM UTC-7, AlanBCohen wrote:
Before I became disabled, I was a heavy user of some TW2 plugins; especially ForEachTiddler.

The TW5 native syntax that is most like ForEachTiddler is the <$list> widget (http://tiddlywiki.com/#ListWidget).  This widget takes a "filter expression" as a parameter. The *contents* inside the <$list>...</$list> widget block are then rendered "for each tiddler" that matches the specified filter.  By default the <$list> widget automatically sets the value of <<currentTiddler>>, so that any field references within the <$list>...</$list> widget block are relative each matched title.  You can use any combination of HTML and TW WikiText to format the output within the widget block.
 
For example, I created a tiddler with a name like 'journal'. The contents were a FeT that would list all the other tiddlers with the tag 'journal' with various sort and formatting.

Something like this:
(select all tiddlers with tag="journal" and sort by modification date, newest to oldest)

<$list filter="[tag[journal]!sort[modified]]">
   
<li>
      <$link><
<currentTiddler>></$link>
   
</li>
</$list>

Another use was tagging journals with a progectid. In separate tiddler named the specific projectid, FeT was used to create a list of related journals (later expanded to list all the tiddler.texts as a printable diary for the projectid).

Something like this:
<$list filter="[tag<currentTiddler>!sort[modified]]">
   <li>
      <$link><<currentTiddler>></$link>
      (<$view field="modified" format="date" template="MMM DDth, YYYY 0hh:0mm:0ss" />)
      <blockquote><$transclude mode="block"/></blockquote>
   </li>
</$list>
 
Note that in the above example, the value of <currentTiddler> in the *filter* is DIFFERENT from the value of <<currentTiddler>> in the enclosed *content*.  Specifically, the filter syntax refers to the title of the tiddler in which the <$list> widget occurs and is used with the "tag" filter operator to select tiddlers tag with the current tiddler's title, while the content syntax refers to the title of each tiddler that is *matched* by the enclosing <$list> widget.

Also note: the filter syntax uses SINGLE brackets to delimit references, while the content syntax uses DOUBLED brackets.

enjoy,

-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

AlanBCohen

unread,
Aug 6, 2017, 3:10:36 PM8/6/17
to TiddlyWiki
Eric, Thanks for the help.
I've gotten farther.
This is what I have now:
''Tiddlers with the tag 'Journal', sorted by modified. Tiddler.text displayed on same line.''
<$list filter="[tag[Journal]sort[modified]]">
<section>
<ul>
<$link><<currentTiddler>></$link><<currentTag>> <$transclude>
</ul>
</section>
</$list>

Unfortunately <<currentTag>> is not returning any string. I also want to display each line with "|" with leading/ending "|" like the TW2 tables. A matching heading for the table would be nice. I've been reading HTML documentation unsuccessfully.
What I'd like to achieve would look like

| Title | Tags | Text |
| 2017.08.08 | Journal projectid | Bla. |

(With the heading line boldest or otherwise set apart.)
Alan

AlanBCohen

unread,
Aug 6, 2017, 4:00:52 PM8/6/17
to TiddlyWiki
Eric,
Found some more HTML docs on tables. This is closer to what I want, but the currentTiddler and currentTags in the table aren't displaying.

''Tiddlers with the tag 'Journal', sorted by modified. Tiddler.text displayed on same line.''

<table>
<tr>
<th>Title </th>
<th>Tags </th>
<th>Text </th>
</tr>


<$list filter="[tag[Journal]sort[modified]]">

<tr>
<td><<link><<currentTiddler>></td>
<td><<tiddlerTag>></td>
<rd><$transclude></td>
</tr>
</$list>
</table>

I think the remaining problems are with the referencing the current line's Tiddler fields. The old TW2 fields were referenced as tiddler.title, tiddler.tags, tiddler.text. What are the equivalent field names and syntax?

Eric Shulman

unread,
Aug 6, 2017, 4:25:20 PM8/6/17
to TiddlyWiki
1) Be careful with your syntax.
   * TW widgets have this form: <$foo>...</$foo> (i.e., matching <$...> and </$...> 
   * all widget names start with $
   * only 1 set of brackets (i.e., <$foo>.... NOT <<$foo>>)
   * handling of the content within the widget depends on the type of widget
   * if the widget does not have any content, you can use an abbreviated form: <$foo /> (note the trailing "/")

2) Within the <$list>...</$list> widget, all content is relative to the <<currentTiddler>> value.  You can refer to any field within the tiddler using the <$view> widget. To display the tags for the currentTiddler, use
   <$view field="tags"> no tags </$view>
   * the content within the <$view>...</$view> is fallback text if the specified field is missing or empty.
   * if you don't want/need fallback content, you can use the abbreviated form: <$view field="tags" />

3) Just like the <$view> widget, content within the <$transclude>...</$transclude> widget is used as a fallback if the tiddler/field does not exist.  If no tiddler is specified, the currentTiddler value is used by default.  If no field is specified, the "text" field is used by default. Thus,
   <$transclude tiddler=<<currentTiddler>> field="text"> no text </$transclude>
will display the text from the currentTiddler, or "no text" if the tiddler or field does not exist.
  * In the above example, you can omit the "tiddler" and "field" params (since they specify the defaults), and just write: <$transclude> no text </$transclude>
  * If you don't want/need fallback content, you can use the abbreviated form: <$transclude /> (again, note the trailing "/")

Here's your code, cleaned up a bit:
<table>
   
<tr>
     
<th>Title </th>
     
<th>Tags </th>
     
<th>Text </th>
   
</tr>
   <$list filter="[tag[Journal]sort[modified]]">
     
<tr>

         
<td><$link><<currentTiddler>></$link></td>
         
<td><$view field="tags"> no tags </$view></td>
         
<td><$transclude /></td>
     
</tr>
   </$list>
</table>

let me know how it goes...

Eric Shulman

unread,
Aug 6, 2017, 6:10:12 PM8/6/17
to TiddlyWiki
errata:

To display the tiddler content properly, add the mode="block" parameter to the <$transclude> widget.... otherwise, the content will all become 'inline' and will flow onto lines without regard to paragraph/line breaks, tables, bullet lists, etc.

<td><$transclude mode="block"/></td>

-e

AlanBCohen

unread,
Aug 6, 2017, 6:59:11 PM8/6/17
to TiddlyWiki
Thank you again, Eric.

AlanBCohen

unread,
Aug 6, 2017, 7:46:59 PM8/6/17
to TiddlyWiki
I used tour postings.
This is the final form.

List tiddler title, tags, and text in a table where tags include 'Journal', sorted by the modified daterime stamp.


<table>
<tr>
<th>Title </th>
<th>Tags </th>
<th>Text </th>
</tr>
<$list filter="[tag[Journal]sort[modified]]">
<tr>
<td><$link><<currentTiddler>></$link></td>
<td><$view field="tags"> no tags </$view>
</td>

<td><$view field="text"> </$view></td>
</tr>
</$list>
</table>

I consider this effort to have been a success.
Alan

Reply all
Reply to author
Forward
0 new messages