Welcome, Guest. Please Login or Register
Tinderbox
  News:
Tinderbox 6.1.0 is now available.  (download)
  HomeHelpSearchLoginRegister  
 
Pages: 1
Send Topic Print
Adding an option to ^siblings^ (Read 2125 times)
Marcelo Mirage
Full Member
*
Offline



Posts: 132
Brazil
Adding an option to ^siblings^
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"])

Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 4641
Southsea, UK
Re: Adding an option to ^siblings^
Reply #1 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v5
(TB consulting - email me)
WWW shoantel   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 132
Brazil
Re: Adding an option to ^siblings^
Reply #2 - 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!
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Pages: 1
Send Topic Print