Ceci est une ancienne révision du document !
Info Box
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.
Usage
You can use the infobox
tag in you wiki syntax as follows :
<infobox>This is the content</infobox> <infobox type="success">Content here **with wiki markup**</infobox> <infobox type="info">Content here **with wiki markup**</infobox> <infobox type="warning">Content here **with wiki markup**</infobox> <infobox type="danger">Content here **with wiki markup**</infobox>
<infobox>This is the content</infobox> <infobox type=“success”>Content here with wiki markup</infobox> <infobox type=“info”>Content here with wiki markup</infobox> <infobox type=“warning”>Content here with wiki markup</infobox> <infobox type=“danger”>Content here with wiki markup</infobox>
The code
In dokuwiki/lib/plugins/bootswrapper/syntax
you need to create the infobox.php
file and add the following content to it :
- infobox.php
<?php /** * Bootstrap Wrapper Plugin: Alert * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Etienne Molinier <webmaster@emolinier.com> * @copyright (C) 2015, Giuseppe Di Terlizzi */ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); require_once(dirname(__FILE__).'/alert.php'); class syntax_plugin_bootswrapper_alertbox extends syntax_plugin_bootswrapper_alert { protected $pattern_start = '<(?:INFOBOX|infobox).*?>(?=.*?</(?:INFOBOX|infobox)>)'; protected $pattern_end = '</(?:INFOBOX|infobox)>'; function render($mode, Doku_Renderer $renderer, $data) { if ($data[2]["type"]=="success") { $data[2]["icon"]= 'glyphicon glyphicon-ok'; } if ($data[2]["type"]=="info") { $data[2]["icon"]= 'glyphicon glyphicon-info-sign'; } if ($data[2]["type"]=="warning") { $data[2]["icon"]= 'glyphicon glyphicon-warning-sign'; } if ($data[2]["type"]=="danger") { $data[2]["icon"]= 'glyphicon glyphicon-minus-sign'; } parent::render($mode,$renderer,$data); } }