Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit a8c9e01

Browse files
committed
Code cleanup
1 parent c1ca683 commit a8c9e01

File tree

12 files changed

+273
-274
lines changed

12 files changed

+273
-274
lines changed

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ root = true
33

44
[*]
55
indent_style = space
6-
indent_size = 4
6+
indent_size = 2
77
end_of_line = lf
88
charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
1111

12-
[*.json]
13-
indent_size = 2
14-
1512
[*.md]
1613
trim_trailing_whitespace = false

.github/workflows/labels.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
-
16-
# https://github.com/actions/checkout
1716
name: Checkout
18-
uses: actions/checkout@v1
17+
uses: actions/checkout@v2
1918
-
20-
# https://github.com/crazy-max/ghaction-github-labeler
2119
name: Run Labeler
2220
if: success()
23-
uses: crazy-max/ghaction-github-labeler@v1
21+
uses: crazy-max/ghaction-github-labeler@v2
2422
env:
2523
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Intellij
12
/.idea
3+
/*.iml
4+
5+
# Project
26
/.dev
37
/bin

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2020/05/13
4+
5+
* Fix duplicated content during release
6+
* Update metadata
7+
* Code cleanup
8+
39
## 2018/09/16
410

511
* Fix underscores not showing on last line (Issue #23)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2016-2018 CrazyMax <webmaster@crazyws.fr>
1+
Copyright © 2016-2020 CrazyMax <contact@crazymax.dev>
22

33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by

build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
release.src = plugin
22
release.base = syntaxhighlighter4
33
release.author = CrazyMax
4-
release.email = webmaster@crazyws.fr
5-
release.date = 2018-09-16
4+
release.email = contact@crazymax.dev
5+
release.date = 2020-05-13
66
release.name = SyntaxHighlighter4 Plugin
77
release.desc = Alternative to GeSHi server-side code highlighting with client-side SyntaxHighlighter 4 by Alex Gorbatchev
88
release.url = http://www.dokuwiki.org/plugin:syntaxhighlighter4

dist/syntaxhighlighter4.zip

-200 KB
Binary file not shown.

plugin/action.php

Lines changed: 66 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,87 +3,85 @@
33
* DokuWiki Plugin syntaxhighlighter4 (Action Component).
44
*
55
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6-
* @author CrazyMax <webmaster@crazyws.fr>
6+
* @author CrazyMax <contact@crazymax.dev>
77
*/
88

99
// must be run within Dokuwiki
1010
if (!defined('DOKU_INC')) {
11-
die();
11+
die();
1212
}
1313

1414
class action_plugin_syntaxhighlighter4 extends DokuWiki_Action_Plugin {
1515

16-
/**
17-
* Registers a callback function for a given event.
18-
*
19-
* @param Doku_Event_Handler $controller DokuWiki's event controller object
20-
*
21-
* @return void
22-
*/
23-
public function register(Doku_Event_Handler $controller) {
24-
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_metaheader');
25-
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_jsprocessing');
26-
}
16+
/**
17+
* Registers a callback function for a given event.
18+
*
19+
* @param Doku_Event_Handler $controller DokuWiki's event controller object
20+
*
21+
* @return void
22+
*/
23+
public function register(Doku_Event_Handler $controller) {
24+
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_metaheader');
25+
$controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, 'handle_jsprocessing');
26+
}
2727

28-
/**
29-
* [Custom event handler which performs action].
30-
*
31-
* @param Doku_Event $event event object by reference
32-
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
33-
* handler was registered]
34-
*
35-
* @return void
36-
*/
37-
public function handle_metaheader(Doku_Event $event, $param) {
38-
// Add SyntaxHighlighter theme.
39-
$event->data['link'][] = array(
40-
'rel' => 'stylesheet',
41-
'type' => 'text/css',
42-
'href' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
43-
);
28+
/**
29+
* [Custom event handler which performs action].
30+
*
31+
* @param Doku_Event $event event object by reference
32+
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
33+
* handler was registered]
34+
*
35+
* @return void
36+
*/
37+
public function handle_metaheader(Doku_Event $event, $param) {
38+
// Add SyntaxHighlighter theme.
39+
$event->data['link'][] = array(
40+
'rel' => 'stylesheet',
41+
'type' => 'text/css',
42+
'href' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/'.$this->getConf('theme'),
43+
);
4444

45-
// Override some CSS
46-
$event->data['link'][] = array(
47-
'rel' => 'stylesheet',
48-
'type' => 'text/css',
49-
'href' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/override.css',
50-
);
45+
// Override some CSS
46+
$event->data['link'][] = array(
47+
'rel' => 'stylesheet',
48+
'type' => 'text/css',
49+
'href' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/override.css',
50+
);
5151

52-
// Register SyntaxHighlighter javascript.
53-
$event->data['script'][] = array(
54-
'type' => 'text/javascript',
55-
'src' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js',
56-
'_data' => '',
57-
);
58-
}
52+
// Register SyntaxHighlighter javascript.
53+
$event->data['script'][] = array(
54+
'type' => 'text/javascript',
55+
'src' => DOKU_BASE.'lib/plugins/syntaxhighlighter4/dist/syntaxhighlighter.js',
56+
'_data' => '',
57+
);
58+
}
5959

