Hi, OK. ... I see. I think you had the right idea at your other post about transclusions: https://groups.google.com/g/tiddlywiki/c/uyxEH7lLngE ... Working with templates is the way the whole TW UI is built. ... all of it.
TW scales best if tiddlers are used for fragments of content that make sense on its own. Author -- Quote already makes sense on its own. So the most future-proof way to tackle the problem would be to use a tiddler for that. ... On Tuesday, April 5, 2022 at 10:16:52 AM UTC+2 [email protected] wrote: ... > Some tiddlers will have multiple quotes, so keeping the author and quote in the same field to keep things neat would be prefered. >From your last sentence in your post I guess, that that doesn't feel right for you. ... So I'll show you how to "split" your entry ... and what happens My field looks like this. ... I wouldn't use a construction like this (0) in field names. It is allowed since TW v5.2.0 ... (I know that I'm paranoid ;) ``` entry-0: author name | L orem ipsum dolor ``` ``` <$let entry="entry-0"> <$list filter="[all[current]get<entry>split[|]trim[]]" variable=element> <<element>> </$list> </$let> ``` The result will be come HTML code like this: <p> <p>author name</p> <p>L orem ipsum dolor sit amet, consectetur</p> </p> OK ... So the problem now is, that that's the wrong order. ... Now we need to fix this. .. The next problem will be formatting it to get ... <div class="author">author name</div><div class="quote"> ... </div> and so on ... and so on. It also doesn't scale very well. What if you want to add more info. eg: the author birth date, or the book title where the quote is from ... I think I could "solve it", but I would know that I would wasting my time, because it will end up in frustration. ... ---------- I know, that I don't see the big picture of your vision. But let me tell you how I would tackle that specific problem you described. I would go with a specific tiddler to collect quotes. eg: Albert Einstein ``` title: Albert Einstein entry-0: “Genius is 1% talent and 99% percent hard work...” entry-1: e = m * c^^2^^ {{||quotes-template}} ``` Then I'd create a template tiddler that is able to list all quotes, so I can show a list of all quotes if I open the Albert Einstein tiddler, as shown in the code above. The following template will list all entry-x fields. ``` title: quotes-template <$list filter="[all[current]fields[]prefix[entry]]" variable="entry"> <div class="quote"> <$transclude field=<<entry>> /> </div> <div class="author">~ {{!!title}}</div> </$list> ``` But it can't access a single entry if needed. To access a single entry I'd create a macro, that looks very similar ``` title: quote-macros tags: $:/tags/Macro \define quote(author, entry) <div class="quote"> <$transclude tiddler=<<__author__>> field=<<__entry__>> /> </div> <div class="author">~ <<__author__>></div> \end ``` The macro can be used with ``` <<quote "Albert Einstein" "entry-0">> ``` The templates can be used to list _all_ quotes. ``` {{quote-collection-tiddler-name||quotes-template}} ``` Creating all that stuff took less time, than thinking about some code for your structure, that only lead to new problems. ... I'll attach a zip-file that contains some more stuff I did play with. .. Using templates is extremely powerful. So the zip contains a second template quotes-template-ol ... which shows, that "entry-0" is a bad name. It should be "entry-1" ... It hope that helps. have fun! mario -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7620c999-0432-4e95-ae04-00aebe15118bn%40googlegroups.com.
<<attachment: quote-experiment.zip>>

