Mere moments after I posted, I realized I was overthinking the problem.

The code for a demonstration tiddler:

\define buttonmacro(countUp caption1 caption2)
<$button style="background-color:White; width:100%; height:100%" >"""
Button $caption1$ $caption2$ $countUp$
"""</$button>
\end


\define buttonmacro2(countUp caption1 caption2)
<$button style="background-color:White; width:100%; height:100%" >"""
Button $caption1$ $caption2$ $countUp$
"""</$button>
\end


\define interimmacro(countUp caption1 caption2)
<$macrocall $name=repeatmacroxv4 targetMacro=buttonmacro2 x=$countUp$ 
parameterPassing="$caption1$ $caption2$"/>
\end


<$macrocall $name=repeatmacroxv4 targetMacro=buttonmacro2 x=3 
parameterPassing="Buttons Words"/>


<<interimmacro 4 Dog Cat>>


The code for the demonstration javascript:

/*\
title: $:/_my/macros/repeatmacroxv4.js
type: application/javascript
module-type: macro


Macro to return a macro multiple times
\*/
(function(){


/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";


/*
Information about this macro
*/


exports.name = "repeatmacroxv4";


exports.params = [
 {name: "targetMacro"},
 {name: "x"},
    {name: "parameterPassing"}
];


/*
Run the macro
*/
exports.run = function(targetMacro,x,parameterPassing) {
 var i;
 var result;
 for (i = 0; i < x; i++) { 
    if (i == 0) {
 result = "<<" + targetMacro + " " + String(i + 1) + " " + parameterPassing 
+ ">>";
 } else {
 result += "<<" + targetMacro + " " + String(i + 1) + " " + 
parameterPassing + ">>";
 }
 }
 return result;
};


})();

I'm pretty sure this works, but I'm still so new at this that I might be 
making some unobvious mistake that will become a problem later. So 
critiques are welcome if needed.

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6e5d1cce-88ae-43a6-a397-4c949ff09b64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to