new tiddler by template with wikify current tiddler title

133 views
Skip to first unread message

Dave

unread,
Aug 14, 2012, 12:28:42 PM8/14/12
to tiddl...@googlegroups.com
I have a tiddler that has the following new tiddler button:

<<newTiddler
    label:"New Essay"
    text:{{store.getTiddlerText("NewEssayTemplate")}}
    tag:"EssayTitles"
>>


which refers to the tiddler [[NewEssayTemplate]]:
the title of this essay is: <<wikify "%0" {{tiddler.title}}>>


but when I click it and fill in the title, say "hello world", the new tiddler displays this:
the title of this essay is: New Tiddler hello world

Is there an obvious solution to this self-referencing dilemma?


thanks,
Dave

PMario

unread,
Aug 15, 2012, 5:33:15 AM8/15/12
to TiddlyWiki

Dave

unread,
Aug 16, 2012, 1:32:34 AM8/16/12
to tiddl...@googlegroups.com
Thanks Mario, that was really helpful. :)

Here's what ended up working for me (referring to the same NewEssayTemplate):
<<tiddler {{tiddler.title+"##code"}}>>

!code
<script label="New Essay" title="Create a new Essay topic">
var alwaysTag="EssayTitles";
var title=prompt("Please enter your new essay title","Another Dumb Essay");
var mytext=store.getTiddlerText("NewEssayTemplate")
var tags=[alwaysTag, "anyTag"];
store.saveTiddler(
  title,
  title,
  mytext,
  config.options.txtUserName,
  new Date(),
  tags);
story.displayTiddler(null,title);
</script>

I think it works over the other because it writes the tiddler directly instead of opening it for editing, where the previous version got the title wikified "twice"
Reply all
Reply to author
Forward
0 new messages