Wikitext lists in Shiraz Card Plugin

238 views
Skip to first unread message

passingby

unread,
Jun 3, 2020, 3:07:35 AM6/3/20
to TiddlyWiki
Hello all,

I am trying out bootstrap cards of Shiraz plugin. I wanted a list to be passed as 'text' parameter so I thought I need to pass it via a macro call like this:

\define somelistmacro()
* item 1
* item 2
* item 3
\end

<$macrocall $name="card" text=<<somelistmacro>>/>

But the wikitext list is not being rendered. What am I doing wrong?

TonyM

unread,
Jun 3, 2020, 4:46:21 AM6/3/20
to TiddlyWiki
Passingby;

This example works for this use case by splitting the input on new line.

<$list filter="[<somelistmacro>splitregexp[\n]]" variable=item>
<$macrocall $name="card" text=<
<item>>/>
</$list>

However it seems a little odd that your list contains the * which is usually reserved until displaying the list.

If the list was tiddler titles you would possible use the enlist operator.

Regards
Tony

passingby

unread,
Jun 3, 2020, 1:53:02 PM6/3/20
to TiddlyWiki
Hello Tony,

Thank you for your solution. Really appreciate your effort. 

-passingby

TonyM

unread,
Jun 3, 2020, 7:55:38 PM6/3/20
to TiddlyWiki
Your Welcome.

Tony

scot

unread,
Dec 29, 2020, 9:54:48 AM12/29/20
to TiddlyWiki
On a similar note, I would like to use the card macro with a list of tagged items.
e.g. <$list filter="[tag[mylist]sort[title]]">

This example does not work. Can you offer any help please.

<<card
<$list filter="[tag[mylist]sort[title]]"

header:"Header"
title:<<title>>
subtitle:"subtitle"
text:"content"
footer:"footer"
width:"18rem"
class:"text-dark"

/>
>>

Scot

Mohammad Rahmani

unread,
Dec 29, 2020, 11:21:24 AM12/29/20
to tiddl...@googlegroups.com
Hi Scot,
 The way you called macro is not correct.  If you want to create a number of cards  from your tiddlers say tag with mylist do as below

<$list filter="[tag[mylist]]"><$macrocall $name="card" header="My Test Header"
title={{!!title}}
text={{!!text}}
footer={{!!footer}}
/>
</$list>


I have attached an example. Down the attached JSON and drag and drop into https://kookma.github.io/TW-Shiraz/
Open TEST.

Do not forget your title should have the required information/fields.


Best wishes
Mohammad


--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7ffc0eae-f396-4f58-adf4-7d7058c62fa8n%40googlegroups.com.
card-list-example.json

scot

unread,
Dec 29, 2020, 11:31:03 AM12/29/20
to TiddlyWiki
Hello Mohammad,
Thank you very much for the solution. It's exactly what I was after.
You make everything appear so easy - I wish Santa could have brought me your coding skills for Christmas.

Best Wishes,

Scot

Mohammad Rahmani

unread,
Dec 29, 2020, 1:45:00 PM12/29/20
to tiddl...@googlegroups.com
Hello Mohammad,
Thank you very much for the solution. It's exactly what I was after.
You make everything appear so easy - I wish Santa could have brought me your coding skills for Christmas.

Amen!
You need to love Tiddlywiki, that is it ;-)

scot

unread,
Dec 29, 2020, 3:06:39 PM12/29/20
to TiddlyWiki
Mohammad,
I do love Tiddlywiki.

If it's not too much trouble, could you answer another question.
I was trying to use cards for tasks.
I would like to add the duedate in the header like below.
<$checkbox tag="done">  <$link to={{!!title}}><$view field="duedate" format="date" template="DDD DDth MMM YYYY"/></$link> </$checkbox>

This card works, but the duedate format is 20201229. I would like Tuesday 29th December 2020

<$list filter="[tag[task]!tag[done]]"><$macrocall $name="card" header="{{!!duedate}} @ {{!!time}}"
title="{{!!object-type}} - {{!!who}}"
text="{{!!what}}<br>{{!!note}}"
footer={{!!where}}
width=18em
/>
</$list>

Thanks

Scot

Mohammad Rahmani

unread,
Dec 29, 2020, 11:19:36 PM12/29/20
to tiddl...@googlegroups.com
Scot,

I modified your own code a bit and it should work.

<$list filter="[tag[task]!tag[done]]">
 <$macrocall $name="card" 
   header="""<$checkbox tag="done">  <$link><$view field="due-date" format="date" template="DDD DDth MMM YYYY"/></$link> </$checkbox>"""  

   title="{{!!object-type}} - {{!!who}}"
   text="{{!!what}}<br>{{!!note}}"
   footer={{!!where}}
   width=18em
 />
</$list>

scot

unread,
Dec 30, 2020, 9:09:54 AM12/30/20
to TiddlyWiki
Hello Mohammad,
thanks for modifying my code, but I can't get it to work.
Here is an example tiddler. Note: It does not include the {{!!time}} in the header, maybe that would also need extra changes.
Scot
Scot.json

Mohammad Rahmani

unread,
Dec 30, 2020, 9:21:38 AM12/30/20
to tiddl...@googlegroups.com
Hi Scot,
 I cannot import the JSON you attached in your last email. Would you please check it to see you have correctly created the JSON file?


Best wishes
Mohammad


Mohammad Rahmani

unread,
Dec 30, 2020, 9:24:21 AM12/30/20
to tiddl...@googlegroups.com
See below

<$list filter="[tag[task]!tag[done]]">
 <$macrocall $name="card" 
   header="""<$checkbox tag="done">  <$link><$view field="due-date" format="date" template="DDD DDth MMM YYYY"/></$link> </$checkbox>"""  
   title="{{!!object-type}} - {{!!who}}"
   text="{{!!what}}<br>{{!!note}}"
   footer={{!!where}}
   width=18em
 />
</$list>

It uses a field due-date.

To check 
  1. goto https://kookma.github.io/TW-Shiraz/
  2. create a sample tiddler with above code
  3. create a sample task contains below fields
    1. what
    2. who
    3. where
    4. note
    5. object-type
    6. due-date
I tested again and it works fine.



Best wishes
Mohammad


On Wed, Dec 30, 2020 at 5:40 PM scot <sco...@gmail.com> wrote:

scot

unread,
Dec 30, 2020, 9:56:19 AM12/30/20
to TiddlyWiki
Thanks again Mohammad, it works a treat.
Sorry, my mistake, my tiddler had duedate rather than due-date field.

I'm not sure what's happening when I export a tiddler in json format, I keeping getting errors when I import them by dragging them onto a wiki.
JSON error:Syntax Error:Json.parse: unexpected character at line 1 column 1 of the JSON data

Best Wishes
Scot

Mohammad Rahmani

unread,
Dec 30, 2020, 1:51:31 PM12/30/20
to tiddl...@googlegroups.com
Glad it works for you!

By the way I like your idea of using cards for tasks. 
I hope I can document this or add examples in the next release of Shiraz.

Cheers
Mohammad



scot

unread,
Dec 30, 2020, 3:34:15 PM12/30/20
to TiddlyWiki
I think that would really help people get to know more about how Tiddlywiki works.
  • Using cards in addition to label templates for printing would be a good example.
  • A bootstrap example of a sheet of labels for mail merge, QR codes or equipment labels.
  • Hints and tips on various topics.

I'm sure you will have many examples of your own.
Thanks again,
Scot
Reply all
Reply to author
Forward
0 new messages