Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving list-group icon #51

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
7 changes: 4 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jQuery(document).ready(function() {

var $list_wrap = jQuery(this);

var $icon_links = $list_wrap.find('li i + a');
var $icon_links = $list_wrap.find('li i + a, li img + a');

if ($icon_links.length) {
jQuery.each($icon_links, function() {
Expand All @@ -197,7 +197,7 @@ jQuery(document).ready(function() {

var $link = $list.find('a');

$link.wrapInner('<h4 class="list-group-item-heading"/>');
$link.wrapInner('<h4 class="list-group-item-heading" style="padding-left:0"/>');
$link.prependTo($list);
$list.find('p').appendTo($link);

Expand All @@ -213,7 +213,8 @@ jQuery(document).ready(function() {

}


// Now that the list is processed, show it
$list_wrap.removeClass('hide');
});


Expand Down
2 changes: 1 addition & 1 deletion syntax/column.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class syntax_plugin_bootswrapper_column extends syntax_plugin_bootswrapper_boots

);

function getPType(){ return 'block'; }
function getPType(){ return 'block';}

function render($mode, Doku_Renderer $renderer, $data) {

Expand Down
4 changes: 2 additions & 2 deletions syntax/grid.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class syntax_plugin_bootswrapper_grid extends syntax_plugin_bootswrapper_bootstr
protected $pattern_start = '<grid>';
protected $pattern_end = '</grid>';

protected $template_start = '<div class="bs-wrap bs-wrap-row row">';
protected $template_end = '</div>';
protected $template_start = '<div class="container-fluid"><div class="bs-wrap bs-wrap-row row">';
protected $template_end = '</div></div>';

function getPType(){ return 'block'; }
}
62 changes: 57 additions & 5 deletions syntax/jumbotron.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Bootstrap Wrapper Plugin: Jumbotron
*
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @copyright (C) 2015-2016, Giuseppe Di Terlizzi
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>, Eric Maeker <eric.maeker@gmail.com>
* @copyright (C) 2015-2018, Eric Maeker
*/

// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();

Expand All @@ -23,11 +23,35 @@ class syntax_plugin_bootswrapper_jumbotron extends syntax_plugin_bootswrapper_bo
'required' => false,
'default' => null),

'background-color' => array('type' => 'string',
'values' => null,
'required' => false,
'default' => null),

'color' => array('type' => 'string',
'values' => null,
'required' => false,
'default' => null),

'height' => array('type' => 'string',
'values' => null,
'required' => false,
'default' => null),

'padding-top' => array('type' => 'string',
'values' => null,
'required' => false,
'default' => null),

'background-size' => array('type' => 'string',
'values' => null,
'required' => false,
'default' => null),

'text-shadow' => array('type' => 'string',
'values' => null,
'required' => false,
'default' => null),
);

function render($mode, Doku_Renderer $renderer, $data) {
Expand All @@ -44,25 +68,53 @@ function render($mode, Doku_Renderer $renderer, $data) {
case DOKU_LEXER_ENTER:

$background = $attributes['background'];
$backgroundcolor = $attributes['background-color'];
$color = $attributes['color'];
$height = $attributes['height'];
$paddingtop = $attributes['padding-top'];
$backgroundsize= $attributes['background-size'];
$shadow = $attributes['text-shadow'];

$styles = array();


if ($background) {
$styles[] = sprintf('background-image:url(%s)', ml($background));
}

if ($backgroundcolor) {
$styles[] = sprintf('background-color:%s', $backgroundcolor);
}

if ($color) {
$styles[] = sprintf('color:%s', hsc($color));
}

if ($height) {
$styles[] = sprintf('height:%s', $height);
}

if ($paddingtop) {
$styles[] = sprintf('padding-top:%s', $paddingtop);
}

if ($backgroundsize) {
$styles[] = sprintf('background-size:%s', $backgroundsize);
}

if ($shadow) {
$styles[] = sprintf('text-shadow:%s', $shadow);
}


$markup = sprintf('<div class="bs-wrap bs-wrap-jumbotron jumbotron" style="%s">', implode(';', $styles), $type);
$markup .= '<div class="container">';

$renderer->doc .= $markup;
return true;

case DOKU_LEXER_EXIT:
$renderer->doc .= '</div>';
$renderer->doc .= '</div></div>';
return true;

}
Expand Down
7 changes: 6 additions & 1 deletion syntax/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ class syntax_plugin_bootswrapper_list extends syntax_plugin_bootswrapper_bootstr
protected $pattern_start = '<list-group>';
protected $pattern_end = '</list-group>';

protected $template_start = '<div class="bs-wrap bs-wrap-list-group">';
/*
* By default, hide list-group as they are processed by the JavaScript.
* It avoids page changing on user's view.
* See also: script.js --> jQuery('.bs-wrap-list-group').each(function() {
*/
protected $template_start = '<div class="bs-wrap bs-wrap-list-group hide">';
protected $template_end = '</div>';

function getPType() { return 'block';}
Expand Down
27 changes: 15 additions & 12 deletions syntax/macros.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bootstrap Wrapper Plugin: Useful Macros
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>, Eric Maeker <eric@maeker.fr>
* @copyright (C) 2016, Giuseppe Di Terlizzi
*/

Expand All @@ -15,13 +15,13 @@
class syntax_plugin_bootswrapper_macros extends DokuWiki_Syntax_Plugin {

private $macros = array(
'~~CLEARFIX~~',
'~~PAGEBREAK~~'
'~~PAGEBREAK~~',
'~~CLEARFIX.*?~~'
);

function getType() { return 'substition'; }
function getSort() { return 99; }
function getPType(){ return 'normal'; }
function getPType(){ return 'block'; }

function connectTo($mode) {

Expand All @@ -42,15 +42,18 @@ function render($mode, Doku_Renderer $renderer, $data) {

list($match, $state, $pos) = $data;

switch ($match) {
case '~~CLEARFIX~~':
$renderer->doc .= '<span class="clearfix"></span>';
break;
case '~~PAGEBREAK~~':
$renderer->doc .= '<span class="bs-page-break"></span>';
break;
if (substr($match,0, 11) == '~~CLEARFIX:') {
$renderer->doc .= '<span class="clearfix '.substr($match,11,-2).'"></span>';
} else {
switch ($match) {
case '~~CLEARFIX~~':
$renderer->doc .= '<span class="clearfix"></span>';
break;
case '~~PAGEBREAK~~':
$renderer->doc .= '<span class="bs-page-break"></span>';
break;
}
}

}

}
2 changes: 1 addition & 1 deletion syntax/text.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class syntax_plugin_bootswrapper_text extends syntax_plugin_bootswrapper_bootstr

);

function getPType() { return 'normal'; }
function getPType() { return 'block'; }

function render($mode, Doku_Renderer $renderer, $data) {

Expand Down