*I got it!!!*

I have finish my macro and it runs perfect.
It puts a little index with the heads of the current tiddler.

This is the code:

(function(){
"use strict";
exports.name = "index";
exports.params = [{name: "head"}];
exports.run = function(head) {
        var currentTiddlerName = this.getVariable("currentTiddler");
        var currentTiddler = this.wiki.getTiddler(currentTiddlerName);
        var value = currentTiddler.getFieldString("text");

        var result = "!!!" + head + "\n" + "<small>\n\n";
        var partial;
        var pattern = /^(!+)(\w.+?)$/gm;

        while((partial = pattern.exec(value)) != null) {
                result = result + "*".repeat(partial[1].length) + " " + 
partial[2] + "\n";
        }
        
        result = result + "</small>"
        return result;
};

})();


And this is the way I use it:

<<index "In this tiddler:">>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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 https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/7b104767-90a1-4e27-8d0b-b6ac562073ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to