The only cases where triple quotes are needed

In another thread, Saq kindly enlightened me that triple double-quotes """ need only be used…

when using text substitution inside of macros, or substituted attributes.

I hope to avoid mistakes for this so please help me sort out the details:

“text substitution” = exclusively inside macros when it uses $this$ and $(this)$.

…and…

“substituted attributes” refers (only) to what is described here, right? There it (only) elaborates on backticks (which I assume is what you refer to in your comment @saqimtiaz , right?). There is no explicit explanaiton around triple backtis in that doc tiddler but I assume it is to allow single backticks within the triple ones.

Does this cover all cases where triple quotes and triple backticks are needed?

I would add that I am not entirely certain that triple back ticks are actually needed unless you nest substituted attributes.

I use triple-double quotes whenever I need to delimit something that has double-quotes in it.

For example:

  • I’ve used triple double quotes to delimit an action widget that is the action for a button widget.
  • I’ve used triple double quotes to delimit the text fed to a wikify widget.
2 Likes

Another example:

<$text text="""howdy there "little" buddy"""/>

Another example:

<$button actions="""<$action-confirm $message="Howdy Buddy"/>""" >

Press me!

</$button>

So same kind of thing for any widget that has an “actions” argument.

Triple-double quotes are probably not needed for most people, unless you really like putting your code inline rather than moving it to a macro/procedure, etc.

I’ve tried to explain them here to help better understand them myself, but I’ve had very little use of them so far.

Here is an example I could see myself using:


<$let date="""<$transclude $variable=now format=' YYYY-0MM-0DD " hh12:0mm am"' />""">

…

</$let>

I have a custom editor toolbar button that wraps a block of text with triple double quotes to delimit a block of text where I want the word/line wrap honored.

  • Ask if you want it.
Something
else

"""
One line
twoline
three lines
"""

Results in

Something else

One line
twoline
three lines

It helps when passing a multiline physical address found on a website into a tiddler, and stop word wrap occurring.

  • Unlike the triple backticks it does not add a border and change the background and it still honors other wikitext markup.

On a rare occasion when I am constructing “quoted text” and need it inside a parameter I tend to use single quotes to delimit the string and even rarer both double and single quotes I use tripple quotes.

  • As a rule I use the “tripple-double quotes” as a last resort way to delimit content, such that is remains available should I need it in rare circumstances.

Although the above still holds true with the introduction of the new backtick attributes delimiting, single and tripple-backticks in attributes I use the “triple double quotes” even less, which is a good thing because it remains another method of last resort to delimit something.