a quick question: Title List from a macro

36 views
Skip to first unread message

Mohammad

unread,
Dec 13, 2018, 12:51:40 PM12/13/18
to TiddlyWiki
Assume you have a macro called "mac" and it produces s line of words which should be interpreted as a Title List:


\define mac(p1,p2)
here the macro body
...
....
\end

When I call mac it produces for example

one two twenty six four fifty two

Note here twenty six AND fifty two are single titles


I want then use the output in a list widget

<$list filter=<<mac>> ...
<li><<currentTiddler>></li>

The problem is listwidget cannot distinguish twenty six or fifty two and also remove the last two

How can I enforce mac to return a Title List?

-Mohammad

Mohammad

unread,
Dec 13, 2018, 1:07:31 PM12/13/18
to TiddlyWiki
Further input:
When mac is called each of output is produced separately, so I can wrap them for example in double quotes and like that!

How can I get the mac output as Title list?
Any idea?

- Mohammad

BurningTreeC

unread,
Dec 13, 2018, 1:08:43 PM12/13/18
to TiddlyWiki
Hi @Mohammad,

depending on how your mac macro looks like, I think you should first either set a variable to the content of the macro or use a wikify widget to "display" the content of the macro as if it was rendered

now I guess that you do some listing/filtering within the mac macro, so I'd do:

<$wikify name="mylist" text="""<$macrocall $name="mac" p1="whatever your p1 is" p2="whatever your p2 is"/>""">
<$list filter="[enlist
<mylist>]" variable="myListItem">
<li><<myListItem>></li>
</$list>
</$wikify>




BurningTreeC

unread,
Dec 13, 2018, 1:14:46 PM12/13/18
to TiddlyWiki
Mohammad, note that the part that makes this work is the "enlist" filter

the "list" filter is used to list a list stored within a tiddler

the "enlist" filter is for interpreting a variable like a title list

Mohammad

unread,
Dec 13, 2018, 1:52:52 PM12/13/18
to TiddlyWiki
Hi BTC,
 To simplify the case lets assume

\define mac()
one 
two
twenty six 
four
fifty two
\end

then the problem is list/filter cannot distinguish "twenty six" as a title! See the output of your solution:

  • one
  • two
  • twenty
  • six
  • four
  • fifty

While it should return

  • one
  • two
  • twenty two
  • six
  • four
  • fifty tow


-Mohammad



BurningTreeC

unread,
Dec 13, 2018, 2:07:04 PM12/13/18
to TiddlyWiki
aha, so if twenty two is one single item, you need to notate it in [[twenty two]] syntax. this is used all over the place in tiddlywiki. titles with spaces are notated like this in lists

-Mohammad



Mohammad

unread,
Dec 13, 2018, 2:26:15 PM12/13/18
to TiddlyWiki
Thank you BTC! So I have to wrap my output into [[ ]].


-Mohammad
Reply all
Reply to author
Forward
0 new messages