More elegant way to freeze the current StoryRiver as transclusions in a tiddler?

Hello again,

I’m experimenting with saving the current StoryRiver as a new tiddler whose text field consists of block transclusions of all currently open tiddlers.

Conceptually, I want to end up with something like this in the new tiddler:

{{Tiddler1}}

{{Tiddler2}}

{{Tiddler3}}

Right now, I’m doing it with an action-createtiddler and a filter that builds the WikiText string:

\define save()
<$action-createtiddler
  $basetitle="newStoryRiver"
  tags="ready"
  text={{{ [list[$:/StoryList]addprefix[{{]addsuffix[}}]join[

]] }}}/>
<$action-sendmessage $message="tm-notify" $param="Done"/>
\end

<$button actions=<<save>>>
{{$:/core/images/star-filled}}
</$button>

This works! The new tiddler’s text field contains the expected sequence of {{Title}} blocks, one per tiddler currently in the StoryRiver.

However, it feels a bit “hacky” to manually glue the WikiText together with addprefix, addsuffix, and join. I’m wondering:

  • Is there a more idiomatic / elegant way in pure WikiText and action widgets to achieve this?

  • For example, some pattern using $wikify, templates, or another widget that avoids explicitly constructing the transclusion markup as a string?

  • Or is building the transclusion WikiText via a filter like this actually the recommended/normal way to do it?

Important: I am not trying to store the StoryRiver as a list field (i.e. $:/StoryList!!list). I specifically want a new tiddler where the text is readable WikiText with {{Title}} transclusions, because I want to edit or rearrange that composite tiddler later as a “document”.

Any ideas, patterns, or examples that do this in a cleaner way would be perfect.

eron

I think you have illustrated a simple way to transclude selected tiddlers in the body of another tiddler but not sure why you limit yourself by saying;

You are after all creating a tiddler for this purpose.

To capture the story you could just set a field to the value in $:/StoryList!!list, but in this case lets say you set the field “transclude-list” in the new tiddler, “end of Story” :nerd_face:

Now create a view template tiddler with the $:/tags/ViewTemplate tag and build into it the condition when field[transclude-list] ie has a value enlist it and loop through the $transclusion of each title. So you can save as many of these lists you wish.

Later you could add to this viewtemplate tiddler

  • The ability to add remove items from the list
  • Drag drop reorder
  • and many other ideas and reflect this on all tiddlers with the transclude-list

Rather than an independent list field you could assign each of the titles as tags on the new tiddler.

Why have static transclusions when you can have a dynamic list on multiple tiddlers.

Regards
Tony

This would follow my own intuition to start providing simple and functional list saving, generation, editing, sharing and use.

You would see this reflected in my flag list work

Hi Tony,

thanks a lot for your thoughtful reply and for outlining this approach.

I agree that storing the StoryRiver as a list field and rendering it via a ViewTemplate is probably the most elegant and TiddlyWiki‑native solution. I’ve started to try it out with a list field and a custom ViewTemplate. It works perfectly so far.

However it doesn’t yet fully work for my specific “text processing / further manipulation” use case, but Im sure your suggestion clearly points in the right direction … I’ll keep experimenting along these lines. I’ll report back.

Thanks again also for the inspiration and the links to your flag list work.

Best,
eron

Hello TW-Tones

just a quick follow‑up: I’ve now got a solution working based on your idea of storing the StoryRiver as a list and rendering it via a template. Combined with my existing compose/export setup it now feels much smarter and more in line with how TiddlyWiki wants to do things.

Talking about it helped! Thanks for nudging me in that direction.

Best,
eron

One more question:

Is it understandable that my non‑system tiddlers from the StoryRiver do not show up with this filter:

[list[$:/StoryList] !is[system]]

while they do show up with:

[list[$:/StoryList]]

In other words: I have only non‑system tiddlers open in the StoryRiver, but adding !is[system] makes the result empty. Am I missing something obvious? Is it, because StoryList itself is a system tiddler? – even though I’m only using its list field as the source?

Here the test code

!! w/o system tiddlers:

<$list filter="[list[$:/StoryList] !is[system]]">
  <<currentTiddler>>
</$list>

-> no output

!! with system tiddlers:

<$list filter="[list[$:/StoryList]]">
  <<currentTiddler>>
</$list>

-> regular list output

eron

Whitespace matters in filter syntax. You can put whitespace between separate filter runs, but not between the individual filter operators WITHIN a single filter run. Remove the space preceding !is[system].

<$list filter="[list[$:/StoryList]!is[system]]">

Alternatively, you could write:

<$list filter="[list[$:/StoryList]] +[!is[system]]">

-e

Right, of course – thanks, … – sorry, that makes everything fall into place. I’d completely overlooked. Much appreciated for pointing that out! Thx @EricShulman

eron