Alternative to ', ", """ in editortoolbar button? [resolved]

Hi everyone

I am working on an editor toolbar button (edit-text, wrap selection) that pastes a macro. However, the parameter of the pasted macro is a tiddler title. And I am running into a roadblock.

  1. Doing either of these will mean I can’t put single quotes in the tiddler title in the macro parameter.
    prefix='<<blockdraft "'
    suffix=' / DJG2">>'
    prefix="<<blockdraft '"
    suffix=" / DJG2'>>"
  1. Doing this doesn’t work. The macro parameter " is contiguous to the """ of the prefix.
    prefix=""""<<blockdraft """"
    suffix=""" / DJG2">>"""

Is there something I can use to wrap the prefix instead of “”" or ’ so that I can use " in the macro parameter?

I decided on a workaround. I put the source at the end of the prefix (= beginning of the parameter) instead of at the beginning of the suffix (= end of the parameter). And I added a period at the end of the parameter as extra protection.

My caution is because I tried something like this not so long ago and lost 4 days work because I added an apostrophe in the parameter tiddler title and it broke the file. I mean there was no content, even when I opened the file with notepad.

prefix=""""<<blockdraft "DJG2 / """
    suffix=""".">>"""

The best method here is in my view defining a macro or variable containing the difficult strings and using the variable for the prefix and suffix etc…

  • this way the value of the parameter is delimited by << >> not any of the quotes thus can contain any of the quotes.

Remember that the code containing the edit text operation is just wiki text that provides actions to the button so you can set variables etc there.