selfthinker / dokuwiki_plugin_wrap

Wrap Plugin for DokuWiki: Universal plugin which combines functionalities of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction.
http://www.dokuwiki.org/plugin:wrap
GNU General Public License v2.0
41 stars 33 forks source link

Define the preset inserted WRAP-wikicode outside the plugin (and possibly add/remove presets) (Feature request) #233

Open erik-alm opened 2 years ago

erik-alm commented 2 years ago

I would like to be able to add some content in the wiki-text that renders when using a predefined box from the toolbar.

How about defining the actual content of the boxes in files and then using some unique sequence of chars, for instance, box_content or {{selected_text}} (or ${BODY} if you're IntelliJ fans...) to insert the box content, either from the selection or some default content.

This is how the TODO box might be defined in such a file:

<WRAP center round todo 60%>
${BODY}
</WRAP>

Preferably the changes would happen in some "local" config file or similar so they could survive plugin updates.

Further (or complementary?), it would also be nice to be able to add or remove preset formats. Which likely would be possible using the same approach as allowing the content of the boxes to change. (Plus some more configuration of things like icons and so on).

Klap-in commented 2 years ago

Probably I did get your point not correctly, but the configuration settings has already the option to exclude or include certain classes. See https://www.dokuwiki.org/plugin:wrap#configuration_options restrictedClasses and restrictionType

erik-alm commented 2 years ago

Yes, you're not getting my point correctly. ;)

I'm talking about the ability to define the actual text being pasted into the editor text area when clicking the icons displayed when clicking the WRAP-icon in the editing toolbar.

This text is currently being produced by combining data from several PHP arrays (if I remember correctly what I gathered when checking out the code).

So it may not be that hard to instead pick it from an external file. I didn't get that far in my code check (plus I'm not that good at PHP... or DokuWiki plugin coding...)

erik-alm commented 2 years ago

Probably I did get your point not correctly, but the configuration settings has already the option to exclude or include certain classes. See https://www.dokuwiki.org/plugin:wrap#configuration_options restrictedClasses and restrictionType

I updated the title to try and make it clearer what the request is...

Klap-in commented 2 years ago

I see. Related to #193 as well.

erik-alm commented 2 years ago

I see. Related to #193 as well.

Yes, #193 is the same as the second part of my suggestion, though I guess part 2 would be best implemented using tech from part 1.

I feel the ability to change what is inserted (part 1) is prio 1 and to add new inserts (part 2 and #193) is prio 2, at least from my point of view.

If push comes to shove being able to redefine the inserts would make it possible to add your own formats/classes for the given slots... theoretically even do some light hacking and change the icons.