TW Developer input wanted (for Jeremy)

2 views
Skip to first unread message

AlanH

unread,
Aug 11, 2005, 2:33:26 AM8/11/05
to TiddlyWikiDev
I know that Jeremy is enjoying some much deserved time off, but before
he left I spoke to him about breaking up the TW code more so that
developers could tap into his functions without having to duplicate the
TW code. One example of this is when Jeremy took his code for
formatting the newJournal date out from within the newJournal function
and into "date.formatString."

What Jeremy could use from developers is a list of TW operations that
would be good candidates for this. For instance, I can see cases where
developers in their macros would want to tap into functions to saveRSS,
and saveHTML. But these functions are currenlty embedded in the
saveChanges function. So if Jeremy took them out of saveChanges and
made them a separate function instead, we could call them ourselves
with parameters like the filename, and an array of tiddlers (you get
the idea).

As you skim through the TW code, please post your candidates here.
Here are my few (mentioned above) to get us started:

saveRSS
saveHTML

AlanH

unread,
Aug 11, 2005, 2:42:52 AM8/11/05
to TiddlyWikiDev
I'm replying to my own post to add a separate, but related issue. In
one of my macros, I wanted to hijack a function that uses the (e) event
parameter. I could hijack it okay, and even pass the event back to the
original version of the function, but there was a problem.

Jeremy's code (it was the onDblClickTiddler(e) function) utilized
"this" as the reference to the current object. But by hijacking the
function, "this" was effectively changed to the current window instead
of the object the user had double-clicked...so the function no longer
worked. I was able to get around the problem by duplicating the entire
onDblClickTiddler(e) code and never calling the orig function (see my
WebView), but that's not clean and could mess up things if other macros
attempt to hijack the same function.

One way I found to overcome this problem was to change any "this"
reference in the hardcoded function to "e.target." This would always
reference the object of the event instead of the current object.

So 1) was there another way I could have done this without changing to
"e.target?" and if not, 2) Jeremy, as we talk about refractor code we
should keep this in mind and maybe change any "this" references to
"e.target" pending browser compatibilities.

~AlanH

Keith Hodges

unread,
Aug 11, 2005, 6:57:06 AM8/11/05
to Tiddly...@googlegroups.com
I have done some work, which will be in the next TiddlyPom release (soon),
pulling the Storage aspects out into a separate class. The idea being to
make persistence a pluggable/customisable component.

The next big chunk of work is to develop a new improved wikifier. I do hope
that Jeremy has not started on that yet, because I have a cool design in
mind.

best regards

Keith

Jonny LeRoy

unread,
Aug 16, 2005, 3:14:50 AM8/16/05
to TiddlyWikiDev

AlanH wrote:

> One way I found to overcome this problem was to change any "this"
> reference in the hardcoded function to "e.target." This would always
> reference the object of the event instead of the current object.
>
> So 1) was there another way I could have done this without changing to
> "e.target?"

I think it depends on how you call the original function after
hijacking it. Without your code it's hard to see. But if you call the
function on the original object (e.target.onDoubleClick(e)) or whatever
you should still get the reference to "this". I haven't tried this so
it's just a guess though ...

Jonny LeRoy

unread,
Aug 16, 2005, 3:19:59 AM8/16/05
to TiddlyWikiDev
In main() it would be good to break out "loadSystemConfig()" - there
are some things I'd like to hook into at that point.

Rob

unread,
Aug 16, 2005, 4:27:18 AM8/16/05
to TiddlyWikiDev
> As you skim through the TW code, please post your candidates here.
> Here are my few (mentioned above) to get us started:
>
> saveRSS
> saveHTML

pagePreInit
pagePostInit
pagePreComplete
pagePostComplete

I guess these count as hooks. They might make some things easier to do.
For example, I'm interested in having a pair timestamps from when the
page is loaded to when it is cmopletely displayed, telling me what kind
of lag particular macro code causes.

Maybe this is already possible via macro. If it is, please post the
sort of code needed.

Rob

unread,
Aug 16, 2005, 5:01:47 AM8/16/05
to TiddlyWikiDev
To give the option of displaying tiddlers (or just the tiddler body)
in-line, by way of HTML 'span', rather than 'div':
createTiddlerViewer(title,highlightText,highlightCaseSensitive);

becomes:
createTiddlerViewer(title,highlightText,highlightCaseSensitive,htmlElement);

htmlElement can be DIV, SPAN, IMG, OBJECT(+typeattribute), etc.

Rob

unread,
Aug 16, 2005, 5:52:49 AM8/16/05
to TiddlyWikiDev
A tiddlerTextNested boolean, determined by the presence of arbitrary
tag names*. If true for a tiddler, the body texts of the tiddler's
reference links replace the links (when they are allowed, see example).
When false, the tiddler reference link remains a link. I really hope
this functionality get included in the codebase, because it seems
macros can make tiddly a little sluggish. That's why I asked about the
'load-stage' hooks earlier, with timestamps as an example.

*For example:

In the parent...
CompositeNode tag (or some other user-defined tag string) makes a
node/tiddler a parent node, whose links are converted to the body
content of the referenced node and displayed in place of the link.

In a subnode/subtiddler...
EndComposite tag prevents recursion of its subnodes and so makes the
the tiddler body with the tag the last to be recursively included.

NoComposite stops recursion and forces the reference link to remain a
link

NB - Composite nesting can be recursive, as long as tiddlers cannot
include themselves in themselves. This includes all referenced
'subtiddlers' also, but is determined only by subordinate position.

Illustration:
NodeOne can include NodeOne[link], NodeTwo[body], NodeThree[body]
except if NodeOne is being included as a composite child of NodeTwo or
NodeThree, in which case [link] remains instead of replacement by
[body].

AlanH

unread,
Aug 26, 2005, 4:23:49 PM8/26/05
to TiddlyWikiDev
JeremyR,
I'm adding to this list the ability to call a seprate function to
re-display the default (or URL hash) tiddlers (and clear the message
area).

That way it can be called from main() as well as from within another
plugin.
~AlanH

Reply all
Reply to author
Forward
0 new messages