Ok, finally got it. <<processVariables tiddler:"new-tiddler-test" >>
This takes the tiddler text in the specified tiddler and calls
substituteVariableReferences. It also has a text attribute for passing
straight text. This is a javascript macro.
/*\
title: $:/Arlen/macros/processVariables.js
type: application/javascript
module-type: macro
<<processVariables ... >>
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "processVariables";
exports.params = [
{name: "text"},
{name: "tiddler"}
];
/*
Run the macro
*/
exports.run = function(text, tiddler) {
var res = "";
if(text) res = this.substituteVariableReferences(text || "");
if(tiddler) res =
this.substituteVariableReferences(this.wiki.getTiddlerText(tiddler) || "");
return res;
};
})();
On Mon, Apr 7, 2014 at 1:45 PM, Arlen Beiler <[email protected]> wrote:
> Hello Everyone,
> Yes, Danielo, I would like to see them in the next TW5 release, but
> we'll see.
> I take that back about answering everything in Skeeve's plugin. That
> is only if you don't use a separate template tiddler (which was the point,
> but anyway...). I'm still thinking what to do if you are using a separate
> tiddler. I checked it out and it indeed won't work. I thought of
> transcluding the template tiddler into the macro, but transclusions don't
> work in macros. I'm sure this is intentional.
> Actually, if I replace the macro call with a transclusion call (
> param={{new-tiddler-template}} ), this works fine, except that the
> variables are not filled in. Normally, if you want variables in a macro
> result you would use \define me()$($(test)$)$ which results in \define
> me()$(testValue)$ in the new tiddler. However, if I want to transclude
> another tiddler, I would have to process variables in the tw-new-tiddler
> handler, which would result in the wikitext from macros
> (param=<<tiddlerText>>) being processed a second time. I'm sure I'm way
> ahead of everyone else, but that just came as I was typing so I just kept
> going. Is this a realistic concern or is it not?
> What about using a global macro called process variables? OK, trying
> that without much success. Can't put widgets inside widget opening tags,
> can't transclude in macro calls. Still thinking over this one. I finally
> think I got skeeve's point. This provides an alternate means but not a
> solution to the problem.
>
> Note the single line macro "me". Nested multiline macros do not work. A
> separate template tiddler would be required.
>
> \define tiddlerText()
>>
>
>>
>> \define me()$($(test)$)$
>> <$set name=try value="tried it">
>> <<me>>
>> </$set>
>> \end
>> <$set name="test" value="try" >
>> <$button message="tw-new-tiddler" class="btn-invisible"
>> param=<<tiddlerText>> >{{$:/core/images/new-button}}</$button>
>> </$set>
>
>
>
>
>
> On Mon, Apr 7, 2014 at 10:02 AM, Danielo Rodríguez <[email protected]>wrote:
>
>> Hello Arlen
>>
>> Could you explain a little bit what are you talking about? Some of your
>> sentences makes me curious about the bits you talk about. But since you
>> have commented here and in github I'm a bit lost. Are those things to be
>> implemented in the next TW5 release?
>>
>> --
>> 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 http://groups.google.com/group/tiddlywikidev.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.