Automatically transcluding other tiddlers into an existing tiddler

976 views
Skip to first unread message

Andy Green

unread,
Jan 14, 2012, 7:01:30 PM1/14/12
to tiddl...@googlegroups.com
I want to automatically transclude tiddlers with a specific tag into another tiddler. If I had a tiddler called "questions", I would want to automatically transclude all tiddlers with the tag "question" or "questions" into that tiddler. Is there a plugin that can accomplish this?

Måns

unread,
Jan 14, 2012, 8:16:52 PM1/14/12
to TiddlyWiki
Hi Andy
Titles(& links to tiddlers), sections, slices, fields or everything??

Titles:

<<list filter [tag[question]]>>

Sections

<<list filter [tag[question]] template:A>>
In tiddler A write:
<<view ##ExampleSection text>>

Slices

<<list filter [tag[question]] template:B>>
In tiddler B write:
<<view ::ExampleSlice text>>

Custom fields:

<<list filter [tag[question]] template:C>>
In tiddler C write:
<<view examplefield wikified>>

Standard fields

<<list filter [tag[question]] template:D>>
In tiddler D write:
<<view created date>>
<<view modified date "YYYY">>

All text + title link:

<<list filter [tag[question]] template:E>>
In tiddler E write:
<<view title link>>
<<view text wikified>>

----

A simpler (and more automatic) solution might be to insert the
TagglyTaggingPlugin into your ViewTemplate... (as discussed here:
http://groups.google.com/group/tiddlywiki/browse_thread/thread/a046c48ed696888f)

Cheers Måns Mårtensson



Eric Shulman

unread,
Jan 14, 2012, 8:17:25 PM1/14/12
to TiddlyWiki
Install this TiddlyTools plugin:
http://www.tiddlytools.com/#EmbedTiddlers
and then you can write:
<<tiddler EmbedTiddlers with: "=question">>

Note that, if you want to match both tag values ("question" and
"questions"), you can install
http://www.tiddlytools.com/#MatchTagsPlugin
which will allow you to use boolean expressions instead of just single
tag values:
<<tiddler EmbedTiddlers with: "=question OR questions">>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

----
TiddlyTools needs YOUR financial support...
Help ME to continue to help YOU...
make a generous donation today:
http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact

cflow

unread,
Jun 5, 2013, 9:54:24 PM6/5/13
to tiddl...@googlegroups.com
Hi Eric, for me, your solution is pulling the content of the tiddlers tagged "doc" but not the headings. Is there a simple solution as I think the EmbedTiddlers method is great.

cflow

unread,
Jun 5, 2013, 9:59:13 PM6/5/13
to tiddl...@googlegroups.com
Hi Måns, attempting to use your "All text + title link" option and just getting the title link. 

I have 1 tiddler called PrintTemplate which has what you suggested for "E" and one tiddler called "PrintDoc" with the filter in it.

What am I doing wrong? Does the "template:" condition require a plugin to operate or is it a standard list condition?

Eric Shulman

unread,
Jun 5, 2013, 11:41:20 PM6/5/13
to TiddlyWiki
On Jun 5, 6:54 pm, cflow <m...@tewierik.com.au> wrote:
> Hi Eric, for me, your solution is pulling the content of the tiddlers
> tagged "doc" but not the headings. Is there a simple solution as I think
> the EmbedTiddlers method is great.

EmbedTiddlers is a "transclusion" that contains javascript code. Find
this line of code within EmbedTiddlers:

for (var i=0; i<tids.length; i++)
out+='<<tiddler [['+tids[i]+']]>\>';

This is the main "workhorse" of the script. The "out+=..." portion
appends output for ONE matched tiddler at a time. Currently, the
default output looks like:
<<tiddler [[NameOfTiddler]]>>
You can change the output in any way you like. For your purposes, you
want output that looks something like:
!!NameOfTiddler
<<tiddler [[NameOfTiddler]]>>

To do this, you can change the script output code to read:
out+='!!'+tids[i]+'\n'+<<tiddler [['+tids[i]+']]>\>';
(i.e., adding "!!NameOfTiddler\n" to the front of the output)

That should do it.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

cflow

unread,
Jun 6, 2013, 12:53:14 AM6/6/13
to tiddl...@googlegroups.com
Thanks for the lightning response Eric :)

Macro failed, but I found the error. The example you supplied was missing a single quote before the "<<tiddler":
Supplied: 
out+='!!'+tids[i]+'\n'+<<tiddler [['+tids[i]+']]>\>'; 
Solution (in red): 
out+='!!'+tids[i]+'\n'+'<<tiddler [['+tids[i]+']]>\>';
and I added some minor tweaks of my own to help with spacing :)
out+='!!'+tids[i]+'\n'+'<<tiddler [['+tids[i]+']]>\>\n\n';

Works a treat.

I am currently writing a report and this gives me the ability to work in the TW, tag items for the printed version "doc", then create a "PrintVersion" tiddler with "<<tiddler EmbedTiddlers with: =doc>>".

Any idea how I can mod the javascript so that I can wrap the title in a class for independent formatting?

I tried (without success):
out+='{{docName{'+tids[i]+'}}}\n'+'<<tiddler [['+tids[i]+']]>\>\n\n'; 

cflow

unread,
Jun 6, 2013, 1:17:40 AM6/6/13
to tiddl...@googlegroups.com
Two errors I am seeing that may/may-not be resolvable.

1. The EmbedTiddlers tiddler shows no content except "$1" formatted as a h1.
2. The result of using the EmbedTiddlers in sub pages does not show in the top level EmbedTiddlers use. 
To clarify, I have an Appendix tiddler (tagged with "doc") and for each tiddler I want in the Appendix I use the tag "appendix". In the Appendix tiddler I use the EmbedTiddlers transclusion to display all items tagged "appendix". This is successful.
In my PrintVersion tiddler I use the EmbedTiddlers transclusion to display all items tagged "doc" and when I look at the Appendix displayed it has no data displayed except the heading. 

I could just stack the document build with EmbedTiddlers for "doc" then EmbedTiddlers for "appendix" if that's the simplest way, however I may want to do sub-documents in the overall document and tracking down the missing sub-docs wouldn't be easy.

On Thursday, June 6, 2013 1:41:20 PM UTC+10, Eric Shulman wrote:

cflow

unread,
Jun 6, 2013, 2:20:11 AM6/6/13
to tiddl...@googlegroups.com
Please ignore point "2", I had a typo :) now works as expected.
Reply all
Reply to author
Forward
0 new messages