Hi Eric,
A thousand thank yous. Your solution is very neat. Gratifyingly, I came
back so soon to say that I found another way to do it also, by writing a
javascript macro to piece the html string together (I assume this works
because the whole thing is passed back into a context where wikitext
parsing is active?). Mine looked like this...
/*\
title: $:/core/modules/macros/makedownloadlink.js
type: application/javascript
module-type: macro
Macro to make a data URI download link.
<<makedownloadlink text:"Text to be used for the download uri(href)"
title:"title for download attribute" type:"text/vnd.tiddlywiki">>
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "makedownloadlink";
exports.params = [
{name: "text"},
{name: "title"},
{name: "type"}
];
/*
Run the macro
*/
exports.run = function(text,title, type) {
var theUri = $tw.utils.makeDataUri(text,type);
var theString = "<a href=\"" + theUri +"\" download=\"" + title + "\"
>{{$:/core/images/export-button}}</a>";
return theString;
};
})();
Your solution is better and was what I was trying to achieve at one point -
thank you again, I will examine it more closely in the morning to figure
out what I was doing wrong.
Regards,
Richard
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/3c938fcf-6cf9-469e-ab71-7e6b99e3b090%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.