On Saturday, July 4, 2020 at 11:40:32 PM UTC-7, Jake wrote:
First, the "triple quotes" thingy:
When substituting the $url$ macro parameter value into the iframe, there is a possibility, no matter how remote, that the $url$ value could contain double-quote characters ("). In that case, if the iframe parameter was just src="...", then the substitution would result in nested or unmatched quotes (i.e., src="
http://stuff?arg="quoted stuff"&more=123&..."), which would break the syntax since nested quotes are not handled by HTML parameters. To address this, TiddlyWiki extends the normal HTML parameter syntax to enable use of tripled double-quotes as outer delimiters so that the enclosed text can contain instances of double-quotes without breaking. Note that the same nested quotes issue can also be resolved by using single-quotes (i.e., src='...' - supported by standard HTML) or even doubled squarebrackets (i.e., src=[[...]] - another TiddlyWiki syntax extension).
Next, how to do the removeprefix/addprefix filter:
In addition to the special quote handling described above, TiddlyWiki extends the normal HTML parameter syntax to allow use of "inline filters" (the tripled curly braces stuff).
To achieve your desired results, you would write the iframe's src="..." parameter like this:
The first part of the filter simply starts with the provided url as literal text (i.e, enclosed in square brackets). Then, the removeprefix[...] filter operator is applied to that text, followed by the addprefix[...] filter operator. The end result is the desired URL text, which is then used as the value of the HTML src=... parameter. Note that the entire filter syntax is contained in a matched set of outer square brackets, which is then contained in the tripled curly braces that indicate use of an inline filter.
Using the inline filter, your macro definition would look like this: