PrettyLink Extension

3 views
Skip to first unread message

Udo Borkowski

unread,
Sep 6, 2006, 4:01:24 PM9/6/06
to Tiddly...@googlegroups.com
Hi,

may I suggest a small extension to the PrettyLink:

Currently we may have links like
        [[label text|tiddler or externalRef]]

I suggest to allow a third (optional) parameter that defines an external link, in case a tiddler given at second place does not exists (or has no shadow).

Example:

[[Documentation|ForEachTiddlerDocumentation|http://tiddlywiki.abego-software.de/#ForEachTiddlerDocumentation]]

Some motivation:

when writing a plugin you try to keep the size of the plugin as small as possible. Therefore it is a frequently used approach to put documentation, examples etc. into separate tiddlers that are then referenced from the plugin tiddler (e.g. in a "Documentation" field in the header). So a user may decide to get just the plugin without documentation to keep his TW small.

To give him a chance to still read the documentation one often creates a shadow tiddler with the same name as the (e.g.) documentation tiddler that then refers to the documentation on the web:

ForEachTiddlerDocumentation
--------------------
Find the complete documentation [[here|http://tiddlywiki.abego-software.de/#ForEachTiddlerDocumentation]].


This approach work fine but has some drawbacks:
1) the plugin must be loaded to initialize the shadow tiddler with the reference to the documentation.
2) A shadow tiddler must be created for every such "tiddler with external backup"
3) To access the external reference the user is first navigate to the shadow tiddler and then he again has to click a link to get the actual documentation.


With the suggested extension these problems are gone.

Here the required code change (in Formatter.js, "prettyLink")

            else if(lookaheadMatch[3]) // Pretty bracketted link
                {
                var link = lookaheadMatch[4];
                var i = link.indexOf("|");
                if (i)
                    {
                    var s = link.substr(0,i);
                    link = (store.getTiddler(s) || store.isShadowTiddler(s)) ? s : link.substr(i+1);
                    }
                e = config.formatterHelpers.isExternalLink(link) ? createExternalLink(w.output,link) : createTiddlyLink(w.output,link,false);
                }
            createTiddlyText(e,text);



Of cause the usage of this kind of link is not restricted to documentation tiddlers, but also for things like copyright, licence etc.

Udo

----------
Udo Borkowski
http://www.abego-software.de



Saq Imtiaz

unread,
Sep 6, 2006, 4:19:25 PM9/6/06
to Tiddly...@googlegroups.com
On 9/6/06, Udo Borkowski <Udo.Bo...@gmx.de> wrote:

Example:

[[Documentation|ForEachTiddlerDocumentation|http://tiddlywiki.abego-software.de/#ForEachTiddlerDocumentation ]]

Some motivation:

when writing a plugin you try to keep the size of the plugin as small as possible. Therefore it is a frequently used approach to put documentation, examples etc. into separate tiddlers that are then referenced from the plugin tiddler (e.g. in a "Documentation" field in the header). So a user may decide to get just the plugin without documentation to keep his TW small.

To give him a chance to still read the documentation one often creates a shadow tiddler with the same name as the (e.g.) documentation tiddler that then refers to the documentation on the web:

I do this quite often myself, and this change would make life a little bit easier. So unless there is some negative consequence that I cant forsee, its got my vote!
Cheers,
Saq


Daniel Baird

unread,
Sep 6, 2006, 7:42:03 PM9/6/06
to Tiddly...@googlegroups.com
On 9/7/06, Udo Borkowski <Udo.Bo...@gmx.de> wrote:
>
> Hi,
>
> may I suggest a small extension to the PrettyLink:
> [[Documentation|ForEachTiddlerDocumentation|http://tiddlywiki.abego-software.de/#ForEachTiddlerDocumentation]]

Nice! +1 from me.

--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)

Jeremy Ruston

unread,
Sep 7, 2006, 10:46:02 AM9/7/06
to Tiddly...@googlegroups.com
Yeah, great idea, I'll whip it into 2.1

Cheers

Jeremy


--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com

Eric Shulman

unread,
Sep 7, 2006, 11:00:46 AM9/7/06
to TiddlyWikiDev
The current usage for externally linked *images* is:
[img[tip|imagefile][external link]]

For consistency, how about this syntax for externally-linked pretty
links
[[text|tiddler][external link]]

-e

Martin Budden

unread,
Sep 7, 2006, 2:32:01 PM9/7/06
to TiddlyWikiDev
I agree with the motivation behind the idea, but not the syntax. My
concerns are around interwiki syntax compatibility: adding the optional
third parameter will make TiddlyWiki different from *all* other wikis
in this area. I believe the same goal could be achieved with a syntax
that keeps us as compatible with other wikis as we are now.

So rather than rush this into 2.1, let's defer it to 2.2 and give
ourselves time to come up with a more interwiki compatible syntax.

Martin

Martin Budden

unread,
Sep 7, 2006, 2:34:15 PM9/7/06
to TiddlyWikiDev
I think this is better syntax than Udo's proposal, but again I say
let's not rush things. Let's defer to 2.2 and give ourselves time to
think and come to agreement.

Martin

Udo Borkowski

unread,
Sep 24, 2006, 10:38:34 AM9/24/06
to Tiddly...@googlegroups.com
I added a ticket (http://trac.tiddlywiki.org/tiddlywiki/ticket/182) for
this issue.

Udo

----------
Udo Borkowski
http://www.abego-software.de

Reply all
Reply to author
Forward
0 new messages