Overview

There are many list syntax plugins (see the list of similar plugins above), but this one is mine. I created it because I am not happy with any of the others:

Only lists and deflist allow paragraph breaks within list items, but their syntax is radically different from the standard DokuWiki syntax for lists. Worse, the syntax that each plugin introduces for list item terminators differs from the other.1)

deflist and dl allow nested definition lists, and un/ordered lists nested in definition lists,2) but neither one properly uses the “class=levelN” style to mark the depth of a list item, as the standard DokuWiki list handler does.

deflist and dl automatically create a “bookmark” for each definition list term, which introduces a new requirement that definition list terms be unique within a document. This is IMO not a good idea.

My goal in creating yalist was to integrate definition lists into the existing nestable list handler, and to allow list items to contain multiple paragraphs, while maintaining syntax- and output-level compatibility with the existing list handler. yalist achieves this by preempting DokuWiki's list handler, replacing it with a new handler and renderer that render the standard list syntax exactly as DokuWiki would.

Lists can be nested within lists by indenting them further, just as in the standard DokuWiki syntax.

Example

The following DokuWiki source:

- Ordered list item 1
- Ordered list item 2
-- Ordered list item 3...
.. ... in multiple paragraphs
- Ordered list item 4
* Unordered list item
** Unordered list item...
.. ... in multiple paragraphs
- Ordered list, first level
- Second level
- Third level
- Fourth level
-- Back to second level
- //Second?! What happened to third?//
.. //Quiet, you.//
- Back to first level
- Still at first level
? Definition list
: Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is given by the DT element and is restricted to inline content. The description is given with a DD element that contains block-level content. [Source: W3C]
? Definition list w/ multiple paragraphs
:: The style sheet provided with this plugin will render these paragraphs...
.. ... to the left of the term being defined.
? Definition list w/ multiple "paragraphs"
: Another way to separate blocks of text in a definition...
: ... is to simply have multiple definitions for a term (or group of terms).
: This definition list has DD tags without any preceding DT tags.
: Hey, it's legal XHTML.
? Just like DT tags without following DD tags.
?? But DT tags can't contain paragraphs. That would __not__ be legal XHTML.
.. If you try, the result will be rendered oddly.

… is rendered in XHTML as follows:

<ol><liclass="level1"><divclass="li">
Ordered list item 1
</div></li><liclass="level1"><divclass="li">
Ordered list item 2
</div></li><liclass="level1"><divclass="li"><p>
Ordered list item 3&hellip;</p><p>&hellip; in multiple paragraphs
</p></div></li><liclass="level1"><divclass="li">
Ordered list item 4
</div></li></ol><ul><liclass="level1"><divclass="li">
Unordered list item
</div></li><liclass="level1"><divclass="li"><p>
Unordered list item&hellip;</p><p>&hellip; in multiple paragraphs
</p></div></li></ul><ol><liclass="level1"><divclass="li">
Ordered list, first level
</div><ol><liclass="level2"><divclass="li">
Second level
</div><ol><liclass="level3"><divclass="li">
Third level
</div><ol><liclass="level4"><divclass="li">
Fourth level
</div></li></ol></li></ol></li><liclass="level2"><divclass="li"><p>
Back to second level
</p></div><ol><liclass="level3"><divclass="li"><em>Second?! What happened to third?</em></div></li></ol><divclass="li"><p><em>Quiet, you.</em></p></div></li></ol></li><liclass="level1"><divclass="li">
Back to first level
</div></li><liclass="level1"><divclass="li">
Still at first level
</div></li></ol><dl><dtclass="level1"><spanclass="dt"> Definition list</span></dt><ddclass="level1"> Definition lists vary only slightly from other types of lists in that list items consist of two parts: a term and a description. The term is given by the DT element and is restricted to inline content. The description is given with a DD element that contains block-level content. [Source: <acronymtitle="World Wide Web Consortium">W3C</acronym>]</dd><dtclass="level1"><spanclass="dt"> Definition list w/ multiple paragraphs</span></dt><ddclass="level1"><p>
The style sheet provided with this plugin will render these paragraphs&hellip;</p><p>&hellip; to the left of the term being defined.
</p><dl><dtclass="level2"><spanclass="dt"> Definition list w/ multiple “paragraphs”</span></dt><ddclass="level2"> Another way to separate blocks of text in a definition&hellip;</dd><ddclass="level2">&hellip; is to simply have multiple definitions for a term (or group of terms).</dd></dl></dd></dl><dl><ddclass="level1"> This definition list has DD tags without any preceding DT tags.</dd><ddclass="level1"> Hey, it&#039;s legal <acronymtitle="Extensible HyperText Markup Language">XHTML</acronym>.</dd><dtclass="level1"><spanclass="dt"> Just like DT tags without following DD tags.</span></dt><dtclass="level1"><spanclass="dt">? But DT tags can&#039;t contain paragraphs. That would <emclass="u">not</em> be legal <acronymtitle="Extensible HyperText Markup Language">XHTML</acronym>.
.. If you try, the result will be rendered oddly.</span></dt></dl>

Discussion

Updated with bugfixes and enhancements. In the unlikely event that anyone downloaded this plugin already, try it again now. — Ben Slusky 2007-11-10 02:30

Great idea but seems to be buggy. Once I installed the plugin all bullets are treated as new lists. Basically if I have

* Item 1
* Item 2
* Item 3

The plugin will interpret them as if I wrote

* Item 1
* Item 2
* Item 3

Worse than that, it seems to break all \[\[ \]\] interwiki links

Bulleted lists and interwiki links both work for me… do you have a public site I can look at? — Ben Slusky 2007-11-24 23:39

Ben, this seems to be almost exactly the right solution, but there's one thing it doesn't do correctly. I want to write

* First level
** First level
* Second level
* Second level
.. continuing the last first level point

but this doesn't work: the .. isn't interpreted, and just becomes part of the last second-level bullet. It seems that the continuation context of the first level is lost in the transition to the second level. I can continue a second level bullet, but to go back to the first level I have to start a new bullet.

Any chance of this being corrected any time soon? Thanks, Andrew.

Maybe the ClearFloatOutdent plugin can do some good for this thingy you describe… It's just an idea so please don't hang me on it. HTH
— Mischa The Evil 2008/06/11 18:38

I also wanted to be able to use markup provided by DokuWiki Core (DWC) and some DokuWiki Plugins (DWP's) of the mode typecontainer3) but that wasn't possible due to the fact that yalist doesn't allow markup provided by DWC and DWP's which are of the mode typecontainer.

This can be changed easily by adding the container-mode type as a new (additional) argument of the method getAllowedTypes(), which itself returns an array of mode types that may be nested within yalist's own markup.
This change can be applied by modifying line 56 from

(style names using a german OpenOffice, X = “Anfang”, “Fortsetzung”, “Ende”)
Btw: I have almost no experience using definition lists in OpenOffice. If there is a recommended way to do them, let me know. I used two styles for the definition list to control alternative indenting and e.g. bold font for the term.

Feature Request

I need very often line breaks (<br>) but not paragraph breaks (<p>), especially when inserting images inside lists. My current workaround is using \\ but it's not very readyble because of huge lines. Would it be somehow possible to have a line break syntax like e.g. . at the beginning of the line?

1)
Which is especially strange, since they were written by the same author.