dokuwiki-plugin-bootswrapper icon indicating copy to clipboard operation
dokuwiki-plugin-bootswrapper copied to clipboard

Added styling attributes for all components. class, id and style.

Open Rojoss opened this issue 8 years ago • 4 comments

I've made it so you can add classes, set the id or set custom css for all attributes. There is a new config option that must be toggled on for the styling to working. If styling is disabled it won't be rendered and it will fail to check attributes as the tag would be invalid.

All components now have the more advanced pattern like <tag.*?>(?=.*?</tag>) For basic components that don't override the render you have to add placeholders in the template. For example: <div class="bs-wrap bs-wrap-lead lead %s" id="%s" style="%s">

Other components manually have to add the styling tags using the following code:

$style = $this->getStylingAttributes($attributes);

 $markup = sprintf('<%s class="bs-wrap bs-wrap-label label label-%s %s" id="%s" style="%s">',
     $label_tag, $type, $style['class'], $style['id'], $style['style']);

Another example:

//Use the ID from the component instead of styling for components that require a ID
//Because styling might be disabled and you'd still need the id
$markup = sprintf('<div class="bs-wrap bs-wrap-accordion panel-group %s" id="%s" style="%s">',
    $style['class'], $id, $style['style']);

Preview

You can see and test it on my wiki http://gameboxx.info/wiki/styling?purge=true

Rojoss avatar Feb 19 '16 19:02 Rojoss

#33

Rojoss avatar Feb 19 '16 19:02 Rojoss

Hi Jos! ! I'm very happy of your implementation. I have created a new local branch to test this new feature.

Best regards, Joseph

giterlizzi avatar Feb 21 '16 17:02 giterlizzi

Alright :) I've tested most of the components and they all work fine for me.

Rojoss avatar Feb 21 '16 18:02 Rojoss

Looks great, I hope it'll get into the main repo!

robertrosman avatar Oct 10 '16 12:10 robertrosman