Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| dokuwiki:infobox [2015-Dec-02 16:23] – ↷ Nom de la page changé de dokuwiki:alertbox à dokuwiki:infobox MOLINIER Etienne | dokuwiki:infobox [2018-Sep-18 22:39] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 2: | Ligne 2: | ||
| I use the bootstrap plugin along with the Bootstrap Wrapper Plugin, but I find that the syntax to add alert boxes is a hassle mainly due to the icon. | I use the bootstrap plugin along with the Bootstrap Wrapper Plugin, but I find that the syntax to add alert boxes is a hassle mainly due to the icon. | ||
| - | The idea is to expand the alert class to create my own infobox class that would include an icon. | + | The idea is to expand the alert class to create my own infobox class that would include an icon and offer the option to be centered |
| ==== Usage ==== | ==== Usage ==== | ||
| You can use the '' | You can use the '' | ||
| - | < | + | < |
| - | < | + | <infobox type="success">You can add a type (success, info, warning or danger)</ |
| - | <infobox type=" | + | <infobox type=" |
| - | <infobox type="info">Content here **with wiki markup**</ | + | <infobox type="danger" |
| - | <infobox type=" | + | |
| - | <infobox type="danger">Content | + | |
| - | </ | + | |
| - | < | + | |
| - | <infobox type="success">Content here **with wiki markup**</ | + | |
| - | <infobox type="info">Content here **with wiki markup**</ | + | |
| - | <infobox type="warning">Content here **with wiki markup**</ | + | |
| - | <infobox type="danger">Content here **with wiki markup**</ | + | |
| ==== The code ==== | ==== The code ==== | ||
| Ligne 29: | Ligne 21: | ||
| | | ||
| * @license | * @license | ||
| - | * @author | + | * @author |
| - | * @copyright | + | * @copyright |
| */ | */ | ||
| Ligne 36: | Ligne 28: | ||
| if(!defined(' | if(!defined(' | ||
| - | require_once(dirname(__FILE__).'/ | + | require_once(dirname(__FILE__).'/ |
| - | class syntax_plugin_bootswrapper_alertbox | + | class syntax_plugin_bootswrapper_infobox |
| - | protected $pattern_start | + | |
| - | protected $pattern_end | + | |
| - | function render($mode, | + | |
| - | if ($data[2][" | + | public |
| - | | + | |
| - | } | + | |
| - | if ($data[2][" | + | |
| - | $data[2][" | + | |
| - | } | + | |
| - | if ($data[2][" | + | |
| - | $data[2][" | + | |
| - | } | + | |
| - | if ($data[2][" | + | |
| - | $data[2][" | + | |
| - | } | + | |
| - | parent::render($mode, | + | ' |
| - | } | + | ' |
| + | ' | ||
| + | ' | ||
| + | |||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | |||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | |||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | |||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ); | ||
| + | |||
| + | function getPType(){ return ' | ||
| + | |||
| + | function | ||
| + | |||
| + | if (empty($data)) return false; | ||
| + | if ($mode !== ' | ||
| + | |||
| + | /** @var Doku_Renderer_xhtml $renderer */ | ||
| + | list($state, | ||
| + | |||
| + | switch($state) { | ||
| + | |||
| + | case DOKU_LEXER_ENTER: | ||
| + | |||
| + | extract($attributes); | ||
| + | |||
| + | $html_attributes = $this-> | ||
| + | $html_attributes[' | ||
| + | $html_attributes[' | ||
| + | $html_attributes[' | ||
| + | |||
| + | $style=[]; | ||
| + | if ($center) | ||
| + | if (!is_null($width)) {$style[" | ||
| + | $html_attributes[' | ||
| + | |||
| + | if ($dismiss) $html_attributes[' | ||
| + | |||
| + | $markup = sprintf('< | ||
| + | |||
| + | if ($dismiss) { | ||
| + | $markup .= '< | ||
| + | } | ||
| + | |||
| + | if ($icon) { | ||
| + | $markup .= sprintf('< | ||
| + | } | ||
| + | |||
| + | $renderer-> | ||
| + | return true; | ||
| + | |||
| + | case DOKU_LEXER_EXIT: | ||
| + | $renderer-> | ||
| + | return true; | ||
| + | |||
| + | } | ||
| + | |||
| + | return true; | ||
| + | |||
| + | | ||
| } | } | ||
| </ | </ | ||