Link to Current Date

47 views
Skip to first unread message

kidko

unread,
Oct 13, 2007, 10:00:06 PM10/13/07
to TiddlyWiki
I'm using TiddlyWiki as a development log for a project. I insert
entries using the "New Journal" button. I would like the current day's
entry to be one of the entries on DefaultTiddlers, but using the
<<today>> macro so that it automatically updates to today's date.
Unfortunately...
[[ <<today "DD MMM YYYY">> ]]
...doesn't work. It just has a link to the non-existant "<<today 'DD
MMM YYYY'>>" Tiddler. Anybody have suggestions on how to go about this
sort of thing?

FND

unread,
Oct 14, 2007, 4:20:04 AM10/14/07
to Tiddl...@googlegroups.com
> I would like the current day's
> entry to be one of the entries on DefaultTiddlers

This will probably require some evaluated code, so you should get either
of these plugins (they're pretty much identical):
http://tw.lewcid.org/#writeItMacro
http://devpad.tiddlyspot.com/#EvalMacro

Using the EvalMacro, you'd add this to your DefaultTiddlers tiddler:
<<eval {{
var dateFormat = "DD MMM YYYY";
var date = new Date().formatString(dateFormat);
"[[" + date + "]]";
}}>>
(Of course you can change the dateFormat string ("DD MMM YYYY") to your
preferred format.)

HTH.


-- F.

Saq Imtiaz

unread,
Oct 14, 2007, 4:25:44 AM10/14/07
to Tiddl...@googlegroups.com
Neither of those will work as the text in DefaultTiddlers is never wikified. Fred, another simple plugin project for you? ;)

Saq
--
TiddlyThemes.com ( http://tiddlythemes.com ) : a gallery of TiddlyWiki themes.
TiddlySnip ( http://tiddlysnip.com ) : a firefox extension that turns TiddlyWiki into a scrapbook!
LewcidTW ( http://tw.lewcid.org ) : a repository of extensions for TiddlyWiki

FND

unread,
Oct 14, 2007, 4:33:13 AM10/14/07
to Tiddl...@googlegroups.com
> Neither of those will work as the text in DefaultTiddlers is never
> wikified. Fred, another simple plugin project for you? ;)

Quite obviously, such a project would be much more suited for your
expertise.
So how about you hold off on your world domination plans for a minute
and code this thing?


-- F.

Eric Shulman

unread,
Oct 14, 2007, 6:35:27 AM10/14/07
to TiddlyWiki
> I would like the current day's entry to be one of the
> entries on DefaultTiddlers, but using the <<today>>
> macro so that it automatically updates to today's date.
> Unfortunately...
> [[ <<today "DD MMM YYYY">> ]]
> ...doesn't work. It just has a link to the non-existant "<<today 'DD
> MMM YYYY'>>" Tiddler. Anybody have suggestions on how to go about this
> sort of thing?

You can do this with a one-line "systemConfig" tiddler (aka, plugin)
that dynamically sets the DefaultTiddlers *shadow* tiddler each time
the document is loaded:

Start by creating a tiddler (e.g., [[DefaultTiddlersTweak]])
containing the following line of javascript code:
------------
config.shadowTiddlers.DefaultTiddlers=new Date().formatString("0DD-MMM-
YYYY");
------------
Then, make sure to remove any existing [[DefaultTiddlers]] tiddler
definition so that the next time you open your document, it will use
the shadow [[DefaultTiddlers]] definition (which has already been set
by the one-line plugin code, above.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios


This dynamically re-writes the DefaultTiddlers *shadow* definition
each time the document is loaded. Then,

kidko

unread,
Oct 14, 2007, 12:37:25 PM10/14/07
to TiddlyWiki
Thank you! This worked exactly as I needed it to.
Reply all
Reply to author
Forward
0 new messages