diff --git a/conf/default.php b/conf/default.php
index b3f0126..49c767f 100644
--- a/conf/default.php
+++ b/conf/default.php
@@ -6,3 +6,4 @@
*/
$conf['loadBootstrap'] = 0;
+$conf['allowStylingAttributes'] = 0;
\ No newline at end of file
diff --git a/conf/metadata.php b/conf/metadata.php
index 8ee671b..2541e6f 100644
--- a/conf/metadata.php
+++ b/conf/metadata.php
@@ -6,3 +6,4 @@
*/
$meta['loadBootstrap'] = array('onoff', '_caution' => 'danger');
+$meta['allowStylingAttributes'] = array('onoff');
diff --git a/lang/en/settings.php b/lang/en/settings.php
index f162924..e4dc3f0 100644
--- a/lang/en/settings.php
+++ b/lang/en/settings.php
@@ -8,3 +8,4 @@
// for the configuration manager
$lang['loadBootstrap'] = "Load the Bootstrap vanilla CSS. Disable it if you have installed a Bootstrap based template.";
+$lang['allowStylingAttributes'] = "Allow the use of ''class=\"\"'', ''id=\"\"'' and ''style=\"\"'' attributes on all components.";
diff --git a/lang/ja/settings.php b/lang/ja/settings.php
index c4549f7..7c67c7f 100644
--- a/lang/ja/settings.php
+++ b/lang/ja/settings.php
@@ -7,3 +7,4 @@
// 設定管理画面用
$lang['loadBootstrap'] = "Bootstrap vanilla CSS を読み込む。Bootstrap を基にしたテンプレートをインストールした場合、無効にします。";
+$lang['allowStylingAttributes'] = "Allow the use of ''class=\"\"'', ''id=\"\"'' and ''style=\"\"'' attributes on all components.";
diff --git a/script.js b/script.js
index 8482a08..b3c444d 100644
--- a/script.js
+++ b/script.js
@@ -122,6 +122,14 @@ jQuery(document).ready(function() {
case 'btnSize':
btn_class.push(['btn-', value].join(''));
break;
+ case 'btnClass':
+ btn_class.push(value);
+ case 'btnId':
+ $btn_link.attr('id', value);
+ break;
+ case 'btnStyle':
+ $btn_link.attr('style', value);
+ break;
case 'btnBlock':
btn_class.push('btn-block');
break;
diff --git a/syntax/accordion.php b/syntax/accordion.php
index b82b95d..75a7221 100644
--- a/syntax/accordion.php
+++ b/syntax/accordion.php
@@ -14,7 +14,7 @@
class syntax_plugin_bootswrapper_accordion extends syntax_plugin_bootswrapper_bootstrap {
- protected $pattern_start = '
%s', $msg_title, $name), -1);
@@ -58,7 +80,7 @@ function checkAttributes($attributes = array()) {
}
- $item = $this->tag_attributes[$name];
+ $item = $all_attributes[$name];
$required = isset($item['required']) ? $item['required'] : false;
$values = isset($item['values']) ? $item['values'] : null;
@@ -113,6 +135,31 @@ function checkAttributes($attributes = array()) {
}
+ /**
+ * Get array with styling attributes from the attributes array passed in.
+ * If the user has styling disabled this array will contain empty strings.
+ * @param array $attributes The attribute array with user values.
+ * @return array The array with styling attribute values or empty string.
+ */
+ function getStylingAttributes($attributes) {
+ $styling = array(
+ 'class' => '',
+ 'id' => '',
+ 'style' => ''
+ );
+
+ if ($this->getConf('allowStylingAttributes')) {
+ if (isset($attributes['class']) && $attributes['class'])
+ $styling['class'] = $attributes['class'];
+ if (isset($attributes['id']) && $attributes['id'])
+ $styling['id'] = $attributes['id'];
+ if (isset($attributes['style']) && $attributes['style'])
+ $styling['style'] = $attributes['style'];
+ }
+
+ return $styling;
+ }
+
function getType(){ return 'formatting'; }
function getAllowedTypes() { return array('container', 'formatting', 'substition', 'protected', 'disabled', 'paragraphs'); }
@@ -202,12 +249,14 @@ function render($mode, Doku_Renderer $renderer, $data) {
if ($mode !== 'xhtml') return false;
/** @var Doku_Renderer_xhtml $renderer */
- list($state, $match) = $data;
+ list($state, $match, $attributes) = $data;
switch($state) {
case DOKU_LEXER_ENTER:
- $markup = $this->template_start;
+ $style = $this->getStylingAttributes($attributes);
+
+ $markup = sprintf($this->template_start, $style['class'], $style['id'], $style['style']);
$renderer->doc .= $markup;
return true;
diff --git a/syntax/button.php b/syntax/button.php
index 03975d5..d5ecf19 100644
--- a/syntax/button.php
+++ b/syntax/button.php
@@ -65,6 +65,7 @@ function render($mode, Doku_Renderer $renderer, $data) {
case DOKU_LEXER_ENTER:
+ $style = $this->getStylingAttributes($attributes);
$html5data = array();
foreach ($attributes as $key => $value) {
diff --git a/syntax/callout.php b/syntax/callout.php
index dcb6075..1fd131a 100644
--- a/syntax/callout.php
+++ b/syntax/callout.php
@@ -45,8 +45,10 @@ function render($mode, Doku_Renderer $renderer, $data) {
case DOKU_LEXER_ENTER:
$type = $attributes['type'];
+ $style = $this->getStylingAttributes($attributes);
- $markup = sprintf('