[Tb] prevSibling, nextSibling confusion

From: Lee Phillips <lee__AT__lee-phillips.org>
Date: Tue Apr 06 2004 - 10:39:32 EDT

A good chunk of my website is exported from Tinderbox, but so far I've only exported the text links. I thought I would experiment with adding some extra navigation, starting with "previous" and "next" links based on a note's outlineorder.

Getting this to work required trial and error to find out what Tinderbox actually does, as the manual and example templates are wrong and incomplete (a common refrain). So I offer this note in hopes that it may save someone some time.

I want "previous" and "next" links among siblings only (notes with the same parent) and I want them ordered according to how the notes are sorted in the outline. This way if I write some documentation in an outline form the HTML links will express the outline structure. Tinderbox has previous and next objects, but they jump outside of a note's current container (not limited to siblings). The manual for 2.1 has an HTML export code reference starting on p. 189 that lists "prevsibling" and "nextSibling" - note the inconsistency in case. That sounds like what I want, but it says that prevsibling gives me "the next older sibling of the current note" and that nextSibling gives me "the next younger sibling of the current note" - who cares which is older and younger? Why would anyone want this? But I decided to try it out anyway, as this seemed weird enough that it might be just wrong.

In the example HTML templates there is one called "struct.html" that uses these. It has

^if(^exists(nextSibling)^)^
        Next: ^Title(nextSibling)^
^endif^

^if(^exists(previousSibling)^)^
        Previous: ^Title(PreviousSibling)^
^endif^

Note here also the case inconsistency. Maybe case doesn't matter! I copy this fragment in to one of my templates, and get bizarre results. Well, the nextSibling links look ok, and in fact seem to be reflecting the outline order rather than which note is "older" or "younger", thank goodness. But the previousSibling links are messed up; closer inspection shows that the links themselves are correct but the titles are not. I change the "PreviousSibling" to "previousSibling" and everything works!

The moral seems to be: user, try everything out and substitute your common sense for things in the documentation that seem wrong; and Eastgate, proofread your manual and try out (which means verify the correctness of) the example templates before distributing them.

Further reading: there is a wiki page on export codes that mentions previousSibling, etc., in passing but doesn't provide the necessary information; maybe someone (me? nah...) should add to it.
Received on Tue Apr 6 10:39:32 2004

This archive was generated by hypermail 2.1.8 : Wed Dec 14 2005 - 10:45:20 EST