Paul,

Just a few notes to help.

Marks suggestion is great. It is important to understand 
{{<contentTiddler>}}
Is simply not valid syntax. You are trying to use the simplified version 
before using the general version.

However a slight variation looks similar
{{{ [<contentTiddler>] }}}
The triple braces allow you to use a inline filter
 and since you want to transclude tiddler with the name
<$transclude tiddler={{{ [<contentTiddler>] }}} />
untested!

However you can be more direct 
<$transclude tiddler=<<contentTiddler>> />

However as Mark points out you can reference the field content of the 
current tiddler directly for transclusion tiddler name
<$transclude tiddler={{!!content-tiddler}}/>

Regards
Tony

On Thursday, November 28, 2019 at 10:24:55 PM UTC+11, Paul Lee wrote:
>
> I have a template for objects representing documents. I want to transclude 
> the text content of the specified document from the tiddlers for that 
> document as an object. Every document has a tiddler with various 
> information about the document. Most of this information is stored in 
> fields and output into the tiddler from the template, but I could also use 
> variables if necessary. One piece of information that will be stored in 
> either a field or a variable is the title of another tiddler, and that 
> tiddler contains the full text of the document. From the document template, 
> I need a way to transclude a tiddler in each of the child tiddlers based on 
> either a field value or a variable set in those child tiddlers.
>
> I know how to output the value of a field in a child tidder using a 
> template. The obvious first attempt doesn't work:
> {{<$view field="content-tiddler" />}}
>
> In the child tiddler, the field *content-tiddler* contains the string 
> "DemoContent", which is the exact name of the tiddler I am trying to output 
> inside of the tiddler for this object, which is the same tiddler that is 
> directly transcluding the template tiddler.
>
> Since that does not work, I tried using variables. In both the template 
> tiddler and the child tiddler, I tried setting a variable named 
> *contentTiddler* with its value as the name of the tiddler that is being 
> transcluded into the child tiddler:
>
> <$set name="contentTiddler" value="DemoContent" />
>
> Then, in the template tiddler:
> {{<contentTiddler>}}
>
> This does not work, and results in no visible effect. DemoContent is not 
> empty; I copied the Gettysburg Adress into it for testing purposes.
>
> My next attempt involves a macro, and seems to be the closest to success, 
> although it still does not work.
>
> In the template tiddler, I define a macro named *transcludeContent* with 
> its internal variable named *contentTiddler* having the default value of 
> "DemoContent":
> \define transcludeContent(contentTiddler:"DemoContent")
> Hello, world! {{$(contentTiddler)$}}
> \end
>
> I am assuming that I could override the value of contentTiddler by 
> overwriting it from within the child tiddlers using *<$set 
> name="contentTiddler" value="AnotherDocumentsText" />*, but I haven't 
> bothered to test that yet, as I haven't gotten the macro to work at all, 
> although I did try redefining *contentTiddler* from the child tiddler:
>
> <$set name="contentTiddler" value="DemoContent" />
>
>
> Then, I simply call the macro from inside the template tiddler:
>
> <<transcludeContent>>
>
> This might be close to success, although it still fails. Currently, it 
> outputs the "Hello world!" that I put in there, and then displays a 
> highlighted red error *Recursive transclusion error in transclude widget*. 
> This happens in both the template tiddler and the child tiddler.
>
> What am I missing?
>

-- 
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/1d90377d-f560-45a8-870d-e723ba588bdb%40googlegroups.com.

Reply via email to