Skip to content

Commit

Permalink
Merge branch 'release/2019-12-31'
Browse files Browse the repository at this point in the history
  • Loading branch information
micgro42 committed Dec 31, 2019
2 parents 724e151 + 259dc4a commit 4b6443b
Show file tree
Hide file tree
Showing 9 changed files with 2,902 additions and 1,423 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
node_modules
node_modules/
npm-debug.log
lib
/lib/
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

language: php
php:
- "7.3"
- "7.2"
- "7.1"
- "7.0"
- "5.6"
- "5.5"
- "5.4"
- "5.3"
env:
- DOKUWIKI=master
- DOKUWIKI=stable
matrix:
allow_failures:
- php: "nightly"
before_install: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh
install: sh travis.sh
install:
- if [[ $TRAVIS_PHP_VERSION > '7.1' || $TRAVIS_PHP_VERSION = nightly ]]; then wget -O ~/.phpenv/versions/$(phpenv version-name)/bin/phpunit https://phar.phpunit.de/phpunit-7.phar; fi
- if [[ $TRAVIS_PHP_VERSION > '7.1' || $TRAVIS_PHP_VERSION = nightly ]]; then chmod 755 ~/.phpenv/versions/$(phpenv version-name)/bin/phpunit; fi
- sh travis.sh
script: cd _test && phpunit --stderr --group plugin_structsection
38 changes: 27 additions & 11 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@
* @author Michael Große <mic.grosse@googlemail.com>
*/

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

class action_plugin_structsection extends DokuWiki_Action_Plugin {
class action_plugin_structsection extends DokuWiki_Action_Plugin
{

/**
* Registers a callback function for a given event
*
* @param Doku_Event_Handler $controller DokuWiki's event controller object
* @return void
*/
public function register(Doku_Event_Handler $controller) {
$controller->register_hook('PARSER_HANDLER_DONE', 'AFTER', $this, 'handle_parser_done');
$controller->register_hook('PLUGIN_STRUCT_TYPECLASS_INIT', 'BEFORE', $this, 'handle_init');
public function register(Doku_Event_Handler $controller)
{
$controller->register_hook('PARSER_HANDLER_DONE', 'AFTER', $this, 'appendPluginOutputToPage');
$controller->register_hook('PLUGIN_STRUCT_TYPECLASS_INIT', 'BEFORE', $this, 'registerTypeWithStructPlugin');
}

/**
* [Custom event handler which performs action]
* Event handler for PARSER_HANDLER_DONE
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return void
*/
final public function appendPluginOutputToPage(Doku_Event $event, $param)
{
static $instructionsAdded = false;

public function handle_parser_done(Doku_Event $event, $param) {
/** @var helper_plugin_struct $struct */
$struct = plugin_load('helper', 'struct');
if (!$struct) {
Expand All @@ -45,8 +46,16 @@ public function handle_parser_done(Doku_Event $event, $param) {
return;
}

if ($instructionsAdded) {
return;
}

$instructionsAdded = true;

$last = end($event->data->calls);
$pos = $last[2];

$INSTRUCTION_POSITION_INDEX = 2;
$pos = $last[$INSTRUCTION_POSITION_INDEX];

$event->data->calls[] = array(
'plugin',
Expand All @@ -57,7 +66,14 @@ public function handle_parser_done(Doku_Event $event, $param) {
);
}

public function handle_init(Doku_Event &$event, $param) {
/**
* Event handler for PLUGIN_STRUCT_TYPECLASS_INIT
*
* @param Doku_Event $event
* @param $param
*/
final public function registerTypeWithStructPlugin(Doku_Event $event, $param)
{
$event->data['Section'] = 'dokuwiki\\plugin\\structsection\\types\\Section';
}

Expand Down
2 changes: 1 addition & 1 deletion lib/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
"eslint": "NODE_ENV=production eslint script/main.js"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.0",
"babel-preset-env": "^1.5.2",
"eslint": "^4.1.0",
"eslint-config-airbnb-base": "^11.2.0",
"eslint-loader": "^1.8.0",
"eslint-plugin-import": "^2.6.0",
"qunit": "^1.0.0",
"webpack": "^3.0.0"
"@babel/core": "^7.7.7",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.6",
"babel-preset-env": "^1.7.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.19.1",
"qunit": "^2.9.3",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
}
}
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base structsection
author Michael Große
email mic.grosse@googlemail.com
date 2017-11-05
date 2019-12-31
name Struct Sections
desc New type to show struct wiki fields as actual sections of the page
url https://dokuwiki.org/plugin:structsection
3 changes: 0 additions & 3 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
* @author Michael Große <mic.grosse@googlemail.com>
*/

// must be run within Dokuwiki
use dokuwiki\plugin\struct\meta\AccessTable;
use dokuwiki\plugin\struct\meta\Assignments;
use dokuwiki\plugin\struct\meta\StructException;

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

class syntax_plugin_structsection extends DokuWiki_Syntax_Plugin {

protected $hasBeenRendered = false;
Expand Down
4 changes: 3 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global process */
const webpack = require('webpack');
const path = require('path');

// fix for https://github.com/webpack/webpack/issues/2537
if (process.argv.indexOf('-p') !== -1) {
Expand All @@ -9,7 +10,8 @@ if (process.argv.indexOf('-p') !== -1) {
module.exports = {
entry: './script/main.js',
output: {
filename: 'lib/bundle.js',
path: path.resolve(__dirname, 'lib/'),
filename: 'bundle.js',
},
module: {
rules: [
Expand Down
Loading

0 comments on commit 4b6443b

Please sign in to comment.