Help, transferring the value of a variable into other tiddler

5 views
Skip to first unread message

octw

unread,
Sep 5, 2010, 1:01:17 AM9/5/10
to TiddlyWiki
Hi all,

I have a problem in generating a new tiddler to become a project
panel.

Currently I have a "newTiddler" button like this:

{{{
<<option txtNewProject>>
<<clickify newTiddler
label:"AddNewProject"
title:{{config.options.txtNewProject}}
text:{{store.getTiddlerText("ProjectPanel")}}
>>
}}}

Which accepts the variable "txtNewProject" as the title of the new
project AND using the tiddler "ProjectPanel" as the default text. The
text in "ProjectPanel" is something like this:

{{{
<<tabs chkTodoThings
Todo "Things todo" "@@@@@@@@/Todos"
OK "Things finished" "@@@@@@@@/Done"
>>

<part Todos hidden>
<<newJournal label:"Add Todos" tag:@@@@@@@@>>
<<forEachTiddler
where 'tiddler.tags.contains("@@@@@@@@") &&
! tiddler.tags.contains("ok")'
write '"|[X("+tiddler.title+":ok)] |[["+tiddler.title+"]]|\n"'
>></part>

<part Done hidden>
<<forEachTiddler
where 'tiddler.tags.contains("@@@@@@@@") &&
tiddler.tags.contains("ok")'
write '"|[X("+tiddler.title+":ok)] |[["+tiddler.title+"]]|\n"'
>></part>
}}}

The problem is, if I want the new project panel working, I have to
manually modify those "@@@@@@@@"s to become the value of
"txtNewProject". Otherwise it won't become the panel tiddler of the
new project.

I'm wondering if it is possible to automate the process, transferring
the value of "txtNewProject" to replace those "@@@@@@@@"s? I've tried
putting "{{config.options.txtNewProject}}" there. It was not working.
Any ideas? Thank for help.

Cheers,
octw

Eric Shulman

unread,
Sep 5, 2010, 1:39:47 AM9/5/10
to TiddlyWiki
> Currently I have a "newTiddler" button like this:
> <<option txtNewProject>>
> <<clickify  newTiddler
>   label:"AddNewProject"
>   title:{{config.options.txtNewProject}}
>   text:{{store.getTiddlerText("ProjectPanel")}}
> >>

> text in "ProjectPanel" is something like this:
> <<tabs chkTodoThings
> Todo "Things todo" "@@@@@@@@/Todos"
> OK "Things finished" "@@@@@@@@/Done"
...

> I'm wondering if it is possible to automate the process, transferring
> the value of "txtNewProject" to replace those "@@@@@@@@"s?

You can add a .replace(pattern,text) function to this macro param:

text:{{store.getTiddlerText("ProjectPanel").replace(/@@@@@@@@/
g,config.options.txtNewProject)}}

enjoy,
-e

octw

unread,
Sep 5, 2010, 2:16:53 AM9/5/10
to TiddlyWiki
Wow, it worked!

Thanks, Eric, for your kind help.

Cheers,
octw
Reply all
Reply to author
Forward
0 new messages