RedirectMacro - ideas for the programmer that takes over for Clint

26 views
Skip to first unread message

M)

unread,
Aug 17, 2009, 1:04:37 PM8/17/09
to TiddlyWiki
It appears that the RedirectMacro is no longer maintained. For any
programmer interested in maintaining this plugin, here are a few
things to consider...

1. Avoid creating redirect links that point to the containing
tiddler. For example, a tiddler called "title" shouldn't have the
word "title" turned into a redirect link.

2. Consider having each tiddler to have a checkbox that when selected,
triggers the writing of the
redirect code (<<redirect [[tiddler title]] [[tiddler title]]>) into a
tiddler called "redirects". This tiddler should be transcluded into
the MainMenu to be effective.

3. It seems having special caracters in tiddler titles can break
redirects.

http://checkettsweb.com/styles/themes.htm#RedirectMacro

27escape

unread,
Sep 7, 2009, 3:04:17 AM9/7/09
to TiddlyWiki
Just a thought if anyone is considering adding to this plugin, I would
like to be able to redirect something to a link external to the wiki
like

<<redirect TW http://www.tiddlywiki.org>>

also to allow regexps to do clever things like

<<redirect 'ISBN(\w+)\s' http://link-about-isbn-numbers.org/isbn=$1>>

Any takers?

Many thanks if there are.
kevin

On Aug 17, 6:04 pm, "M)" <marc.bu...@gmail.com> wrote:
> It appears that the RedirectMacro is no longer maintained.  For any
> programmer interested in maintaining this plugin, here are a few
> things to consider...
>
> 1. Avoid creatingredirectlinks that point to the containing
> tiddler.  For example, a tiddler called "title" shouldn't have the
> word "title" turned into aredirectlink.
>
> 2. Consider having each tiddler to have a checkbox that when selected,
> triggers the writing of theredirectcode (<<redirect[[tiddler title]] [[tiddler title]]>) into a

Eric Shulman

unread,
Sep 7, 2009, 3:32:23 AM9/7/09
to TiddlyWiki
> <<redirect TWhttp://www.tiddlywiki.org>>
> <<redirect 'ISBN(\w+)\s'http://link-about-isbn-numbers.org/isbn=$1>>

You can do something similar, but with macro syntax, by installing
this plugin:
http://www.TiddlyTools.com/#AliasPlugin

First, define the alias (embed in MainMenu or any other 'startup'
tiddler):
<<alias TW "http://www.tiddlywiki.com">>
Then, to use it, write:
<<TW>>

You can also create alias that insert one or more parameters into the
output by using %0 through %9 as 'substitution markers'. Thus, if you
define this alias:
<<alias ISBN "http://link-about-isbn-numbers.org/isbn=%0">>
you can write:
<<ISBN 12345>>
to create a link to:
http://link-about-isbn-numbers.org/isbn=12345

or, if you define the alias this way:
<<alias ISBN "[[%1|http://link-about-isbn-numbers.org/isbn=%0]]">>
you could write:
<<ISBN 12345 "click me">>
which renders as if you had typed:
[[click me|http://link-about-isbn-numbers.org/isbn=12345]]

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

27escape

unread,
Sep 8, 2009, 4:01:28 AM9/8/09
to TiddlyWiki
Thanks Eric, this is just what I need, brilliant!

27escape

unread,
Sep 9, 2009, 4:21:54 AM9/9/09
to TiddlyWiki
Actually its really good for putting images inline

<<alias smiley "[img[file:%0.png]]">>

then
<<smiley sad>>

This could also be used for image galleries etc.

Eric Shulman

unread,
Sep 9, 2009, 5:27:08 AM9/9/09
to TiddlyWiki
> Actually its really good for putting images inline
> <<alias smiley "[img[file:%0.png]]">>
> then
> <<smiley sad>>
> This could also be used for image galleries etc.

In addition to AliasPlugin, there are several other TiddlyTools
plugins that can be used to generate dynamic content:

http://www.TiddlyTools.com/#WikifyPlugin
Similar to AliasPlugin, in that it does "%n" substitution, but doesn't
create an "alias macro", and parameter reference syntax
"fieldname@tiddlername" and "tiddlername::slicename" to retrieve and
output values from custom fields or tiddler slices, respectively.

http://www.TiddlyTools.com/#InlineJavascriptPlugin
A power-tool for anyone with even just a little programming ability...
embed inline <script>...</script> blocks within tiddler content, and
use virtually any javascript-based logic you want to assemble and
return the desired output text, which is automatically passed to the
core's wikify() function for rendering into the tiddler. For example:
<script>
var hour=new Date().getHour();
var out="Good evening";
if (hour<18) out="Good afternoon";
if (hour<12) out="Good morning";
if (hour<6) out="Why aren't you asleep?";
return out;
</script>

The plugin can also be used to create 'onclick' scripts that embed a
'command link' into the output and invoke the script action only when
that link is clicked:
<script label="what time is it?">
return "<br>"+new Date().toString();
</script>

poof65

unread,
Sep 9, 2009, 6:13:19 AM9/9/09
to tiddl...@googlegroups.com
nice, it's exactly what i wanted to do few time before, i didn't know
the plugin was already written.
thank you eric, i'll pick you this one too :-)
Reply all
Reply to author
Forward
0 new messages