60-
public function handle_jsprocessing(Doku_Event $event, $param) {
61-
global $ID, $INFO;
60+
public function handle_jsprocessing(Doku_Event $event, $param) {
61+
global $ID, $INFO;
6262

63-
// Ensures code will be written only on base page
64-
if ($ID != $INFO['id']) {
65-
return;
66-
}
63+
// Ensures code will be written only on base page
64+
if ($ID != $INFO['id']) {
65+
return;
66+
}
6767

68-
// Load Syntaxhighlighter config
69-
ptln('');
70-
ptln("<script type='text/javascript'>");
71-
ptln('syntaxhighlighterConfig = {');
72-
ptln(' autoLinks: '.($this->getConf('autoLinks') == 1 ? 'true' : 'false').',');
73-
$firstLine = $this->getConf('first-line');
74-
if ($firstLine > 0) {
75-
ptln(' firstLine: '.$firstLine.',');
76-
}
77-
ptln(' gutter: '.($this->getConf('gutter') == 1 ? 'true' : 'false').',');
78-
ptln(' htmlScript: '.($this->getConf('htmlScript') == 1 ? 'true' : 'false').',');
79-
$tabSize = $this->getConf('tabSize');
80-
if ($tabSize > 0) {
81-
ptln(' tabSize: '.$tabSize.',');
82-
}
83-
ptln(' smartTabs: '.($this->getConf('smartTabs') == 1 ? 'true' : 'false'));
84-
ptln('}');
85-
ptln('</script>');
68+
// Load Syntaxhighlighter config
69+
ptln('');
70+
ptln("<script type='text/javascript'>");
71+
ptln('syntaxhighlighterConfig = {');
72+
ptln(' autoLinks: '.($this->getConf('autoLinks') == 1 ? 'true' : 'false').',');
73+
$firstLine = $this->getConf('first-line');
74+
if ($firstLine > 0) {
75+
ptln(' firstLine: '.$firstLine.',');
8676
}
77+
ptln(' gutter: '.($this->getConf('gutter') == 1 ? 'true' : 'false').',');
78+
ptln(' htmlScript: '.($this->getConf('htmlScript') == 1 ? 'true' : 'false').',');
79+
$tabSize = $this->getConf('tabSize');
80+
if ($tabSize > 0) {
81+
ptln(' tabSize: '.$tabSize.',');
82+
}
83+
ptln(' smartTabs: '.($this->getConf('smartTabs') == 1 ? 'true' : 'false'));
84+
ptln('}');
85+
ptln('</script>');
86+
}
8787
}
88-
89-
// vim:ts=4:sw=4:et:

plugin/conf/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Default settings for the syntaxhighlighter4 plugin.
44
*
5-
* @author CrazyMax <webmaster@crazyws.fr>
5+
* @author CrazyMax <contact@crazymax.dev>
66
*/
77

88
$conf['theme'] = 'theme-default.css';

plugin/conf/metadata.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
/**
33
* Options for the syntaxhighlighter4 plugin.
44
*
5-
* @author CrazyMax <webmaster@crazyws.fr>
5+
* @author CrazyMax <contact@crazymax.dev>
66
*/
77

88
$meta['theme'] = array('multichoice', '_choices' => array(
9-
'theme-default.css',
10-
'theme-django.css',
11-
'theme-eclipse.css',
12-
'theme-emacs.css',
13-
'theme-fadetogrey.css',
14-
'theme-mdultra.css',
15-
'theme-midnight.css',
16-
'theme-rdark.css',
17-
'theme-swift.css',
9+
'theme-default.css',
10+
'theme-django.css',
11+
'theme-eclipse.css',
12+
'theme-emacs.css',
13+
'theme-fadetogrey.css',
14+
'theme-mdultra.css',
15+
'theme-midnight.css',
16+
'theme-rdark.css',
17+
'theme-swift.css',
1818
));
1919

2020
// defaults

0 commit comments

Comments
 (0)