Escape characters in setvars

72 views
Skip to first unread message

David Allen

unread,
Jan 11, 2016, 6:07:04 PM1/11/16
to TiddlyWiki
So I have a frustrating situation where I'm trying to make a variable using setvars but said variable, to work correctly, requires both single and double quotes to be contained in the variable.  Is there some way I can escape some of the  contained quotation marks to get this working?

David Allen

unread,
Jan 11, 2016, 6:56:57 PM1/11/16
to tiddl...@googlegroups.com
Never mind, figured out a work around.  I did _dq='"' (that's one double quote in two single quotes) and used that where I needed double quotes in the variables.
This email has been sent from a virus-free computer protected by Avast.
www.avast.com

On Mon, Jan 11, 2016 at 5:07 PM, David Allen <dvainw...@gmail.com> wrote:
So I have a frustrating situation where I'm trying to make a variable using setvars but said variable, to work correctly, requires both single and double quotes to be contained in the variable.  Is there some way I can escape some of the  contained quotation marks to get this working?

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/-Fw2LzCs5MM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@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/4b2b32e3-d041-484c-bfb4-591b1bdf11d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Allen

Tobias Beer

unread,
Jan 12, 2016, 2:18:17 AM1/12/16
to TiddlyWiki
Hi David,

Would you mind posting an example to play around with?

Best wishes,

Tobias.

David Allen

unread,
Jan 14, 2016, 2:08:45 PM1/14/16
to tiddl...@googlegroups.com
<$setvars
     _dq='"'
     _nameoutputprefix="<$macrocall $name="
     _nameoutputspecies={{Doff_Species!!species}}
     _nameoutputname={{$:/temp/genericname}}
     _nameoutputsuffix="/>"
     nameone="nameoutputname[1]"
     nametwo="nameoutputname[2]"
     namethree="nameoutputname[3]" 
     nameoutputline="nameoutputprefix dq \name_output\ dq \ species=\ nameoutputspecies \ first=\ dq nameone dq \ second=\ dq nametwo dq \ third=\ dq namethree dq nameoutputsuffix">
<<nameoutputline>>
</$setvars>

This builds a macrocall widget that can contain, if needed, both single and double quotes.  _dq is defined as a double-quote inside single quotes.  nameone, nametwo, and namethree are surrounded with the dq variable to allow single quotes inside the name if present.  Otherwise, both the macro widget and the << >> way of calling a macro would not work.
This email has been sent from a virus-free computer protected by Avast.
www.avast.com

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/-Fw2LzCs5MM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

For more options, visit https://groups.google.com/d/optout.



--
David Allen
Reply all
Reply to author
Forward
0 new messages