-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathwrapper.php
More file actions
68 lines (52 loc) · 1.84 KB
/
Copy pathwrapper.php
File metadata and controls
68 lines (52 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* Bootstrap Wrapper Plugin: Generic Wrapper (span or div)
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @copyright (C) 2015-2020, Giuseppe Di Terlizzi
*/
class syntax_plugin_bootswrapper_wrapper extends syntax_plugin_bootswrapper_bootstrap
{
public $pattern_start = '<(?:WRAPPER|wrapper).*?>(?=.*?</(?:WRAPPER|wrapper)>)';
public $pattern_end = '</(?:WRAPPER|wrapper)>';
public $tag_name = 'wrapper';
public $tag_attributes = array(
'screen' => array(
'type' => 'boolean',
'values' => array(0, 1),
'required' => false,
'default' => false),
'print' => array(
'type' => 'boolean',
'values' => array(0, 1),
'required' => false,
'default' => false),
);
public function render($mode, Doku_Renderer $renderer, $data)
{
if (empty($data)) {
return false;
}
if ($mode !== 'xhtml') {
return false;
}
/** @var Doku_Renderer_xhtml $renderer */
list($state, $match, $pos, $attributes, $is_block) = $data;
global $wrapper_tag;
if ($state == DOKU_LEXER_ENTER) {
$wrapper_tag = ($is_block) ? 'div' : 'span';
$wrap_classes = $attributes['class'];
$wrap_classes[] = 'bs-wrapper';
$wrapper_attributes = $this->buildAttributes($attributes, array('class' => $wrap_classes));
$markup = "<$wrapper_tag $wrapper_attributes>";
$renderer->doc .= $markup;
return true;
}
if ($state == DOKU_LEXER_EXIT) {
$renderer->doc .= "</$wrapper_tag>";
return true;
}
return false;
}
}