samwilson / dokuwiki-plugin-definitionlist

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

Arbitrary class assignment to dl/dt/dd #5

Closed ssahara closed 10 years ago

ssahara commented 11 years ago

I think it will be nice if users can choice appropriate style/design (from pre-defined css classes) for the definition lists depending on its context. The HTML dl/dt/dd is available for glossary tables to a script of play (libretto). One of this pull request provides a solution by the macro \~~:dlist:class~~, which can be placed anywhere in the Wiki source before definition list syntax. It even allows more than two definition lists those have different appearance in the same page by using macro several times.

Another request concerns how to set class attribute for dt or dd tags. From the web-designer perspective, I want to assign specific css class only for certain dt/dd tags to control their appearance such as font or term-folding behavior. I extended the syntax like : class | description to render <dd class="class">description</dd>. The original syntax works well as usual. Even I do know whether this is good way or not in programmer's view, it works well as expected anyway.

I appreciate it if you could give me any suggestion or comments.

samwilson commented 10 years ago

Sorry I've not looked at this till now. :(

It's an interesting idea, certainly useful. I have been solving the issue of targeting styles/scripts at particular definition lists (and items thereof) by using the wrap plugin. So, for instance, the following wikitext:

<WRAP custom-block-class>

  ; Term 1 : Definition 1
  ; Term 2
  : <wrap custom-inline-class>Definition paragraph.</wrap>

</WRAP>

reults in this HTML:

<div class="wrap_custom-block-class plugin_wrap">
  <dl class="plugin_definitionlist">
    <!-- ... -->
    <dd>
      <span class="wrap_custom-inline-class ">Definition paragraph.</span>
    </dd>
  </dl>
</div>

Do you think this is sufficient?

I guess I'm just hesitant to introduce even more syntax. But I'm not really sure. :)

If we do go with your new syntax, the only other thing we need are tests. Would you be able to add them?

Thanks!

ssahara commented 10 years ago

Hi, Samwilson, thanks for your comment. Even I send this PR in some month ago, but now after my own experience I would like to withdraw the request. There are some reasons why I have change mind: 1) the syntax looks too complicated to remember, 2) using html tag is more simple way for specific cosmetics/design purpose, 3) I now do not need to take care old-IE-compatiblity that required tricky technique for DL/DT/DD. I think the subtitle of DW official site -- It's better when it's simple -- is true.

BTW, this the code of definitionlist plugin is a good example to learn syntax plugin programing, especially for very complex one. I applied the plugin code to develop exttab3 plugin. I would like to express my thanks here for you and @Chris--S.

Sincerely,

samwilson commented 10 years ago

The credit is all due to Chris--S, I can assure you! :-) I just tinker.

But I'm glad this has proven to be a useful plugin.