Not logged in. · Lost password · Register
Forum: General Discussion Plugins RSS
Autolink plugin
Generate links from a given page
nabeel #1
Member for 2 weeks · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Autolink plugin
I'm looking through the plugins list, I can't find a plugin which would simply take a page name, and then create the anchor links to link to the sections. This would be really useful for a FAQ type list. So, something like

 * <autolink PageName>

Or something like:
<autolink PageName [prefix]>
ie
<autolink PageName * >

Which would generate:

  * [[Pagename#Something]]
  * [[Pagename#Another Link]]

I tried looking through the plugin's list, but couldn't find anything really (wasn't sure what to look for). If it doesn't exist, maybe I'll write it up.

Thanks!
Avatar
chi (Moderator) #2
Member since Jun 2006 · 607 posts · Location: Munich Germany
Group memberships: Global Moderators, Members
Show profile · Link to this post
Quote by nabeel:
I tried looking through the plugin's list, but couldn't find anything really (wasn't sure what to look for). If it doesn't exist, maybe I'll write it up.

IIRC there's no such plugin yet, but I think it would be very useful. Creating the plugin shouldn't be too complicated, the following two are your friends ;-):

  1. // retrieves the toc for a given page ($ID) <dokuwiki>/inc/parserutils.php
  2. $data = p_get_metadata($ID, 'description tableofcontents');
  3.  
  4. // builds a html list <dokuwiki>/inc/html.php
  5. // you'll need a custom callback function (not html_li_default) to get the anchors right.
  6. html_buildlist($data,$class,$func,$lifunc='html_li_default')

Cheers
Please add [SOLVED] to the initial thread subject if you feel your question has been answered.
nabeel #3
Member for 2 weeks · 2 posts
Group memberships: Members
Show profile · Link to this post
Cool, thanks for the heads up. I'll take a look at it today/the weekend :)
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please note the verification code from the picture into the text field next to it.
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 1.6.4, © 2003-7 by Yves Goergen
Current time: 2008-05-17, 06:30:40 (UTC +02:00)
WikiForumIRCBugsTranslate