dokuwiki-plugin-bootswrapper
dokuwiki-plugin-bootswrapper copied to clipboard
Added styling attributes for all components. class, id and style.
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
#33
Hi Jos! ! I'm very happy of your implementation. I have created a new local branch to test this new feature.
Best regards, Joseph
Alright :) I've tested most of the components and they all work fine for me.
Looks great, I hope it'll get into the main repo!