samwilson / dokuwiki-plugin-definitionlist

Add definition list syntax to DokuWiki.
https://www.dokuwiki.org/plugin:definitionlist
0 stars 4 forks source link

Major rewrite of handle() to better facilitate lists within definition lists #3

Closed Chris--S closed 11 years ago

Chris--S commented 11 years ago

The plugin now completely writes its own plugin calls. Both DT & DD tags use DOKU_LEXER_ENTER & DOKU_LEXER_EXIT states (rather than the previous DOKU_LEXER_MATCH). This change allows the plugin to work better with DokuWiki's own EOL & paragraph handling and avoids invalid html which could occur previously (e.g. when lists where included within DD items).

PHP class code is also updated to use visibility properties.

Chris--S commented 11 years ago

There are some minor issues with the tests, mostly to do with present or missing spaces & new lines.

A couple of more major issues though, with closing the definition list after a normal list. This revolves around the termination of a normal list "swallowing" two new lines, so a third is needed to end the definition list.

You can see white-space changes needed in tests to get them all to pass in my tests branch, https://github.com/Chris--S/dokuwiki-plugin-definitionlist/tree/tests

It is possible to eliminate the leading space in both DT & DD elements by altering the regex to swallow it. I'm still thinking if its worth the effort. I'm not sure what the best thing to do with the two blank lines (three consecutive new lines) requirement when embedding lists inside definition lists.

ssahara commented 11 years ago

I have installed the recent definition plugin from Chris's repository. The normal list (* syntax) inside the dd tag, list-items are child of dd and not brother. Therefore I thought that it is reasonable to put 4 leading spaces for the list as follows:

  ; term1
  : definition1
    * list-item1
    * list-item2

I expected both list-item1 and 2 has same level, however the result was different.

<dl class="plugin_definitionlist">
<dt><span class="term"> term1</span></dt>
<dd> definition1<ul>
<li class="level1"><div class="li">list-item1</div>
</li>
<li class="level3"><div class="li">list-item2</div>
</li>
</ul>
</dd>
</dl>

I do know why, sorry for just reporting.

Chris--S commented 11 years ago

Its a dokuwiki issue, try the same unordered list structure without the preceding definition list. E.g.

* list-item 1
* list-item 2

see on dokuwiki --- http://www.dokuwiki.org/sandbox:listindenting

ssahara commented 11 years ago

@Chris--S, thanks for your reply. After enjoying tests of new definition plugin, I found that we can now use ordered/non-ordered lists and quoting and even table inside DD (*,-,>,| trigger available). I think it is nice feature.

Elimination of leading spaces in DD may be lose similarity from DokuWiki intrinsic (* or -) syntax. But I guess it may have advantage if a user wants to render table with help of style sheet because placing two spaces in Wiki source are boring. Anyway, changing the syntax will cause trouble in existing pages. IMO, it should be refrained or be implemented in separate plugin.

Termination of DD element after lists, I think the two blank lines requirement is easy to remember usage.

Satoshi

ssahara commented 11 years ago

Could I expect any chance to be merged this Chris--S's request to master repository before coming DokuWiki Blink release?

samwilson commented 11 years ago

Yep! Merged. I'm sorry, everyone, that I got sidetracked from this. :-)

Chris, do you want to take over maintenance on Github? Or are you happy for it to stay here? It's not like I'm really the maintainer, but I'm quite happy to help when I can of course! :-)

Thanks everyone.

Chris--S commented 11 years ago

I'm more than happy for it to stay here. I don't always have all the time I need to keep things up to date.

samwilson commented 11 years ago

Okay, no worries! :-)