Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Is there a way to specify the 'rel' attribute? (Read 4083 times)
Richard Bullen
Full Member
*
Offline



Posts: 27

Is there a way to specify the 'rel' attribute?
Nov 07th, 2009, 2:45am
 
I'm looking for a way to specify the 'rel' attribute in the URL that is generated for notes that are exported to html.

Specifically what I want:
I have note A that has a text link to note B.
When note A is exported to html I want to URL that links to note B to include the 'rel' attribute and I want to be able to specify the 'value' for 'rel'  - it will be the URL of an html fragment for use in an overlay.

The purpose behind this is that I want to use a jquery plugin to create overlays for each of the links on a webpage. The plugin uses the 'rel' attribute to specify the source of the content for the overlay.

I can see how to specify the 'target', 'title', and 'class' for the link but can't find any instructions for working with the 'rel' attribute.

Is this possible from within TB?

Any suggestions on how to accomplish this would be greatly appreciated.

Thanks
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Is there a way to specify the 'rel' attribute?
Reply #1 - Nov 7th, 2009, 4:39am
 
There isn't a built-in method but you could use HTMLExportComand to post-process the HTML export (at time of export) to parse the output and add the necessary attribute. I believe this is just the sort of scenario for which this attribute was created, although it does assume the user is able to write the scripting required.

Another workaround - if its only a few links is to simply write the HTML code needed into the source not, taking care to set appropriately the attributes for entifying code. Your inline HTML code can still leverage export code to do things like insert the name of a particular note (should it get changed over time) rather than hard-code it.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Is there a way to specify the 'rel' attribute?
Reply #2 - Nov 7th, 2009, 8:37am
 
If you don't need to attach classes to your links, write a line of jQuery to walk through all the <a> tags in the document, find their class, and set rel to whatever the class happens to be.  In prototype.js, this is a one-liner; I think it's just about as easy in jQuery.

If you have LOTS of links, and they're links within the Tinderbox site and not Web links, I'd use HTMLExportCommand. Use the title or class attribute, and let the post-processor change "class" to "rel".

Or, if you have mostly Web links, I might write a macro

      ^do(link, URL, rel, text)

that expands to the desired HTML.




Back to top
 
 
WWW   IP Logged
Richard Bullen
Full Member
*
Offline



Posts: 27

Re: Is there a way to specify the 'rel' attribute?
Reply #3 - Nov 17th, 2009, 2:13pm
 
Thanks to both Marks for responses.

I used the jquery approach successfully.

RB
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print