Danielo, this is pull request 510 and centers around creating new tiddlers using the x-tiddler format, aka .tid files. I wanted a way to be able to create new tiddlers with whatever fields I wanted and whatever text, and have the template in the same tiddler as where it was used so I wouldn't need two or more tiddlers. First I used JSON, and when I posted that here, Jeremy said he was thinking of something more like the .tid file format for the navigator widget. So I found the deserializer for the .tid files and the rest is history: https://github.com/Jermolene/TiddlyWiki5/pull/510
And here is an updated link to the macro. https://github.com/Arlen22/TiddlyWiki5/blob/tiddler-seriel/core/modules/macros/substituteVariables.js I hope you can select which commits to pull in, Jeremy. On Mon, Apr 7, 2014 at 3:59 PM, Arlen Beiler <[email protected]> wrote: > OK, everyone. That's done and working. Now I am able to use a separate > tiddler as the template, or a macro in the same one. If it is a separate > tiddler, it only uses the text of the tiddler. It does not worry about > anything else. > > Here is the macro: > https://github.com/Arlen22/TiddlyWiki5/blob/tiddler-seriel/core/modules/macros/substituteVariable.js > > I like skeeve's Let widget. I'm sure it'd need a little tweaking, but... > Is there any reason we couldn't add that to core? Is there any reason why > we would ever need set? Yeah, to assign the variable name via a macro. > > > On Mon, Apr 7, 2014 at 3:03 PM, Arlen Beiler <[email protected]> wrote: > >> 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. >> >> >> >> 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.
