Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
Changing behavior of list formatting
Writing a plugin to change list formatting into <div> boxes
Avatar
gburch #1
Member since Oct 2018 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: Changing behavior of list formatting
Hello community,

I'm new to dokuwiki development and am looking to craft my first plugin. Essentially I want to render the "ordered list" markup as a series of <div> boxes rather than <li> items.

Is a syntax plugin the best way to do this? Does anyone know of something similar I can piggy-back off of? I want to conditionally apply this formatting to some pages on the wiki, but not all.

Thanks in advance! Excited to dive into this.

Gillen
Avatar
LarsDW223 #2
Member since Sep 2014 · 399 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
These plugins use a different syntax than the core syntax but maybe you can re-use them anyway:
https://www.dokuwiki.org/plugin:extlist, https://www.dokuwiki.org/plugin:yalist, https://www.dokuwiki.org/plugin:lists, https://www.dokuwiki.org/plugin:subnumberlist
Avatar
Michaelsy #3
Member since Jun 2015 · 925 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
In reply to post #1
I have the impression that new list plugins are programmed again and again. I do not know why. Maybe there are so many different applications? Maybe there are so many different methods? Is the wheel reinvented over and over again? Is it easier to create a new plugin than to explore the possibilities of existing plugins?

Anyway, the Yalist plugin ("Yet Another List Plugin"?) seems to be quite up to date. And it claims to avoid many disadvantages of older plugins. Here is a live demo of me about this plugin. Please feel free to play around with the demo. (It's an open wiki) Maybe you can make it a little more practical and meaningful.

Maybe this thread is also interesting for you, which deals with a very specific detail problem and has just come to an end.

HTH - Michael Sy.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
This post was edited 3 times, last on 2018-10-17, 22:05 by Michaelsy.
Avatar
gburch #4
Member since Oct 2018 · 7 posts
Group memberships: Members
Show profile · Link to this post
Thanks for the suggestions LarsDW223 and Michael.

I installed yalist and was able to accomplish what I was looking for by modifying the "definition list definition" to create <div> and </div> tags. Now I have style-able div boxes that look pretty good.

Now a more specific question. I want to change the behavior of URLs such that if a list item contains a hyperlink, the div box itself (rather than solely the text) becomes the click-able link.

I would accomplish this in html form like this:
<a href=TARGET><div style=xxx>Common Issues and Solutions</div><a>

But obviously what I'm getting now is:
<div style=xxx><a href=xxx>Common Issues and Solutions</a></div>

This is because the wiki content is the following:
  :[[artist:technology:solutions|Common Issues and Solutions]]


Can I tackle this with more modifications to yalist, or should I look for an additional plugin? I'm thinking that a conditional statement that looks for an <a> tag would do the trick and then re-outputs the desired html.

I'm not sure where in the rendering pipeline something like this should fall?

Thanks for helping a newb!
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
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, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-06-17, 21:03:12 (UTC +02:00)