Hi again Mat,

I think I did it. I put it in a dropbox wiki for you to look 
at: https://dl.dropboxusercontent.com/u/83055414/prettifylinkexample.html

I cloned one of the existing macros so that it had the right type  and 
module type and then fudged my way through it. The only vexing part was 
having to reload the wiki each time to see if it worked - I assume there 
must be a better way to do that.

The code looks like this (comments and criticism gladly accepted);

/*\
title: $:/RS/macros/prettifypath.js
type: application/javascript
module-type: macro

Resolves a relative path for an absolute rootpath.

>
> \*/
> (function(){/*jslint node: true, browser: true */
> /*global $tw: false */
> "use strict";exports.name = "prettifypath";exports.params = [
>       {name: "path"},
> ];/*
> Run the macro
> */
> exports.run = function(path) {
>         var arrayOfStrings = path.split("/");
>         var returnValue = "[[#" + arrayOfStrings[arrayOfStrings.length-1] + 
> "|" + path  + "]]";
>         return returnValue;};})();


 

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/2200c40c-7a72-4820-99dc-c75fd6b4eda8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to