> I feel like I'm being a bit thick or something, because I'm not sure
> I get it.

> First off you've got 'href' and 'target' as input parameters. But
> then later when generating the Element node, the attribute 'href'
> takes the value of 'linkInfo.target', whereas it seems quite likely
> one might like to create a link which uses the HTML target attribute, in
> which case linkInfo might need a thing for that.
>
> Given that, what are the meaning of: target, space and href;
> especially if one's starting point is foo@bar?

OK, you're not being stupid: part of the confusion is that several TW5
macros use the term "target" for the title of the tiddler that they
refer to (for instance, <<tiddler target:SomeTiddler>>). Accordingly,
the link macro uses the "target" parameter for the title of the
tiddler being linked to (or the URL for an external link).

The other confusion is that the mechanism doesn't, as it should,
permit the linkMassager to manipulate the HTML "target" property. My
first thought for the callback was for it to process the actual
ElementNode generated by the link macro; I did it the way that you see
in an attempt to try to shield the linkMassager from the
implementation of the ElementNode.

> My intuition, but I don't see how the code would support this is
> that target = 'foo', space='bar', and href would be constructed in
> the linkMassager, which is a closure with the upvariable of the space
> domain (perhaps 'tiddlyspace.com').
>
> Secondly, I'm not sure how to move forward with the change. You have
> installed a default linkMassager in js/App.js.
>
> Presumably in my code[1] when creating the store, a different
> linkMassager would be registered. That one would need to:
>
> * duplicate the "linkInfo.target = encodeURIComponent(linkInfo.target);"
>  in js/App.js, for the sake of correct tiddlywiki-style links

Yes, that is correct. I'm working on the basis that App.js is the "TW5
app", and that other systems using TW5 components (such as tw5ikifier)
would derive their own equivalents.

The idea is that mapping the link target to the URI using
encodeURIComponent() could be replaced with a slug generator that e.g.
uses dashes instead of spaces.

> * add code which did something like this:
>
>    if (linkInfo.space) {
>        linkInfo.target = 'http://'
>            + linkInf.space
>            + '.' + theEnclosedSpaceDomain
>            + '/' + encodeURIComponent(linkInfo.target);
>    }

> Is this what you were thinking, or something else?

Exactly that, modulo the points above about confusing parameter names,
and the need to re-engineer the callback to permit it to manipulate
the HTML target attribute.

I'll review the design tomorrow and ping you when I've got something better,

Best wishes

Jeremy

> Thanks.
>
> [1] https://github.com/cdent/tw5ikifier/blob/master/Wikifier.js
>
>
>
> --
> Chris Dent                                   http://burningchrome.com/
>                                [...]
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/tiddlywikidev?hl=en.
>



-- 
Jeremy Ruston
mailto:[email protected]
http://www.tiddlywiki.com

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to