I'm trying to implement a mailto: based mail-merge in TiddlyWiki and am 95% of the way there borrowing the code provided in this thread:
https://groups.google.com/forum/#!searchin/tiddlywiki/tiddlywiki$20mail$20merge|sort:relevance/tiddlywiki/wNpULbptm4w/h3He4gbGAwAJ
However, the tiddlerencoded macro there seems to omit all paragraph breaks from the tiddler containing the email message when performing URL encoding (it doesn't insert %0A, or anything else, to represent a newline in the URL-encoded string where they are in the tiddler). It's kind of hard to write a non-trivial email without using any paragraph breaks, so this is a big problem! Is there any way I can make it keep them? I don't mind editing the tiddler containing the message, but I can't find any markup that will generate a paragraph break. If I write <br> at the end of a paragraph, it puts in one newline, but I need two for a proper paragraph break, and if I put more than one <br>, TiddlyWiki renders it as an extra newline, but the URL-encoding version only includes a single %0A.
I did modify the macro a little bit, so as to allow field references within the email tiddler (basically, I just added the || before $template$). The original macro didn't include newlines either, so this doesn't seem to be the fault of my modification. Here's what I have currently:
\define tiddlerencoded(template)
<$wikify name="mytext" text="{{||$template$}}">
<$list filter="[<mytext>encodeuri[]]" variable="mywikifiedtext">
<$text text=<<mywikifiedtext>>/>
</$list>
</$wikify>
\end
Example invocation: <<tiddlerencoded EmailTemplateTest>> -- where EmailTemplateTest is any tiddler containing newlines.
I tried changing the type of EmailTemplateTest to text/plain, and that made the paragraph breaks show up properly, but then the TextReferences in it don't get replaced, which I need to be able to do.