Skip to content

Commit

Permalink
Merge pull request #241 from Klap-in/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
Klap-in authored Aug 10, 2022
2 parents 1498754 + 1d87167 commit 7bded95
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 42 deletions.
6 changes: 0 additions & 6 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/

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

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');

class action_plugin_wrap extends DokuWiki_Action_Plugin {

/**
Expand Down
8 changes: 3 additions & 5 deletions helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,18 @@
* @author Anika Henke <anika@selfthinker.org>
*/

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

class helper_plugin_wrap extends DokuWiki_Plugin {
static protected $boxes = array ('wrap_box', 'wrap_danger', 'wrap_warning', 'wrap_caution', 'wrap_notice', 'wrap_safety',
'wrap_info', 'wrap_important', 'wrap_alert', 'wrap_tip', 'wrap_help', 'wrap_todo',
'wrap_download', 'wrap_hi', 'wrap_spoiler');
static protected $paragraphs = array ('wrap_leftalign', 'wrap_rightalign', 'wrap_centeralign', 'wrap_justify');
static protected $column_count = 0;
static $box_left_pos = 0;
static $box_right_pos = 0;
static $box_first = true;
static $table_entr = 0;

protected $column_count = 0;

/**
* get attributes (pull apart the string between '<wrap' and '>')
* and identify classes, width, lang and dir
Expand Down Expand Up @@ -66,7 +64,7 @@ function getAttributes($data, $useNoPrefix=true) {
}

//get lang
if (preg_match('/\:([a-z\-]+)/', $token)) {
if (preg_match('/:([a-z\-]+)/', $token)) {
$attr['lang'] = trim($token,':');
continue;
}
Expand Down
9 changes: 2 additions & 7 deletions syntax/closesection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* @author Michael Hamann <michael@content-space.de>
*/

if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');

class syntax_plugin_wrap_closesection extends DokuWiki_Syntax_Plugin {

function getType(){ return 'substition';}
Expand All @@ -26,8 +21,8 @@ function handle($match, $state, $pos, Doku_Handler $handler){
/**
* Create output
*/
function render($mode, Doku_Renderer $renderer, $indata) {
if($mode == 'xhtml'){
function render($format, Doku_Renderer $renderer, $data) {
if($format == 'xhtml'){
/** @var Doku_Renderer_xhtml $renderer */
$renderer->finishSectionEdit();
return true;
Expand Down
11 changes: 3 additions & 8 deletions syntax/div.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* @author Anika Henke <anika@selfthinker.org>
*/

if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');

class syntax_plugin_wrap_div extends DokuWiki_Syntax_Plugin {
protected $special_pattern = '<div\b[^>\r\n]*?/>';
protected $entry_pattern = '<div\b.*?>(?=.*?</div>)';
Expand Down Expand Up @@ -79,13 +74,13 @@ function handle($match, $state, $pos, Doku_Handler $handler){
/**
* Create output
*/
function render($mode, Doku_Renderer $renderer, $indata) {
function render($format, Doku_Renderer $renderer, $indata) {
static $type_stack = array ();

if (empty($indata)) return false;
list($state, $data) = $indata;

if($mode == 'xhtml'){
if($format == 'xhtml'){
/** @var Doku_Renderer_xhtml $renderer */
switch ($state) {
case DOKU_LEXER_ENTER:
Expand Down Expand Up @@ -119,7 +114,7 @@ function render($mode, Doku_Renderer $renderer, $indata) {
}
return true;
}
if($mode == 'odt'){
if($format == 'odt'){
switch ($state) {
case DOKU_LEXER_ENTER:
$wrap = plugin_load('helper', 'wrap');
Expand Down
2 changes: 0 additions & 2 deletions syntax/divblock.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @author Anika Henke <anika@selfthinker.org>
*/

require_once(dirname(__FILE__).'/div.php');

class syntax_plugin_wrap_divblock extends syntax_plugin_wrap_div {

protected $special_pattern = '<block\b[^>\r\n]*?/>';
Expand Down
2 changes: 0 additions & 2 deletions syntax/divwrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @author Anika Henke <anika@selfthinker.org>
*/

require_once(dirname(__FILE__).'/div.php');

class syntax_plugin_wrap_divwrap extends syntax_plugin_wrap_div {

protected $special_pattern = '<WRAP\b[^>\r\n]*?/>';
Expand Down
11 changes: 3 additions & 8 deletions syntax/span.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* @author Anika Henke <anika@selfthinker.org>
*/

if(!defined('DOKU_INC')) die();

if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');

class syntax_plugin_wrap_span extends DokuWiki_Syntax_Plugin {
protected $special_pattern = '<span\b[^>\r\n]*?/>';
protected $entry_pattern = '<span\b.*?>(?=.*?</span>)';
Expand Down Expand Up @@ -62,13 +57,13 @@ function handle($match, $state, $pos, Doku_Handler $handler){
/**
* Create output
*/
function render($mode, Doku_Renderer $renderer, $indata) {
function render($format, Doku_Renderer $renderer, $indata) {
static $type_stack = array ();

if (empty($indata)) return false;
list($state, $data) = $indata;

if($mode == 'xhtml'){
if($format == 'xhtml'){
switch ($state) {
case DOKU_LEXER_ENTER:
case DOKU_LEXER_SPECIAL:
Expand All @@ -85,7 +80,7 @@ function render($mode, Doku_Renderer $renderer, $indata) {
}
return true;
}
if($mode == 'odt'){
if($format == 'odt'){
switch ($state) {
case DOKU_LEXER_ENTER:
$wrap = plugin_load('helper', 'wrap');
Expand Down
2 changes: 0 additions & 2 deletions syntax/spaninline.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @author Anika Henke <anika@selfthinker.org>
*/

require_once(dirname(__FILE__).'/span.php');

class syntax_plugin_wrap_spaninline extends syntax_plugin_wrap_span {

protected $special_pattern = '<inline\b[^>\r\n]*?/>';
Expand Down
2 changes: 0 additions & 2 deletions syntax/spanwrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @author Anika Henke <anika@selfthinker.org>
*/

require_once(dirname(__FILE__).'/span.php');

class syntax_plugin_wrap_spanwrap extends syntax_plugin_wrap_span {

protected $special_pattern = '<wrap\b[^>\r\n]*?/>';
Expand Down

0 comments on commit 7bded95

Please sign in to comment.