The eMailMacro could be extended with an optional parameter for
specifying a target tiddler (instead of using the originating tiddler).
However, to be quite frank, I don't really feel like looking into that
right now - especially because there's a workaround (see below).
> At the moment I'm sending email links with the <<email [to: blah]>>
> content included, and it looks a bit embarrassing!
Oddly enough, on my machine here (using Firefox and Thunderbid on
Windows XP), such macro calls show up only as "< >" in the output.
I'm not entirely sure why that happens (and not sure I care... ).
> tweak the plugin code so that the stored tiddler source can be
> filtered before constructing the "mailto:" URI output to remove any
> embedded occurences of the <<email>> macro.
That's a nice idea, Eric - done (updating the macro to v0.95):
http://devpad.tiddlyspot.com/#eMailMacro
Please let me know whether that works for you, Ben.
-- F.
First, I've renamed the new parameter from "hideMacro" to "filterMacro"
(I guess that's more appropriate).
Second:
> Oddly enough, on my machine here (using Firefox and Thunderbid on
> Windows XP), such macro calls show up only as "< >" in the output.
> I'm not entirely sure why that happens (and not sure I care... ).
Okay, so I did care - at least a bit. A quick Google search led me to
this blog posting:
http://tinyurl.com/2w8j4s
(http://lunarmedia.com/blogs/lunarmedia_blog/archive/2006/10/23/120405.aspx)
I've updated the macro to use that function - now the output contains
the macro calls on my setup as well (provided I don't specify the
filterMacro parameter, of course).
Let's hope this didn't ruin anything in the process (the whole escaping
business is not exactly my specialty)...
-- F.
var label = getParam(prms, "label") || "e-mail";
var tooltip = getParam(prms, "tooltip") || "e-mail this tiddler";
var btnClass = getParam(prms, "class") || "button";
//get the title of the tiddler with the text or take title of currently tiddler
var tiddlerTitle = getParam(prms, "tiddler") || tiddler.title;
//get the text of the tiddler
var tiddlerText = store.getTiddler(tiddlerTitle).text;
var msgTo = getParam(prms, "to");
var msgCC = getParam(prms, "cc");
var msgBCC = getParam(prms, "bcc");
var msgSubject = getParam(prms, "subject");
var filterMacro = getParam(prms, "filterMacro");
// retrieve tiddler contents
if(!msgSubject) {
msgSubject = entitify(escape(tiddler.title));
}
var msgBody = (filterMacro == "true") ?
tiddlerText.replace(/\<\<email(.*|\n)?\>\>/gi, "") : tiddlerText;
I have also added a default limit (500) for the number of characters
returned from the tiddler body, as well as a parameter to override that
limit.
This is required because there are limits to how long a mailto link may
be. The exact number probably depends on the combination of browser and
e-mail client - so if anyone has some insight on that issue, please let
me know so I can adjust the default limit.
Get v0.96 here:
http://devpad.tiddlyspot.com/#eMailMacro
-- F.
I think if the URL length is limited so[1], you can add some more characters.
Thanks; I've raised the limit for to 2000 - and that limit now pertains
to the entire message string (including subject and recipients, though
not the "mailto:" part).
Thanks for the info!
-- F.
I know we've solved this issue via Twitter already - so let's recap:
The problem was my confusing documentation of the macro's parameters,
which led Ben to believe that parameters should to be enclosed in
[single brackets].
Generally, there are four ways to use macro parameters:
* no enclosing: <<foo bar baz>>
* single quotes: <<foo 'bar' 'baz'>>
* double quotes: <<foo "bar" "baz">>
* double brackets: <<foo [[bar]] [[baz]]>>
There's also fifth way, using {{curly brackets}} - those contents are
evaluated though, so they're only used if the parameter value has to be
calculated in some way.
I've updated the wiki with this information:
http://www.tiddlywiki.org/wiki/Macros#Parameters
Feel free to polish these descriptions...
-- F.