> <<alias showgloss "\<\<tiddler ShowPopup with: "%0" "%1" "Click to
> show definition"\>\>">>
> |{{{<<showgloss [[glosMediaProperty]] "media property">>}}}|
> <<showgloss [[glosMediaProperty]] "media property">>|
> -------------
> But the result I get (as shown in the output for the right table
> column) makes it look like there's a problem with the quotes and
> escaping of angle brackets; this is what the output looks like:
> \<\<tiddler ShowPopup with: glosMediaProperty" media property Click to
> show definition \>\>"
Indeed. The mixing of quotes and brackets inside macro parameters can
get quite tricky.
Here's a few pointers...
First: you used double-quotes (") as delimiters surrounding the
'format' parameter value in the <<alias>> macro. As a consequence,
any instance of double-quote *within* that format value is seen as the
ending delimiter for the parameter value, rather than being used as
literal content. To work around this, there are TWO other kinds of
quotes that you can use: single-quotes (') or doubled-square-brackets
([[ and ]]). While the latter syntax is most often used within macro
parameters to surround [[Tiddler Names With Spaces]], it can also be
used in place of single- or double-quotes to surround *any* parameter
value. Thus, replacing the "%0" and "%1", you get:
<<alias showgloss "\<\<tiddler ShowPopup with: [[%0]] [[%1]] [[Click
to show definition]]\>\>">>
> I see in the http://www.tiddlytools.com/#AliasPluginInfo about the
> TiddlerSlice example that the brackets are escaped, and that class
> wrapper curly braces are used. But when I tried to put in the curly
> braces, I got an "error in macro <<alias>>" error when it rendered.
The second problem is that the <<alias>> macro doesn't actually have
any special handling for converting "backslash-quoted
characters" (e.g, \< and \>), so we need to use *evaluated parameter*
syntax so that the quoted characters wil be automatically converted by
the TW core before being passed on to the <<alias>> macro for
processing.
The macro evaluated parameter syntax *resembles* the CSS wrapper
syntax in that they both use the curly braces. However, they are
somewhat different:
CSS class wrapper:
{{classname{...wiki content...}}}
evaluated parameter:
<<macroName ... {{...javascript code...}} ...>>
Note that the CSS wrapper uses *three* curly braces (plus embedded
classname) surrounding wiki formatted content, while the evaluated
parameter syntax uses *two* curly braces, and surrounds a snippet of
javascript code. For your use case, the code is simply a quoted text
expression that, when evaluated, just removes the backslashes and
passes the result onward.
The reason for using the backslash-quoting in the first place is to
prevent the >> sequence contained in the format parameter from being
used to signal the end of the enclosing macro itself. The *opening*
sequence, <<, does *not* actually need to be quoted, since it does not
interfere with the parsing of the surrounding macro syntax. Only the
*closing* sequence, >>, needs to be backslash-quoted (i.e., \>\>) to
prevent it from prematurely terminating the macro syntax.
Putting it together with the previous 'square-bracket tweak', you
would write something like this:
<<alias showgloss {{"<<tiddler ShowPopup with: [[%0]] [[%1]] [[Click
to show definition]]\>\>"}}>>
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
----------
Was this answer useful? If so, please help support TiddlyTools:
TiddlyTools direct contributions: (paypal)
http://www.TiddlyTools.com/#Donate
UnaMesa tax-deductible contributions:
http://about.unamesa.org/Participate (paypal)
TiddlyWiki consulting:
http://www.TiddlyTools.com/#ELSDesignStudios
http://www.TiddlyTools.com/#Contact
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.