Discussion:
[tw] TW5 can't pass a tiddler w/ spaces as a macro param
(too old to reply)
m***@gmail.com
2017-07-22 16:38:45 UTC
Permalink
Raw Message
I saw a similar post addressing this for $variable$ types.
My problem is that i am using <$set> w/ a filter to get the tiddler title
based on a name passed to it, which restricts me to the <<variable>> usage.

The below macro works great if the title passed is a single word such as
'Alarmed'. the modal will pop up w/ the tiddler.
If i pass a mult-word title such as "Alarmed and Dangerous" the modal will
fail.

Any suggestions much appreciated.
--Kenn


\define modal_link(title:none)
<$set name="tit" value=$title$>
<$set name="myTid" filter='[!is[system]regexp:<tit>]'>
<$button>
<$action-sendmessage $message="tm-modal" *$param=<<myTid>>*/>
<<myTid>>
</$button>
</$set>
</$set>
\end
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/fe20cc3a-69b0-4d57-9f86-d797650fd1a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
PMario
2017-07-22 17:36:23 UTC
Permalink
Raw Message
Hi,

Try this:

<$set name="tit" value="""$title$""">

see: http://tiddlywiki.com/#Macro%20Calls%20in%20WikiText

-m
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f8d983fe-255a-4c4a-92ea-0311ed41638e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Shulman
2017-07-22 17:41:30 UTC
Permalink
Raw Message
Post by m***@gmail.com
I saw a similar post addressing this for $variable$ types.
My problem is that i am using <$set> w/ a filter to get the tiddler title
based on a name passed to it, which restricts me to the <<variable>> usage.
The below macro works great if the title passed is a single word such as
'Alarmed'. the modal will pop up w/ the tiddler.
If i pass a mult-word title such as "Alarmed and Dangerous" the modal will
fail.
\define modal_link(title:none)
<$set name="tit" value=$title$>
Put quotes around $title$, like this:

<$set name="tit" value="$title$">

the $param$ syntax is a *lexical subtitution* done upon entry to the macro.
Thus, if you pass in a parameter value containing spaces (e.g., "two
words"), then the substitution, without the surrounding quotes, would be:

<$set name="tit" value=two words>

resulting in a value of tit="two", with "words" being ignored, rather than
resulting in tit="two words"
Post by m***@gmail.com
<$set name="myTid" filter='[!is[system]regexp:<tit>]'>
<$button>
<$action-sendmessage $message="tm-modal" *$param=<<myTid>>*/>
<<myTid>>
</$button>
</$set>
</$set>
\end
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/756dedb0-9d08-4c0b-afac-7a6518600161%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2017-07-23 17:38:28 UTC
Permalink
Raw Message
So I have hit another stopping block.

one of the things this modal needs to do, is pass a tiddler title that has
a transclusion in it.
I read a previous post about needing to defer the transclusion, and i
believe I have done so.. but it refuses to work.

The first call to the macro works great as i have manually typed in the
tiddler title.
The second call which uses a {{!!field}} transclusion fails.

If i remove the > from the <$action-sendmessage> (i do this a lot as a
debug step),
The HTML even loks the same between them:


* <$action-sendmessage $message="tm-modal" $param="Spell/DnD5e/Animal
Friendship" /*

Here is the code:

\define modal_link(name tiddler)
<$macrocall $name="render_modal_link" title="""$name$"""
tidd="""$tiddler$"""/>
\end

\define render_modal_link(title:none tidd:"")
<$button>
<$action-sendmessage $message="tm-modal" $param="$tidd$" />
$title$ -
</$button>
\end

<<modal_link "Animal Friendship" "Spell/DnD5e/Animal Friendship">>

<<modal_link "{{!!slot0}}" "Spell/DnD5e/{{!!slot0}}">>
Post by Eric Shulman
Post by m***@gmail.com
I saw a similar post addressing this for $variable$ types.
My problem is that i am using <$set> w/ a filter to get the tiddler
title based on a name passed to it, which restricts me to the <<variable>>
usage.
The below macro works great if the title passed is a single word such as
'Alarmed'. the modal will pop up w/ the tiddler.
If i pass a mult-word title such as "Alarmed and Dangerous" the modal
will fail.
\define modal_link(title:none)
<$set name="tit" value=$title$>
<$set name="tit" value="$title$">
the $param$ syntax is a *lexical subtitution* done upon entry to the
macro. Thus, if you pass in a parameter value containing spaces (e.g.,
"two words"), then the substitution, without the surrounding quotes, would
<$set name="tit" value=two words>
resulting in a value of tit="two", with "words" being ignored, rather than
resulting in tit="two words"
Post by m***@gmail.com
<$set name="myTid" filter='[!is[system]regexp:<tit>]'>
<$button>
<$action-sendmessage $message="tm-modal" *$param=<<myTid>>*/>
<<myTid>>
</$button>
</$set>
</$set>
\end
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/2601ab9c-6164-4eb0-95a9-b821fb449097%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2017-07-23 17:37:04 UTC
Permalink
Raw Message
So I have hit another stopping block.

one of the things this modal needs to do, is pass a tiddler title that has
a transclusion in it.
I read a previous post about needing to defer the transclusion, and i
believe I have done so.. but it refuses to work.

The first call to the macro works great as i have manually typed in the
tiddler title.
The second call which uses a {{!!field}} transclusion fails.

If i remove the > from the <$action-sendmessage> (i do this a lot as a
debug step),
The HTML even loks the same between them:


* <$action-sendmessage $message="tm-modal" $param="Spell/DnD5e/Animal
Friendship" /*

Here is the code:

\define modal_link(name tiddler)
<$macrocall $name="render_modal_link" title="""$name$"""
tidd="""$tiddler$"""/>
\end

\define render_modal_link(title:none tidd:"")
<$button>
<$action-sendmessage $message="tm-modal" $param="$tidd$" />
$title$ -
</$button>
\end

<<modal_link "Animal Friendship" "Spell/DnD5e/Animal Friendship">>

<<modal_link "{{!!slot0}}" "Spell/DnD5e/{{!!slot0}}">>
Post by m***@gmail.com
I saw a similar post addressing this for $variable$ types.
My problem is that i am using <$set> w/ a filter to get the tiddler title
based on a name passed to it, which restricts me to the <<variable>> usage.
The below macro works great if the title passed is a single word such as
'Alarmed'. the modal will pop up w/ the tiddler.
If i pass a mult-word title such as "Alarmed and Dangerous" the modal will
fail.
Any suggestions much appreciated.
--Kenn
\define modal_link(title:none)
<$set name="tit" value=$title$>
<$set name="myTid" filter='[!is[system]regexp:<tit>]'>
<$button>
<$action-sendmessage $message="tm-modal" *$param=<<myTid>>*/>
<<myTid>>
</$button>
</$set>
</$set>
\end
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/59622085-8eb9-4261-8d92-5c6373af3540%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
m***@gmail.com
2017-07-25 00:50:55 UTC
Permalink
Raw Message
Any Suggestions? Please? :)
Post by m***@gmail.com
I saw a similar post addressing this for $variable$ types.
My problem is that i am using <$set> w/ a filter to get the tiddler title
based on a name passed to it, which restricts me to the <<variable>> usage.
The below macro works great if the title passed is a single word such as
'Alarmed'. the modal will pop up w/ the tiddler.
If i pass a mult-word title such as "Alarmed and Dangerous" the modal will
fail.
Any suggestions much appreciated.
--Kenn
\define modal_link(title:none)
<$set name="tit" value=$title$>
<$set name="myTid" filter='[!is[system]regexp:<tit>]'>
<$button>
<$action-sendmessage $message="tm-modal" *$param=<<myTid>>*/>
<<myTid>>
</$button>
</$set>
</$set>
\end
--
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 post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/18bcd60b-8713-4adc-9b67-5977ffad6dc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...