Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Off The Wall: Feature Ideas >> Adding an option to ^siblings^
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1330360062

Message started by Marcelo Mirage on Feb 27th, 2012, 11:27am

Title: Adding an option to ^siblings^
Post by Marcelo Mirage on Feb 27th, 2012, 11:27am

I just realized how the ^siblings^ export code can be used to build a menu with all of the note's siblings. This method's feature is that the current title for the note will stand out from the remaining siblings. I suppose that's the code's intention.
But the options ("start","item-prefix","item-suffix","end",["linkType"]) will only allow style to be applied to all siblings EXCEPT the current page. This means you cannot apply any style to it particularly.

I'm sure there's a workaround, but would it be too hard to implement a parameter to control the master sibling, for style configuration?

Something like:
("start","item-prefix","item-suffix","end",["linkType"],["sib-prefix","sib-suffix"])


Title: Re: Adding an option to ^siblings^
Post by Mark Anderson on Feb 27th, 2012, 12:57pm

I'm pretty sure you can probably do as you want at present, though I can't give examples without a clearer description.

Here's some default output from ^siblings^ (I've added line breaks) from sibling note 'ant':
<ul>
 <li>ant</li>
 <li><a href="bee.html">bee</a></li>
 <li><a href="cow.html">cow</a></li>
 <li><a href="dog.html">dog</a></li>
</ul>


In default web browser styling, the first item will look different as there is no <a> link element but that's not difficult to fix via CSS if all items should look the same.


Quote:
But the options ("start","item-prefix","item-suffix","end",["linkType"]) will only allow style to be applied to all siblings EXCEPT the current page.

Er, not so. TB applies no specific  styling, i.e. CSS markup, other than that you define in your export code. So, we might use:

^siblings("<ul id="siblist">","<li>","</li>","</ul>")^

Now we get
<ul id="siblist">
 <li>ant</li>
 <li><a href="bee.html">bee</a></li>
 <li><a href="cow.html">cow</a></li>
 <li><a href="dog.html">dog</a></li>
</ul>


Basicalyin your list, every sibling is lists as $Name in an <li> and all except the current note have the $Name enclosed in a link.If you want extra styling hooks you could putl a <p></p> inside the , e.g. a second input of "<li><p>" instead of "<li>", etc.

In your CSS file:

#siblist { /* style the <ul> */ }
#siblist li { /* all <li> in siblist */ }
#siblist li a { /* all <a> in <li> in siblist */ }


You don't need to set an ID but it certainly makes it easier to style this <ul> differently from others on the page.

However, I'm not clear how/where the proposed sib-prefix and sib-sufix are used.

As I understand it, the optional fifth linkType filter argument only applies to ^inboundTextLinks^, ^outboundTextLinks^, ^inboundBasicLinks^, ^outboundBasicLinks^ and ^outboundWebLinks^. As ^siblings^ lists all siblings a linkType filter wouldn't have anything to act on.  In testing (v5.10.1) supplying such an input has no effect on the HTML output.

Title: Re: Adding an option to ^siblings^
Post by Marcelo Mirage on Feb 27th, 2012, 1:56pm


Code:
#siblist { /* style the <ul> */ }
#siblist li { /* all <li> in siblist */ }
#siblist li a { /* all <a> in <li> in siblist */ }


Ok, discriminating will do the trick. No need for an additional parameter. Thanks!

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.