format tiddler macro output?

37 views
Skip to first unread message

Mat

unread,
Jun 18, 2013, 8:12:35 AM6/18/13
to tiddl...@googlegroups.com
I'm hoping for some way, be it via tiddler macro or not, to transclude the text from a tiddler on the wikified format

**text\n

...but if there is no text, then "" (or nothing?) should be returned.

Thanx

<:-)

Mark S.

unread,
Jun 18, 2013, 5:50:31 PM6/18/13
to tiddl...@googlegroups.com
If you're trying to process a single line, and not use a plugin like InlineJavascriptPlugin, then what you can do is:

1) In your generating (display) tiddler, put:

<<tiddler echoTiddler with: {{
   var stuff=store.getTiddlerText('test2');
   stuff ? "**"+stuff.split("\n").join("\n**") : "" ;
}} >>


2) Create a support tiddler echoTiddler to return this result. Note that you can re-use this tiddler.

$1

3) Where it says 'test2', is where you put your tiddler with the list of objects you wanted formatted with bullets.

Note that this won't automatically update when you change the contents of 'test2'. You have to open and close the generating tiddler.


HTH
Mark

Mark S.

unread,
Jun 18, 2013, 7:19:17 PM6/18/13
to tiddl...@googlegroups.com
Take 2.

You can make it even easier to use by creating a tiddler bulletShooter with these contents:

<<tiddler echoTiddler with: {{
   var stuff=store.getTiddlerText('$1');
   stuff ? "$2"+stuff.split("\n").join("\n$2") : "" ;
}} >>



Also make the echoTiddler described previously.

Now you can call bulletShooter like this:

<<tiddler bulletShooter with: test2 '**'>>

Where test2 is the name of the tiddler with the text you want to bullet and '**' is the type of bullet to apply.

Have fun,

Mark

On Tuesday, June 18, 2013 4:12:35 AM UTC-8, Mat wrote:

Mat

unread,
Jun 19, 2013, 3:30:07 PM6/19/13
to tiddl...@googlegroups.com
A big thank you Mark S! This has actually been a problem for many years for me, but you solved it!!!

For anyone less advanced (like myself) reading this, I use this inside a forEachTiddler to list tiddlers titles but also their contents on the line below. The problem has been that no content gives an empty line rather than no line causing less-than-pretty lists. Thanks to Mark S my lists are now tight and clean!

<:-D
Reply all
Reply to author
Forward
0 new messages