Skip to content

Commit

Permalink
Change pagemove support into move support
Browse files Browse the repository at this point in the history
The new pagemove plugin has been renamed into move.
  • Loading branch information
michitux committed Nov 24, 2013
1 parent 284785a commit 306441b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions _test/pagemove_support.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
*/
class plugin_include_pagemove_support_test extends DokuWikiTest {
public function setup() {
$this->pluginsEnabled[] = 'pagemove';
$this->pluginsEnabled[] = 'move';
$this->pluginsEnabled[] = 'include';
parent::setup();
}

public function test_relative_include() {
global $ID;
/** @var $pagemove helper_plugin_pagemove */
$pagemove = plugin_load('helper', 'pagemove');
if (!$pagemove) return; // disable the test when pagemove is not installed
/** @var $move helper_plugin_move */
$move = plugin_load('helper', 'move');
if (!$move) return; // disable the test when move is not installed
saveWikiText('editx', '{{page>start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}', 'Testcase created');
idx_addPage('editx');
$ID = 'editx';
$opts['ns'] = '';
$opts['newname'] = 'editx';
$opts['newns'] = 'test';
$pagemove->move_page($opts);
$move->move_page($opts);
$this->assertEquals('{{page>:start#start}} %%{{page>start}}%% {{section>wiki:syntax#tables&nofooter}} {{page>:}} {{section>test:start#test}}',rawWiki('test:editx'));
}

public function test_rename() {
global $ID;
/** @var $pagemove helper_plugin_pagemove */
$pagemove = plugin_load('helper', 'pagemove');
if (!$pagemove) return; // disable the test when pagemove is not installed
/** @var $move helper_plugin_move */
$move = plugin_load('helper', 'move');
if (!$move) return; // disable the test when move is not installed
saveWikiText('editx', 'Page to rename', 'Testcase create');
saveWikiText('links', '{{section>links#foo}} {{page>editx}} {{page>:eDitX&nofooter}} {{section>editx#test}} {{page>editx&nofooter}}', 'Testcase created');
idx_addPage('editx');
Expand All @@ -39,7 +39,7 @@ public function test_rename() {
$opts['ns'] = '';
$opts['newname'] = 'edit';
$opts['newns'] = 'test';
$pagemove->move_page($opts);
$move->move_page($opts);
$this->assertEquals('{{section>links#foo}} {{page>test:edit}} {{page>test:edit&nofooter}} {{section>test:edit#test}} {{page>test:edit&nofooter}}', rawWiki('links'));
}
}
6 changes: 3 additions & 3 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function register(&$controller) {
$controller->register_hook('PARSER_HANDLER_DONE', 'BEFORE', $this, 'handle_parser');
$controller->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'handle_metadata');
$controller->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', $this, 'handle_secedit_button');
$controller->register_hook('PAGEMOVE_HANDLERS_REGISTER', 'BEFORE', $this, 'handle_pagemove_register');
$controller->register_hook('MOVE_HANDLERS_REGISTER', 'BEFORE', $this, 'handle_move_register');
}

/**
Expand Down Expand Up @@ -327,11 +327,11 @@ function handle_secedit_button(Doku_Event &$event, $params) {
$event->stopPropagation();
}

public function handle_pagemove_register(Doku_Event $event, $params) {
public function handle_move_register(Doku_Event $event, $params) {
$event->data['handlers']['include_include'] = array($this, 'rewrite_include');
}

public function rewrite_include($match, $pos, $state, $plugin, helper_plugin_pagemove_handler $handler) {
public function rewrite_include($match, $pos, $state, $plugin, helper_plugin_move_handler $handler) {
$syntax = substr($match, 2, -2); // strip markup
$replacers = explode('|', $syntax);
$syntax = array_shift($replacers);
Expand Down

0 comments on commit 306441b

Please sign in to comment.