-
Notifications
You must be signed in to change notification settings - Fork 21
/
convert.php
executable file
·54 lines (47 loc) · 1.09 KB
/
convert.php
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
#!/usr/bin/env php
<?php
/**
* Convert converts Mediawiki format to GitHub Flavoured Markdown format
*
* Current Author
* @author James Riordon <[email protected]>
* @link https://github.com/outofcontrol/mediawiki-to-gfm
* Original Author
* @author Philip Ashlock <[email protected]>
* @link https://github.com/philipashlock/mediawiki-to-markdown
* @license MIT License https://opensource.org/licenses/MIT
*/
if (is_file(__DIR__.'/vendor/autoload.php') === true) {
require_once 'vendor/autoload.php';
} else {
exit("Please run 'composer update --no-dev' first." . PHP_EOL);
}
$args = getopt(
'',
[
'filename:',
'output::',
'format::',
'addmeta::',
'flatten::',
'indexes::',
'skiperrors::',
'version::',
'help::'
]
);
$convert = new App\Convert($args);
if (isset($args['help'])) {
$convert->help();
exit;
}
if (isset($args['version'])) {
$convert->getVersion();
exit;
}
try {
$convert->run();
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
exit(1);
}